Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

Commit 812287f

Browse files
committed
fix: can handle v prefix in the GH release name
Ref: arduino/arduino-cli#2374 Signed-off-by: dankeboy36 <[email protected]>
1 parent c2835b1 commit 812287f

File tree

4 files changed

+201
-10
lines changed

4 files changed

+201
-10
lines changed

Diff for: package-lock.json

+192-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "install-from-gh-to-vscode",
3-
"version": "0.1.0-beta.8",
3+
"version": "0.1.0-beta.9",
44
"description": "Lib for VS Code extensions installing executables from GitHub",
55
"main": "out/src/index.js",
66
"types": "out/src/index.d.ts",
@@ -27,7 +27,8 @@
2727
"test": "tsc -p ./ && tape -r source-map-support/register 'out/test/**/*.js' | tap-spec",
2828
"format": "clang-format -i --glob=\"{src,test}/**/*.ts\"",
2929
"git-clang-format": "git-clang-format",
30-
"prepare": "npm run test && npm run format && tsc -p ./"
30+
"prepare": "npm run test && npm run format && tsc -p ./",
31+
"example": "ts-node ./src/example/index.ts"
3132
},
3233
"dependencies": {
3334
"abort-controller": "^3.0.0",
@@ -58,6 +59,7 @@
5859
"tap-spec": "^5.0.0",
5960
"tape": "^5.0.0",
6061
"tmp-promise": "^2.1.0",
62+
"ts-node": "^10.9.1",
6163
"typescript": "^3.8.3"
6264
}
6365
}

Diff for: src/example/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ class Noop implements UI {
2424

2525
const arduinoCliOptions: Options = {
2626
// pinned version range
27-
versionRange: '<=0.27.0',
27+
versionRange: '<=v0.35.0-rc.7',
2828
gh: {owner: 'arduino', repo: 'arduino-cli'},
2929
executableName: 'arduino-cli',
3030
versionFlags: ['version', '--format', 'json'],
3131
parseVersion(output: string):
3232
string { return JSON.parse(output.trim()).VersionString; },
3333
async pickAsset(assetNames: string[]): Promise<number> {
34-
return 6; // 'arduino-cli_0.27.0_macOS_64bit.tar.gz'
34+
// console.log(assetNames[7]); // arduino-cli_0.35.0-rc.7_macOS_64bit.tar.gz
35+
return 7;
3536
}
3637
};
3738

Diff for: src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ async function latestCompatibleVersion(ui: UI): Promise<string|undefined> {
285285
.reverse();
286286
for (const tag of tags) {
287287
if (versionConstrains.test(tag)) {
288-
return tag.version;
288+
return tag.raw; // use the raw semver string
289+
// https://github.com/arduino/arduino-cli/pull/2374
289290
}
290291
}
291292
throw new Error(`Could not find a compatible version for ${

0 commit comments

Comments
 (0)