ovsx 0.2.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/util.js CHANGED
@@ -1,184 +1,184 @@
1
- "use strict";
2
- /********************************************************************************
3
- * Copyright (c) 2019 TypeFox and others
4
- *
5
- * This program and the accompanying materials are made available under the
6
- * terms of the Eclipse Public License v. 2.0 which is available at
7
- * http://www.eclipse.org/legal/epl-2.0.
8
- *
9
- * SPDX-License-Identifier: EPL-2.0
10
- ********************************************************************************/
11
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- const fs = require("fs");
22
- const path = require("path");
23
- const tmp = require("tmp");
24
- const readline = require("readline");
25
- var util_1 = require("util");
26
- exports.promisify = util_1.promisify;
27
- function addEnvOptions(options) {
28
- if (!options.registryUrl) {
29
- options.registryUrl = process.env.OVSX_REGISTRY_URL;
30
- }
31
- if (!options.pat) {
32
- options.pat = process.env.OVSX_PAT;
33
- }
34
- if (!options.username) {
35
- options.username = process.env.OVSX_USERNAME;
36
- }
37
- if (!options.password) {
38
- options.password = process.env.OVSX_PASSWORD;
39
- }
40
- }
41
- exports.addEnvOptions = addEnvOptions;
42
- function matchExtensionId(id) {
43
- return /^([\w-]+)(?:\.|\/)([\w-]+)$/.exec(id);
44
- }
45
- exports.matchExtensionId = matchExtensionId;
46
- function optionalStat(path) {
47
- return new Promise((resolve, reject) => {
48
- fs.stat(path, (err, stats) => resolve(stats));
49
- });
50
- }
51
- exports.optionalStat = optionalStat;
52
- function makeDirs(path) {
53
- return new Promise((resolve, reject) => {
54
- if (fs.existsSync(path)) {
55
- resolve();
56
- }
57
- else {
58
- fs.mkdir(path, { recursive: true }, err => {
59
- if (err)
60
- reject(err);
61
- else
62
- resolve();
63
- });
64
- }
65
- });
66
- }
67
- exports.makeDirs = makeDirs;
68
- function createTempFile(options) {
69
- return new Promise((resolve, reject) => {
70
- tmp.tmpName(options, (err, name) => {
71
- if (err)
72
- reject(err);
73
- else
74
- resolve(name);
75
- });
76
- });
77
- }
78
- exports.createTempFile = createTempFile;
79
- function handleError(debug, additionalMessage) {
80
- return reason => {
81
- if (reason instanceof Error && !debug) {
82
- console.error(`\u274c ${reason.message}`);
83
- if (additionalMessage) {
84
- console.error(additionalMessage);
85
- }
86
- }
87
- else if (typeof reason === 'string') {
88
- console.error(`\u274c ${reason}`);
89
- }
90
- else if (reason !== undefined) {
91
- console.error(reason);
92
- }
93
- else {
94
- console.error('An unknown error occurred.');
95
- }
96
- process.exit(1);
97
- };
98
- }
99
- exports.handleError = handleError;
100
- function statusError(response) {
101
- if (response.statusMessage)
102
- return new Error(`The server responded with status ${response.statusCode}: ${response.statusMessage}`);
103
- else
104
- return new Error(`The server responded with status ${response.statusCode}.`);
105
- }
106
- exports.statusError = statusError;
107
- function readFile(name, packagePath, encoding = 'utf-8') {
108
- return new Promise((resolve, reject) => {
109
- fs.readFile(path.join(packagePath || process.cwd(), name), { encoding }, (err, content) => {
110
- if (err) {
111
- reject(err);
112
- }
113
- else {
114
- resolve(content);
115
- }
116
- });
117
- });
118
- }
119
- exports.readFile = readFile;
120
- function readManifest(packagePath) {
121
- return __awaiter(this, void 0, void 0, function* () {
122
- const content = yield readFile('package.json', packagePath);
123
- return JSON.parse(content);
124
- });
125
- }
126
- exports.readManifest = readManifest;
127
- function validateManifest(manifest) {
128
- if (!manifest.publisher) {
129
- throw new Error("Missing required field 'publisher'.");
130
- }
131
- if (!manifest.name) {
132
- throw new Error("Missing required field 'name'.");
133
- }
134
- if (!manifest.version) {
135
- throw new Error("Missing required field 'version'.");
136
- }
137
- }
138
- exports.validateManifest = validateManifest;
139
- function writeFile(name, content, packagePath, encoding = 'utf-8') {
140
- return new Promise((resolve, reject) => {
141
- fs.writeFile(path.join(packagePath || process.cwd(), name), content, { encoding }, err => {
142
- if (err) {
143
- reject(err);
144
- }
145
- else {
146
- resolve();
147
- }
148
- });
149
- });
150
- }
151
- exports.writeFile = writeFile;
152
- function writeManifest(manifest, packagePath) {
153
- const content = JSON.stringify(manifest, null, 4);
154
- return writeFile('package.json', content, packagePath);
155
- }
156
- exports.writeManifest = writeManifest;
157
- function getUserInput(text) {
158
- return new Promise(resolve => {
159
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
160
- rl.question(text, answer => {
161
- resolve(answer);
162
- rl.close();
163
- });
164
- });
165
- }
166
- exports.getUserInput = getUserInput;
167
- function getUserChoice(text, values, defaultValue, lowerCase = true) {
168
- return __awaiter(this, void 0, void 0, function* () {
169
- const prompt = text + '\n' + values.map(v => v === defaultValue ? `[${v}]` : v).join('/') + ': ';
170
- const answer = yield getUserInput(prompt);
171
- if (!answer) {
172
- return defaultValue;
173
- }
174
- const lcAnswer = lowerCase ? answer.toLowerCase() : answer;
175
- for (const value of values) {
176
- if (value.startsWith(lcAnswer)) {
177
- return value;
178
- }
179
- }
180
- return defaultValue;
181
- });
182
- }
183
- exports.getUserChoice = getUserChoice;
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2019 TypeFox and others
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * SPDX-License-Identifier: EPL-2.0
10
+ ********************************************************************************/
11
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const fs = require("fs");
22
+ const path = require("path");
23
+ const tmp = require("tmp");
24
+ const readline = require("readline");
25
+ var util_1 = require("util");
26
+ exports.promisify = util_1.promisify;
27
+ function addEnvOptions(options) {
28
+ if (!options.registryUrl) {
29
+ options.registryUrl = process.env.OVSX_REGISTRY_URL;
30
+ }
31
+ if (!options.pat) {
32
+ options.pat = process.env.OVSX_PAT;
33
+ }
34
+ if (!options.username) {
35
+ options.username = process.env.OVSX_USERNAME;
36
+ }
37
+ if (!options.password) {
38
+ options.password = process.env.OVSX_PASSWORD;
39
+ }
40
+ }
41
+ exports.addEnvOptions = addEnvOptions;
42
+ function matchExtensionId(id) {
43
+ return /^([\w-]+)(?:\.|\/)([\w-]+)$/.exec(id);
44
+ }
45
+ exports.matchExtensionId = matchExtensionId;
46
+ function optionalStat(path) {
47
+ return new Promise((resolve, reject) => {
48
+ fs.stat(path, (err, stats) => resolve(stats));
49
+ });
50
+ }
51
+ exports.optionalStat = optionalStat;
52
+ function makeDirs(path) {
53
+ return new Promise((resolve, reject) => {
54
+ if (fs.existsSync(path)) {
55
+ resolve();
56
+ }
57
+ else {
58
+ fs.mkdir(path, { recursive: true }, err => {
59
+ if (err)
60
+ reject(err);
61
+ else
62
+ resolve();
63
+ });
64
+ }
65
+ });
66
+ }
67
+ exports.makeDirs = makeDirs;
68
+ function createTempFile(options) {
69
+ return new Promise((resolve, reject) => {
70
+ tmp.tmpName(options, (err, name) => {
71
+ if (err)
72
+ reject(err);
73
+ else
74
+ resolve(name);
75
+ });
76
+ });
77
+ }
78
+ exports.createTempFile = createTempFile;
79
+ function handleError(debug, additionalMessage) {
80
+ return reason => {
81
+ if (reason instanceof Error && !debug) {
82
+ console.error(`\u274c ${reason.message}`);
83
+ if (additionalMessage) {
84
+ console.error(additionalMessage);
85
+ }
86
+ }
87
+ else if (typeof reason === 'string') {
88
+ console.error(`\u274c ${reason}`);
89
+ }
90
+ else if (reason !== undefined) {
91
+ console.error(reason);
92
+ }
93
+ else {
94
+ console.error('An unknown error occurred.');
95
+ }
96
+ process.exit(1);
97
+ };
98
+ }
99
+ exports.handleError = handleError;
100
+ function statusError(response) {
101
+ if (response.statusMessage)
102
+ return new Error(`The server responded with status ${response.statusCode}: ${response.statusMessage}`);
103
+ else
104
+ return new Error(`The server responded with status ${response.statusCode}.`);
105
+ }
106
+ exports.statusError = statusError;
107
+ function readFile(name, packagePath, encoding = 'utf-8') {
108
+ return new Promise((resolve, reject) => {
109
+ fs.readFile(path.join(packagePath || process.cwd(), name), { encoding }, (err, content) => {
110
+ if (err) {
111
+ reject(err);
112
+ }
113
+ else {
114
+ resolve(content);
115
+ }
116
+ });
117
+ });
118
+ }
119
+ exports.readFile = readFile;
120
+ function readManifest(packagePath) {
121
+ return __awaiter(this, void 0, void 0, function* () {
122
+ const content = yield readFile('package.json', packagePath);
123
+ return JSON.parse(content);
124
+ });
125
+ }
126
+ exports.readManifest = readManifest;
127
+ function validateManifest(manifest) {
128
+ if (!manifest.publisher) {
129
+ throw new Error("Missing required field 'publisher'.");
130
+ }
131
+ if (!manifest.name) {
132
+ throw new Error("Missing required field 'name'.");
133
+ }
134
+ if (!manifest.version) {
135
+ throw new Error("Missing required field 'version'.");
136
+ }
137
+ }
138
+ exports.validateManifest = validateManifest;
139
+ function writeFile(name, content, packagePath, encoding = 'utf-8') {
140
+ return new Promise((resolve, reject) => {
141
+ fs.writeFile(path.join(packagePath || process.cwd(), name), content, { encoding }, err => {
142
+ if (err) {
143
+ reject(err);
144
+ }
145
+ else {
146
+ resolve();
147
+ }
148
+ });
149
+ });
150
+ }
151
+ exports.writeFile = writeFile;
152
+ function writeManifest(manifest, packagePath) {
153
+ const content = JSON.stringify(manifest, null, 4);
154
+ return writeFile('package.json', content, packagePath);
155
+ }
156
+ exports.writeManifest = writeManifest;
157
+ function getUserInput(text) {
158
+ return new Promise(resolve => {
159
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
160
+ rl.question(text, answer => {
161
+ resolve(answer);
162
+ rl.close();
163
+ });
164
+ });
165
+ }
166
+ exports.getUserInput = getUserInput;
167
+ function getUserChoice(text, values, defaultValue, lowerCase = true) {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ const prompt = text + '\n' + values.map(v => v === defaultValue ? `[${v}]` : v).join('/') + ': ';
170
+ const answer = yield getUserInput(prompt);
171
+ if (!answer) {
172
+ return defaultValue;
173
+ }
174
+ const lcAnswer = lowerCase ? answer.toLowerCase() : answer;
175
+ for (const value of values) {
176
+ if (value.startsWith(lcAnswer)) {
177
+ return value;
178
+ }
179
+ }
180
+ return defaultValue;
181
+ });
182
+ }
183
+ exports.getUserChoice = getUserChoice;
184
184
  //# sourceMappingURL=util.js.map
