Skip to content

Commit

Permalink
[pack][js-debug] Fix ext pack issue that left-out js-debug*
Browse files Browse the repository at this point in the history
We use node-fetch to call open-vsx API end-points. For external
built-in extensions, we want to make sure they exist on open-vsx
before adding them to the pack, to avoid issues when resolving the
pack(we do not check for a specific version, because they may not
follow vscode's versioning).

It turns-out that For this case, we were generating a URL that had
a trailing slash, which did not work:

Original URL, returns 404:
https://open-vsx.org/api/ms-vscode/js-debug-companion/

Corrected URL (works):
https://open-vsx.org/api/ms-vscode/js-debug-companion

P.S. also aligned version of `node-fetch` and its typings

Fixes #123

Signed-off-by: Marc Dumais <[email protected]>
  • Loading branch information
marcdumais-work committed Aug 15, 2023
1 parent 6610b3e commit da651e2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"@types/archiver": "^3.0.0",
"@types/fs-extra": "^9.0.0",
"@types/node": "14",
"@types/node-fetch": "^2.5.7",
"@types/node-fetch": "^2.6.0",
"archiver": "^3.0.3",
"capitalize": "^2.0.2",
"colors": "^1.4.0",
"cross-env": "^7.0.3",
"execa": "^6.0.0",
"fs-extra": "^10.0.0",
"node-fetch": "^2.5.7",
"node-fetch": "^2.6.0",
"ovsx": "^0.8.1",
"p-queue": "^2.4.2",
"yargs": "^17.0.0"
Expand Down
6 changes: 4 additions & 2 deletions src/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* version-related utility functions
*/
const fetch = require('node-fetch');
const {default : fetch} = require('node-fetch');
const fs = require('fs')
const { run, vscode } = require('./paths.js');

Expand Down Expand Up @@ -56,7 +56,9 @@ async function resolveVscodeVersion() {
async function isPublished(version, extension, namespace = 'vscode') {
try {
const registry = process.env.OVSX_REGISTRY_URL ? process.env.OVSX_REGISTRY_URL : OPEN_VSX_ORG_URL;
const response = await fetch(`${registry}/api/${namespace}/${extension}/${version}`);
let url = `${registry}/api/${namespace}/${extension}`;
if (version) { url += "/" + version; }
const response = await fetch(url);
return response.ok;
} catch (e) {
console.log(e);
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca"
integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==

"@types/node-fetch@^2.5.7":
version "2.6.2"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.2.tgz#d1a9c5fd049d9415dce61571557104dec3ec81da"
integrity sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==
"@types/node-fetch@^2.6.0":
version "2.6.4"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.4.tgz#1bc3a26de814f6bf466b25aeb1473fa1afe6a660"
integrity sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==
dependencies:
"@types/node" "*"
form-data "^3.0.0"
Expand Down Expand Up @@ -811,10 +811,10 @@ node-addon-api@^4.3.0:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.3.0.tgz#52a1a0b475193e0928e98e0426a0d1254782b77f"
integrity sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==

node-fetch@^2.5.7:
version "2.6.8"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.8.tgz#a68d30b162bc1d8fd71a367e81b997e1f4d4937e"
integrity sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==
node-fetch@^2.6.0:
version "2.6.12"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba"
integrity sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==
dependencies:
whatwg-url "^5.0.0"

Expand Down

0 comments on commit da651e2

Please sign in to comment.