diff --git a/package.json b/package.json index 2bed910..81dff50 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/version.js b/src/version.js index d97cc93..e8b6d7c 100644 --- a/src/version.js +++ b/src/version.js @@ -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'); @@ -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); diff --git a/yarn.lock b/yarn.lock index 89a157a..ec2323d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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"