package/package.json CHANGED
@@ -1,67 +1,67 @@
1
- {
2
- "name": "ovsx",
3
- "version": "0.2.1",
4
- "description": "Command line interface for Eclipse Open VSX",
5
- "keywords": [
6
- "cli",
7
- "vscode",
8
- "extensions",
9
- "publish"
10
- ],
11
- "license": "EPL-2.0",
12
- "homepage": "https://open-vsx.org",
13
- "repository": {
14
- "type": "git",
15
- "url": "ssh://git@github.com:eclipse/openvsx.git",
16
- "directory": "cli"
17
- },
18
- "bugs": "https://github.com/eclipse/openvsx/issues",
19
- "contributors": [
20
- {
21
- "name": "Miro Spönemann",
22
- "email": "miro.spoenemann@typefox.io",
23
- "url": "https://www.typefox.io"
24
- }
25
- ],
26
- "files": [
27
- "lib",
28
- "src"
29
- ],
30
- "main": "lib/index",
31
- "types": "lib/index",
32
- "bin": {
33
- "ovsx": "lib/ovsx"
34
- },
35
- "engines": {
36
- "node": ">= 10"
37
- },
38
- "dependencies": {
39
- "commander": "^6.1.0",
40
- "follow-redirects": "^1.13.2",
41
- "is-ci": "^2.0.0",
42
- "leven": "^3.1.0",
43
- "tmp": "^0.2.1",
44
- "vsce": "~1.97.0"
45
- },
46
- "devDependencies": {
47
- "@types/follow-redirects": "^1.13.0",
48
- "@types/is-ci": "^2.0.0",
49
- "@types/node": "^10.14.18",
50
- "@types/semver": "^7.1.0",
51
- "@types/tmp": "^0.1.0",
52
- "@typescript-eslint/eslint-plugin": "^3.6.1",
53
- "@typescript-eslint/parser": "^3.6.1",
54
- "eslint": "^7.4.0",
55
- "rimraf": "^3.0.2",
56
- "typescript": "3.8.3"
57
- },
58
- "scripts": {
59
- "clean": "rimraf lib",
60
- "build": "tsc -p ./tsconfig.json && yarn run lint && cp src/ovsx lib/ovsx",
61
- "watch": "tsc -w -p ./tsconfig.json",
62
- "lint": "eslint -c ./configs/eslintrc.json --ext .ts src",
63
- "prepare": "yarn run clean && yarn run build",
64
- "publish:next": "yarn publish --new-version \"$(semver $npm_package_version -i minor)-next.$(git rev-parse --short HEAD)\" --tag next --no-git-tag-version",
65
- "publish:latest": "yarn publish --tag latest"
66
- }
67
- }
1
+ {
2
+ "name": "ovsx",
3
+ "version": "0.5.0",
4
+ "description": "Command line interface for Eclipse Open VSX",
5
+ "keywords": [
6
+ "cli",
7
+ "vscode",
8
+ "extensions",
9
+ "publish"
10
+ ],
11
+ "license": "EPL-2.0",
12
+ "homepage": "https://open-vsx.org",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/eclipse/openvsx.git",
16
+ "directory": "cli"
17
+ },
18
+ "bugs": "https://github.com/eclipse/openvsx/issues",
19
+ "contributors": [
20
+ {
21
+ "name": "Miro Spönemann",
22
+ "email": "miro.spoenemann@typefox.io",
23
+ "url": "https://www.typefox.io"
24
+ }
25
+ ],
26
+ "files": [
27
+ "lib",
28
+ "src"
29
+ ],
30
+ "main": "lib/index",
31
+ "types": "lib/index",
32
+ "bin": {
33
+ "ovsx": "lib/ovsx"
34
+ },
35
+ "engines": {
36
+ "node": ">= 14"
37
+ },
38
+ "dependencies": {
39
+ "commander": "^6.1.0",
40
+ "follow-redirects": "^1.14.6",
41
+ "is-ci": "^2.0.0",
42
+ "leven": "^3.1.0",
43
+ "tmp": "^0.2.1",
44
+ "vsce": "^2.6.3"
45
+ },
46
+ "devDependencies": {
47
+ "@types/follow-redirects": "^1.13.1",
48
+ "@types/is-ci": "^2.0.0",
49
+ "@types/node": "^10.17.60",
50
+ "@types/semver": "^7.3.9",
51
+ "@types/tmp": "^0.1.0",
52
+ "@typescript-eslint/eslint-plugin": "^3.10.1",
53
+ "@typescript-eslint/parser": "^3.10.1",
54
+ "eslint": "^7.32.0",
55
+ "rimraf": "^3.0.2",
56
+ "typescript": "3.8.3"
57
+ },
58
+ "scripts": {
59
+ "clean": "rimraf lib",
60
+ "build": "tsc -p ./tsconfig.json && yarn run lint && cp src/ovsx lib/ovsx",
61
+ "watch": "tsc -w -p ./tsconfig.json",
62
+ "lint": "eslint -c ./configs/eslintrc.json --ext .ts src",
63
+ "prepare": "yarn run clean && yarn run build",
64
+ "publish:next": "yarn publish --new-version \"$(semver $npm_package_version -i minor)-next.$(git rev-parse --short HEAD)\" --tag next --no-git-tag-version",
65
+ "publish:latest": "yarn publish --tag latest"
66
+ }
67
+ }
package/src/get.ts CHANGED
@@ -19,14 +19,17 @@ import { promisify, matchExtensionId, optionalStat, makeDirs, addEnvOptions } fr
19
19
  */
