Skip to content

Commit

Permalink
Support versioned proposals in vscode-dts
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jun 28, 2024
1 parent a290562 commit 1ec3590
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 36 deletions.
20 changes: 18 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,28 @@ function handleDev(gitTagOrBranch: string = 'main') {
return;
}

for (const name of proposalNames) {
for (const info of proposalNames) {

const idx = info.lastIndexOf('@');
const name = idx < 0 ? info : info.slice(0, idx);
const version = idx < 0 ? undefined : info.slice(idx + 1);

const url = `https://raw.githubusercontent.com/microsoft/vscode/${gitTagOrBranch}/src/vscode-dts/vscode.proposed.${name}.d.ts`
const outPath = path.resolve(process.cwd(), `./vscode.proposed.${name}.d.ts`)
console.log(`Downloading vscode.proposed.${toGreenString(name)}.d.ts\nTo: ${outPath}\nFrom: ${url}`)

download(url, outPath).catch(err => console.error(err))
download(url, outPath)
.then(async () => {
if (version) {
const src = await fs.promises.readFile(outPath, 'utf-8');
const versionRegex = /\/\/\s*version:\s*(\d+)/i;
const versionMatch = versionRegex.exec(src)[1];
if (versionMatch !== version) {
console.log(toRedString(`Version mismatch for ${name}: Latest is ${versionMatch}, the request version ${version} DOES NOT exist.`));
}
}
})
.catch(err => console.error(err))
}

console.log('Read more about proposed API at: https://code.visualstudio.com/api/advanced-topics/using-proposed-api')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vscode/dts",
"version": "0.4.0",
"version": "0.4.1",
"description": "CLI utility for downloading vscode.d.ts and vscode.proposed.d.ts",
"author": {
"name": "Microsoft Corporation"
Expand Down
9 changes: 7 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
{
"compilerOptions": {
"target": "ES2018",
"target": "ES2022",
"lib": [
"ES2022"
],
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"sourceMap": true
},
"files": ["index.ts"]
"files": [
"index.ts"
]
}
60 changes: 29 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,84 +19,82 @@
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz"

"@types/minimist@^1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c"
integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==
version "1.2.5"
resolved "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz"
integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==

"@types/node@*":
version "12.7.5"
resolved "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz"

"@types/node@^14.0.0":
version "14.18.48"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.48.tgz#ee5c7ac6e38fd2a9e6885f15c003464cf2da343c"
integrity sha512-iL0PIMwejpmuVHgfibHpfDwOdsbmB50wr21X71VnF5d7SsBF7WK+ZvP/SCcFm7Iwb9iiYSap9rlrdhToNAWdxg==
"@types/node@*", "@types/node@^14.0.0":
version "14.18.63"
resolved "https://registry.npmjs.org/@types/node/-/node-14.18.63.tgz"
integrity sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==

"@types/prompts@^2.4.4":
version "2.4.4"
resolved "https://registry.yarnpkg.com/@types/prompts/-/prompts-2.4.4.tgz#dd5a1d41cb1bcd0fc4464bf44a0c8354f36ea735"
integrity sha512-p5N9uoTH76lLvSAaYSZtBCdEXzpOOufsRjnhjVSrZGXikVGHX9+cc9ERtHRV4hvBKHyZb1bg4K+56Bd2TqUn4A==
version "2.4.9"
resolved "https://registry.npmjs.org/@types/prompts/-/prompts-2.4.9.tgz"
integrity sha512-qTxFi6Buiu8+50/+3DGIWLHM6QuWsEKugJnnP6iv2Mc4ncxE4A/OJkjuVOA+5X0X1S/nq5VJRa8Lu+nwcvbrKA==
dependencies:
"@types/node" "*"
kleur "^3.0.3"

"@types/rimraf@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-3.0.2.tgz#a63d175b331748e5220ad48c901d7bbf1f44eef8"
resolved "https://registry.npmjs.org/@types/rimraf/-/rimraf-3.0.2.tgz"
integrity sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ==
dependencies:
"@types/glob" "*"
"@types/node" "*"

agent-base@^7.0.2:
version "7.1.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.0.tgz#536802b76bc0b34aa50195eb2442276d613e3434"
integrity sha512-o/zjMZRhJxny7OyEF+Op8X+efiELC7k7yOjMzgfzVqOzXqkBkWI79YoTdOtsuWd5BWhAGAuOY/Xa6xpiaWXiNg==
version "7.1.1"
resolved "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz"
integrity sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==
dependencies:
debug "^4.3.4"

debug@4, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz"
debug@^4.3.4, debug@4:
version "4.3.5"
resolved "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz"
integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==
dependencies:
ms "2.1.2"

https-proxy-agent@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.0.tgz#75cb70d04811685667183b31ab158d006750418a"
integrity sha512-0euwPCRyAPSgGdzD1IVN9nJYHtBhJwb6XPfbpQcYbPCwrBidX6GzxmchnaF4sfF/jPb74Ojx5g4yTg3sixlyPw==
version "7.0.5"
resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz"
integrity sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==
dependencies:
agent-base "^7.0.2"
debug "4"

kleur@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
resolved "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==

minimist@^1.2.8:
version "1.2.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==

[email protected]:
version "2.1.2"
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==

prompts@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069"
resolved "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz"
integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==
dependencies:
kleur "^3.0.3"
sisteransi "^1.0.5"

sisteransi@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
resolved "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz"
integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==

typescript@^5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.3.tgz#8d84219244a6b40b6fb2b33cc1c062f715b9e826"
integrity sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==
version "5.5.2"
resolved "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz"
integrity sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==

0 comments on commit 1ec3590

Please sign in to comment.