Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
feat: compatible deno cache command since Deno v0.40.0
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Apr 9, 2020
1 parent 9be33a4 commit 7309b0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
import getport from "get-port";
import execa from "execa";
import { init, localize } from "vscode-nls-i18n";
import * as semver from "semver";

import { TreeViewProvider } from "./tree_view_provider";
import { ImportMap } from "../../core/import_map";
Expand Down Expand Up @@ -502,14 +503,14 @@ Executable ${this.denoInfo.executablePath}`;
cancellable: true,
},
(process, cancelToken) => {
const ps = execa(
this.denoInfo.executablePath,
["fetch", moduleName],
{
// timeout of 2 minute
timeout: 1000 * 60 * 2,
}
);
// `deno fetch xxx` has been renamed to `deno cache xxx` since Deno v0.40.0
const cmd = semver.gte(this.denoInfo.version.deno, "0.40.0")
? "cache"
: "fetch";
const ps = execa(this.denoInfo.executablePath, [cmd, moduleName], {
// timeout of 2 minute
timeout: 1000 * 60 * 2,
});

const updateProgress = (buf: Buffer) => {
const raw = buf.toString();
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"@types/json5": "0.0.30",
"@types/node": "12.12.35",
"@types/which": "1.3.2",
"@types/semver": "7.1.0",
"@typescript-eslint/eslint-plugin": "2.27.0",
"@typescript-eslint/parser": "2.27.0",
"coveralls": "3.0.11",
Expand All @@ -193,6 +194,7 @@
"deepmerge": "^4.2.2",
"json5": "^2.1.1",
"typescript-deno-plugin": "./typescript-deno-plugin",
"vscode-nls-i18n": "^0.2.0"
"vscode-nls-i18n": "^0.2.0",
"semver": "7.2.1"
}
}
2 changes: 0 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
},
"dependencies": {
"execa": "4.0.0",
"semver": "7.2.1",
"typescript": "3.8.3",
"vscode-languageserver": "6.1.1",
"vscode-languageserver-textdocument": "1.0.1",
"vscode-uri": "2.1.1",
"which": "2.0.2"
},
"devDependencies": {
"@types/semver": "7.1.0",
"@types/which": "1.3.2"
}
}

0 comments on commit 7309b0c

Please sign in to comment.