20
20
  export async function getExtension(options: GetOptions): Promise<void> {
21
21
  addEnvOptions(options);
22
- const registry = new Registry(options);
22
+ if (!options.target) {
23
+ options.target = 'universal';
24
+ }
23
25
 
26
+ const registry = new Registry(options);
24
27
  const match = matchExtensionId(options.extensionId);
25
28
  if (!match) {
26
29
  throw new Error('The extension identifier must have the form `namespace.extension`.');
27
30
  }
28
31
 
29
- const extension = await registry.getMetadata(match[1], match[2]);
32
+ const extension = await registry.getMetadata(match[1], match[2], options.target);
30
33
  if (extension.error) {
31
34
  throw new Error(extension.error);
32
35
  }
@@ -48,7 +51,7 @@ function findMatchingVersion(registry: Registry, extension: Extension, constrain
48
51
  return Promise.resolve(extension);
49
52
  }
50
53
  for (const version of Object.keys(extension.allVersions)) {
51
- if (semver.satisfies(version, constraint)) {
54
+ if (!isAlias(extension, version) && semver.satisfies(version, constraint)) {
52
55
  try {
53
56
  return registry.getJson(new URL(extension.allVersions[version]));
54
57
  } catch (err) {
@@ -59,6 +62,10 @@ function findMatchingVersion(registry: Registry, extension: Extension, constrain
59
62
  return Promise.reject(`Extension ${extension.namespace}.${extension.name} has no published version matching '${constraint}'`);
60
63
  }
61
64
 
65
+ function isAlias(extension: Extension, version: string): boolean {
66
+ return extension.versionAlias.includes(version);
67
+ }
68
+
62
69
  async function printMetadata(registry: Registry, extension: Extension, output?: string): Promise<void> {
63
70
  const metadata = JSON.stringify(extension, null, 4);
64
71
  if (!output) {
@@ -83,7 +90,7 @@ async function download(registry: Registry, extension: Extension, output?: strin
83
90
  throw new Error(`Extension ${extension.namespace}.${extension.name} does not provide a download URL.`);
84
91
  }
85
92
  const fileNameIndex = downloadUrl.lastIndexOf('/');
86
- const fileName = downloadUrl.substring(fileNameIndex + 1);
93
+ const fileName = decodeURIComponent(downloadUrl.substring(fileNameIndex + 1));
87
94
  let filePath: string | undefined;
88
95
  if (output) {
89
96
  const stats = await optionalStat(output);
@@ -96,7 +103,8 @@ async function download(registry: Registry, extension: Extension, output?: strin
96
103
  filePath = path.resolve(process.cwd(), fileName);
97
104
  }
98
105
  await makeDirs(path.dirname(filePath));
99
- console.log(`Downloading ${extension.namespace}.${extension.name} v${extension.version} to ${filePath}`);
106
+ const target = extension.targetPlatform !== 'universal' ? '@' + extension.targetPlatform : '';
107
+ console.log(`Downloading ${extension.namespace}.${extension.name}-${extension.version}${target} to ${filePath}`);
100
108
  await registry.download(filePath, new URL(downloadUrl));
101
109
  }
102
110
 
@@ -105,6 +113,10 @@ export interface GetOptions extends RegistryOptions {
105
113
  * Identifier in the form `namespace.extension` or `namespace/extension`.
106
114
  */
107
115
  extensionId: string;
116
+ /**
117
+ * Target platform.
118
+ */
119
+ target?: string;
108
120
  /**
109
121
  * An exact version or version range.
110
122
  */
package/src/main.ts CHANGED
@@ -35,15 +35,21 @@ module.exports = function (argv: string[]): void {
35
35
 
36
36
  const publishCmd = program.command('publish [extension.vsix]');
37
37
  publishCmd.description('Publish an extension, packaging it first if necessary.')
38
- .option('--packagePath <path>', 'Package and publish the extension at the specified path.')
38
+ .option('-t, --target <targets...>', 'Target architectures')
39
+ .option('-i, --packagePath <paths...>', 'Publish the provided VSIX packages.')
39
40
  .option('--baseContentUrl <url>', 'Prepend all relative links in README.md with this URL.')
40
41
  .option('--baseImagesUrl <url>', 'Prepend all relative image links in README.md with this URL.')
41
42
  .option('--yarn', 'Use yarn instead of npm while packing extension files.')
42
- .action((extensionFile: string, { packagePath, baseContentUrl, baseImagesUrl, yarn }) => {
43
+ .option('--pre-release', 'Mark this package as a pre-release')
44
+ .action((extensionFile: string, { target, packagePath, baseContentUrl, baseImagesUrl, yarn, preRelease }) => {
43
45
  if (extensionFile !== undefined && packagePath !== undefined) {
44
46
  console.error('\u274c Please specify either a package file or a package path, but not both.\n');
45
47
  publishCmd.help();
46
48
  }
49
+ if (extensionFile !== undefined && target !== undefined) {
50
+ console.warn("Ignoring option '--target' for prepackaged extension.");
51
+ target = undefined;
52
+ }
47
53
  if (extensionFile !== undefined && baseContentUrl !== undefined)
48
54
  console.warn("Ignoring option '--baseContentUrl' for prepackaged extension.");
49
55
  if (extensionFile !== undefined && baseImagesUrl !== undefined)
@@ -51,7 +57,7 @@ module.exports = function (argv: string[]): void {
51
57
  if (extensionFile !== undefined && yarn !== undefined)
52
58
  console.warn("Ignoring option '--yarn' for prepackaged extension.");
53
59
  const { registryUrl, pat } = program.opts();
54
- publish({ extensionFile, registryUrl, pat, packagePath, baseContentUrl, baseImagesUrl, yarn })
60
+ publish({ extensionFile, registryUrl, pat, targets: typeof target === 'string' ? [target] : target, packagePath: typeof packagePath === 'string' ? [packagePath] : packagePath, baseContentUrl, baseImagesUrl, yarn, preRelease })
55
61
  .catch(handleError(program.debug,
56
62
  'See the documentation for more information:\n'
57
63
  + 'https://github.com/eclipse/openvsx/wiki/Publishing-Extensions'
@@ -60,12 +66,13 @@ module.exports = function (argv: string[]): void {
60
66
 
61
67
  const getCmd = program.command('get <namespace.extension>');
62
68
  getCmd.description('Download an extension or its metadata.')
69
+ .option('-t, --target <target>', 'Target architecture')
63
70
  .option('-v, --versionRange <version>', 'Specify an exact version or a version range.')
64
71
  .option('-o, --output <path>', 'Save the output in the specified file or directory.')
65
72
  .option('--metadata', 'Print the extension\'s metadata instead of downloading it.')
66
- .action((extensionId: string, { versionRange, output, metadata }) => {
73
+ .action((extensionId: string, { target, versionRange, output, metadata }) => {
67
74
  const { registryUrl } = program.opts();
68
- getExtension({ extensionId, version: versionRange, registryUrl, output, metadata })
75
+ getExtension({ extensionId, target: target, version: versionRange, registryUrl, output, metadata })
69
76
  .catch(handleError(program.debug));
70
77
  });
71
78
 
package/src/ovsx CHANGED
@@ -1,8 +1,10 @@
1
- #!/usr/bin/env node
2
-
3
- if (global.URL === undefined) {
4
- console.error('ovsx requires at least NodeJS version 10. Check your installed version with `node --version`.');
5
- process.exit(1);
6
- }
7
-
8
- require('./main')(process.argv);
1
+ #!/usr/bin/env node
2
+
3
+ const semver = require('semver');
4
+
5
+ if (semver.lt(process.versions.node, '14.0.0')) {
6
+ console.error('ovsx requires at least NodeJS version 14. Check your installed version with `node --version`.');
7
+ process.exit(1);
8
+ }
9
+
10
+ require('./main')(process.argv);