ovsx 0.5.0 → 0.5.1
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/CHANGELOG.md +63 -63
- package/README.md +48 -48
- package/lib/check-license.d.ts +12 -12
- package/lib/check-license.js +110 -110
- package/lib/create-namespace.d.ts +20 -20
- package/lib/create-namespace.js +43 -43
- package/lib/get.d.ts +36 -36
- package/lib/get.js +122 -122
- package/lib/index.d.ts +15 -15
- package/lib/index.js +23 -23
- package/lib/main.d.ts +10 -10
- package/lib/main.js +93 -93
- package/lib/ovsx +10 -10
- package/lib/publish.d.ts +39 -39
- package/lib/publish.js +94 -94
- package/lib/registry.d.ts +130 -130
- package/lib/registry.js +201 -201
- package/lib/util.d.ts +35 -35
- package/lib/util.js +183 -183
- package/package.json +67 -67
- package/src/ovsx +10 -10
package/lib/get.d.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019 TypeFox and others
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
-
********************************************************************************/
|
|
10
|
-
import { RegistryOptions } from "./registry";
|
|
11
|
-
/**
|
|
12
|
-
* Downloads an extension or its metadata.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getExtension(options: GetOptions): Promise<void>;
|
|
15
|
-
export interface GetOptions extends RegistryOptions {
|
|
16
|
-
/**
|
|
17
|
-
* Identifier in the form `namespace.extension` or `namespace/extension`.
|
|
18
|
-
*/
|
|
19
|
-
extensionId: string;
|
|
20
|
-
/**
|
|
21
|
-
* Target platform.
|
|
22
|
-
*/
|
|
23
|
-
target?: string;
|
|
24
|
-
/**
|
|
25
|
-
* An exact version or version range.
|
|
26
|
-
*/
|
|
27
|
-
version?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Save the output in the specified file or directory.
|
|
30
|
-
*/
|
|
31
|
-
output?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Print the extension's metadata instead of downloading it.
|
|
34
|
-
*/
|
|
35
|
-
metadata?: boolean;
|
|
36
|
-
}
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2019 TypeFox and others
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
import { RegistryOptions } from "./registry";
|
|
11
|
+
/**
|
|
12
|
+
* Downloads an extension or its metadata.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getExtension(options: GetOptions): Promise<void>;
|
|
15
|
+
export interface GetOptions extends RegistryOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Identifier in the form `namespace.extension` or `namespace/extension`.
|
|
18
|
+
*/
|
|
19
|
+
extensionId: string;
|
|
20
|
+
/**
|
|
21
|
+
* Target platform.
|
|
22
|
+
*/
|
|
23
|
+
target?: string;
|
|
24
|
+
/**
|
|
25
|
+
* An exact version or version range.
|
|
26
|
+
*/
|
|
27
|
+
version?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Save the output in the specified file or directory.
|
|
30
|
+
*/
|
|
31
|
+
output?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Print the extension's metadata instead of downloading it.
|
|
34
|
+
*/
|
|
35
|
+
metadata?: boolean;
|
|
36
|
+
}
|
|
37
37
|
//# sourceMappingURL=get.d.ts.map
|
package/lib/get.js
CHANGED
|
@@ -1,123 +1,123 @@
|
|
|
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 semver = require("semver");
|
|
24
|
-
const registry_1 = require("./registry");
|
|
25
|
-
const util_1 = require("./util");
|
|
26
|
-
/**
|
|
27
|
-
* Downloads an extension or its metadata.
|
|
28
|
-
*/
|
|
29
|
-
function getExtension(options) {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
util_1.addEnvOptions(options);
|
|
32
|
-
if (!options.target) {
|
|
33
|
-
options.target = 'universal';
|
|
34
|
-
}
|
|
35
|
-
const registry = new registry_1.Registry(options);
|
|
36
|
-
const match = util_1.matchExtensionId(options.extensionId);
|
|
37
|
-
if (!match) {
|
|
38
|
-
throw new Error('The extension identifier must have the form `namespace.extension`.');
|
|
39
|
-
}
|
|
40
|
-
const extension = yield registry.getMetadata(match[1], match[2], options.target);
|
|
41
|
-
if (extension.error) {
|
|
42
|
-
throw new Error(extension.error);
|
|
43
|
-
}
|
|
44
|
-
const matchingVersion = yield findMatchingVersion(registry, extension, options.version);
|
|
45
|
-
if (matchingVersion.error) {
|
|
46
|
-
throw new Error(matchingVersion.error);
|
|
47
|
-
}
|
|
48
|
-
if (options.metadata) {
|
|
49
|
-
yield printMetadata(registry, matchingVersion, options.output);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
yield download(registry, matchingVersion, options.output);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
exports.getExtension = getExtension;
|
|
57
|
-
function findMatchingVersion(registry, extension, constraint) {
|
|
58
|
-
if (!constraint || semver.satisfies(extension.version, constraint)) {
|
|
59
|
-
return Promise.resolve(extension);
|
|
60
|
-
}
|
|
61
|
-
for (const version of Object.keys(extension.allVersions)) {
|
|
62
|
-
if (!isAlias(extension, version) && semver.satisfies(version, constraint)) {
|
|
63
|
-
try {
|
|
64
|
-
return registry.getJson(new URL(extension.allVersions[version]));
|
|
65
|
-
}
|
|
66
|
-
catch (err) {
|
|
67
|
-
return Promise.reject(err);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return Promise.reject(`Extension ${extension.namespace}.${extension.name} has no published version matching '${constraint}'`);
|
|
72
|
-
}
|
|
73
|
-
function isAlias(extension, version) {
|
|
74
|
-
return extension.versionAlias.includes(version);
|
|
75
|
-
}
|
|
76
|
-
function printMetadata(registry, extension, output) {
|
|
77
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
const metadata = JSON.stringify(extension, null, 4);
|
|
79
|
-
if (!output) {
|
|
80
|
-
console.log(metadata);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
let filePath;
|
|
84
|
-
const stats = yield util_1.optionalStat(output);
|
|
85
|
-
if (stats && stats.isDirectory() || !stats && output.endsWith(path.sep)) {
|
|
86
|
-
const fileName = `${extension.namespace}.${extension.name}-${extension.version}.json`;
|
|
87
|
-
filePath = path.resolve(process.cwd(), output, fileName);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
filePath = path.resolve(process.cwd(), output);
|
|
91
|
-
}
|
|
92
|
-
yield util_1.makeDirs(path.dirname(filePath));
|
|
93
|
-
yield util_1.promisify(fs.writeFile)(filePath, metadata);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
function download(registry, extension, output) {
|
|
97
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
const downloadUrl = extension.files.download;
|
|
99
|
-
if (!downloadUrl) {
|
|
100
|
-
throw new Error(`Extension ${extension.namespace}.${extension.name} does not provide a download URL.`);
|
|
101
|
-
}
|
|
102
|
-
const fileNameIndex = downloadUrl.lastIndexOf('/');
|
|
103
|
-
const fileName = decodeURIComponent(downloadUrl.substring(fileNameIndex + 1));
|
|
104
|
-
let filePath;
|
|
105
|
-
if (output) {
|
|
106
|
-
const stats = yield util_1.optionalStat(output);
|
|
107
|
-
if (stats && stats.isDirectory() || !stats && output.endsWith(path.sep)) {
|
|
108
|
-
filePath = path.resolve(process.cwd(), output, fileName);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
filePath = path.resolve(process.cwd(), output);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
filePath = path.resolve(process.cwd(), fileName);
|
|
116
|
-
}
|
|
117
|
-
yield util_1.makeDirs(path.dirname(filePath));
|
|
118
|
-
const target = extension.targetPlatform !== 'universal' ? '@' + extension.targetPlatform : '';
|
|
119
|
-
console.log(`Downloading ${extension.namespace}.${extension.name}-${extension.version}${target} to ${filePath}`);
|
|
120
|
-
yield registry.download(filePath, new URL(downloadUrl));
|
|
121
|
-
});
|
|
122
|
-
}
|
|
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 semver = require("semver");
|
|
24
|
+
const registry_1 = require("./registry");
|
|
25
|
+
const util_1 = require("./util");
|
|
26
|
+
/**
|
|
27
|
+
* Downloads an extension or its metadata.
|
|
28
|
+
*/
|
|
29
|
+
function getExtension(options) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
util_1.addEnvOptions(options);
|
|
32
|
+
if (!options.target) {
|
|
33
|
+
options.target = 'universal';
|
|
34
|
+
}
|
|
35
|
+
const registry = new registry_1.Registry(options);
|
|
36
|
+
const match = util_1.matchExtensionId(options.extensionId);
|
|
37
|
+
if (!match) {
|
|
38
|
+
throw new Error('The extension identifier must have the form `namespace.extension`.');
|
|
39
|
+
}
|
|
40
|
+
const extension = yield registry.getMetadata(match[1], match[2], options.target);
|
|
41
|
+
if (extension.error) {
|
|
42
|
+
throw new Error(extension.error);
|
|
43
|
+
}
|
|
44
|
+
const matchingVersion = yield findMatchingVersion(registry, extension, options.version);
|
|
45
|
+
if (matchingVersion.error) {
|
|
46
|
+
throw new Error(matchingVersion.error);
|
|
47
|
+
}
|
|
48
|
+
if (options.metadata) {
|
|
49
|
+
yield printMetadata(registry, matchingVersion, options.output);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
yield download(registry, matchingVersion, options.output);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
exports.getExtension = getExtension;
|
|
57
|
+
function findMatchingVersion(registry, extension, constraint) {
|
|
58
|
+
if (!constraint || semver.satisfies(extension.version, constraint)) {
|
|
59
|
+
return Promise.resolve(extension);
|
|
60
|
+
}
|
|
61
|
+
for (const version of Object.keys(extension.allVersions)) {
|
|
62
|
+
if (!isAlias(extension, version) && semver.satisfies(version, constraint)) {
|
|
63
|
+
try {
|
|
64
|
+
return registry.getJson(new URL(extension.allVersions[version]));
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
return Promise.reject(err);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return Promise.reject(`Extension ${extension.namespace}.${extension.name} has no published version matching '${constraint}'`);
|
|
72
|
+
}
|
|
73
|
+
function isAlias(extension, version) {
|
|
74
|
+
return extension.versionAlias.includes(version);
|
|
75
|
+
}
|
|
76
|
+
function printMetadata(registry, extension, output) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const metadata = JSON.stringify(extension, null, 4);
|
|
79
|
+
if (!output) {
|
|
80
|
+
console.log(metadata);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
let filePath;
|
|
84
|
+
const stats = yield util_1.optionalStat(output);
|
|
85
|
+
if (stats && stats.isDirectory() || !stats && output.endsWith(path.sep)) {
|
|
86
|
+
const fileName = `${extension.namespace}.${extension.name}-${extension.version}.json`;
|
|
87
|
+
filePath = path.resolve(process.cwd(), output, fileName);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
filePath = path.resolve(process.cwd(), output);
|
|
91
|
+
}
|
|
92
|
+
yield util_1.makeDirs(path.dirname(filePath));
|
|
93
|
+
yield util_1.promisify(fs.writeFile)(filePath, metadata);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function download(registry, extension, output) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const downloadUrl = extension.files.download;
|
|
99
|
+
if (!downloadUrl) {
|
|
100
|
+
throw new Error(`Extension ${extension.namespace}.${extension.name} does not provide a download URL.`);
|
|
101
|
+
}
|
|
102
|
+
const fileNameIndex = downloadUrl.lastIndexOf('/');
|
|
103
|
+
const fileName = decodeURIComponent(downloadUrl.substring(fileNameIndex + 1));
|
|
104
|
+
let filePath;
|
|
105
|
+
if (output) {
|
|
106
|
+
const stats = yield util_1.optionalStat(output);
|
|
107
|
+
if (stats && stats.isDirectory() || !stats && output.endsWith(path.sep)) {
|
|
108
|
+
filePath = path.resolve(process.cwd(), output, fileName);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
filePath = path.resolve(process.cwd(), output);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
filePath = path.resolve(process.cwd(), fileName);
|
|
116
|
+
}
|
|
117
|
+
yield util_1.makeDirs(path.dirname(filePath));
|
|
118
|
+
const target = extension.targetPlatform !== 'universal' ? '@' + extension.targetPlatform : '';
|
|
119
|
+
console.log(`Downloading ${extension.namespace}.${extension.name}-${extension.version}${target} to ${filePath}`);
|
|
120
|
+
yield registry.download(filePath, new URL(downloadUrl));
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
123
|
//# sourceMappingURL=get.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020 TypeFox and others
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
-
********************************************************************************/
|
|
10
|
-
export * from './create-namespace';
|
|
11
|
-
export * from './get';
|
|
12
|
-
export * from './publish';
|
|
13
|
-
export * from './registry';
|
|
14
|
-
export { isLicenseOk } from './check-license';
|
|
15
|
-
export { validateManifest, readManifest } from './util';
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2020 TypeFox and others
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
export * from './create-namespace';
|
|
11
|
+
export * from './get';
|
|
12
|
+
export * from './publish';
|
|
13
|
+
export * from './registry';
|
|
14
|
+
export { isLicenseOk } from './check-license';
|
|
15
|
+
export { validateManifest, readManifest } from './util';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (c) 2020 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
|
-
function __export(m) {
|
|
12
|
-
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
__export(require("./create-namespace"));
|
|
16
|
-
__export(require("./get"));
|
|
17
|
-
__export(require("./publish"));
|
|
18
|
-
__export(require("./registry"));
|
|
19
|
-
var check_license_1 = require("./check-license");
|
|
20
|
-
exports.isLicenseOk = check_license_1.isLicenseOk;
|
|
21
|
-
var util_1 = require("./util");
|
|
22
|
-
exports.validateManifest = util_1.validateManifest;
|
|
23
|
-
exports.readManifest = util_1.readManifest;
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2020 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
|
+
function __export(m) {
|
|
12
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
__export(require("./create-namespace"));
|
|
16
|
+
__export(require("./get"));
|
|
17
|
+
__export(require("./publish"));
|
|
18
|
+
__export(require("./registry"));
|
|
19
|
+
var check_license_1 = require("./check-license");
|
|
20
|
+
exports.isLicenseOk = check_license_1.isLicenseOk;
|
|
21
|
+
var util_1 = require("./util");
|
|
22
|
+
exports.validateManifest = util_1.validateManifest;
|
|
23
|
+
exports.readManifest = util_1.readManifest;
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/lib/main.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019 TypeFox and others
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials are made available under the
|
|
5
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
*
|
|
8
|
-
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
-
********************************************************************************/
|
|
10
|
-
export {};
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2019 TypeFox and others
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
export {};
|
|
11
11
|
//# sourceMappingURL=main.d.ts.map
|
package/lib/main.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const commander = require("commander");
|
|
13
|
-
const leven = require("leven");
|
|
14
|
-
const create_namespace_1 = require("./create-namespace");
|
|
15
|
-
const publish_1 = require("./publish");
|
|
16
|
-
const util_1 = require("./util");
|
|
17
|
-
const get_1 = require("./get");
|
|
18
|
-
const pkg = require('../package.json');
|
|
19
|
-
module.exports = function (argv) {
|
|
20
|
-
const program = new commander.Command();
|
|
21
|
-
program.usage('<command> [options]')
|
|
22
|
-
.option('-r, --registryUrl <url>', 'Use the registry API at this base URL.')
|
|
23
|
-
.option('-p, --pat <token>', 'Personal access token.')
|
|
24
|
-
.option('--debug', 'Include debug information on error')
|
|
25
|
-
.version(pkg.version, '-V, --version', 'Print the Eclipse Open VSX CLI version');
|
|
26
|
-
const createNamespaceCmd = program.command('create-namespace <name>');
|
|
27
|
-
createNamespaceCmd.description('Create a new namespace')
|
|
28
|
-
.action((name) => {
|
|
29
|
-
const { registryUrl, pat } = program.opts();
|
|
30
|
-
create_namespace_1.createNamespace({ name, registryUrl, pat })
|
|
31
|
-
.catch(util_1.handleError(program.debug));
|
|
32
|
-
});
|
|
33
|
-
const publishCmd = program.command('publish [extension.vsix]');
|
|
34
|
-
publishCmd.description('Publish an extension, packaging it first if necessary.')
|
|
35
|
-
.option('-t, --target <targets...>', 'Target architectures')
|
|
36
|
-
.option('-i, --packagePath <paths...>', 'Publish the provided VSIX packages.')
|
|
37
|
-
.option('--baseContentUrl <url>', 'Prepend all relative links in README.md with this URL.')
|
|
38
|
-
.option('--baseImagesUrl <url>', 'Prepend all relative image links in README.md with this URL.')
|
|
39
|
-
.option('--yarn', 'Use yarn instead of npm while packing extension files.')
|
|
40
|
-
.option('--pre-release', 'Mark this package as a pre-release')
|
|
41
|
-
.action((extensionFile, { target, packagePath, baseContentUrl, baseImagesUrl, yarn, preRelease }) => {
|
|
42
|
-
if (extensionFile !== undefined && packagePath !== undefined) {
|
|
43
|
-
console.error('\u274c Please specify either a package file or a package path, but not both.\n');
|
|
44
|
-
publishCmd.help();
|
|
45
|
-
}
|
|
46
|
-
if (extensionFile !== undefined && target !== undefined) {
|
|
47
|
-
console.warn("Ignoring option '--target' for prepackaged extension.");
|
|
48
|
-
target = undefined;
|
|
49
|
-
}
|
|
50
|
-
if (extensionFile !== undefined && baseContentUrl !== undefined)
|
|
51
|
-
console.warn("Ignoring option '--baseContentUrl' for prepackaged extension.");
|
|
52
|
-
if (extensionFile !== undefined && baseImagesUrl !== undefined)
|
|
53
|
-
console.warn("Ignoring option '--baseImagesUrl' for prepackaged extension.");
|
|
54
|
-
if (extensionFile !== undefined && yarn !== undefined)
|
|
55
|
-
console.warn("Ignoring option '--yarn' for prepackaged extension.");
|
|
56
|
-
const { registryUrl, pat } = program.opts();
|
|
57
|
-
publish_1.publish({ extensionFile, registryUrl, pat, targets: typeof target === 'string' ? [target] : target, packagePath: typeof packagePath === 'string' ? [packagePath] : packagePath, baseContentUrl, baseImagesUrl, yarn, preRelease })
|
|
58
|
-
.catch(util_1.handleError(program.debug, 'See the documentation for more information:\n'
|
|
59
|
-
+ 'https://github.com/eclipse/openvsx/wiki/Publishing-Extensions'));
|
|
60
|
-
});
|
|
61
|
-
const getCmd = program.command('get <namespace.extension>');
|
|
62
|
-
getCmd.description('Download an extension or its metadata.')
|
|
63
|
-
.option('-t, --target <target>', 'Target architecture')
|
|
64
|
-
.option('-v, --versionRange <version>', 'Specify an exact version or a version range.')
|
|
65
|
-
.option('-o, --output <path>', 'Save the output in the specified file or directory.')
|
|
66
|
-
.option('--metadata', 'Print the extension\'s metadata instead of downloading it.')
|
|
67
|
-
.action((extensionId, { target, versionRange, output, metadata }) => {
|
|
68
|
-
const { registryUrl } = program.opts();
|
|
69
|
-
get_1.getExtension({ extensionId, target: target, version: versionRange, registryUrl, output, metadata })
|
|
70
|
-
.catch(util_1.handleError(program.debug));
|
|
71
|
-
});
|
|
72
|
-
program
|
|
73
|
-
.command('*', '', { noHelp: true })
|
|
74
|
-
.action((cmd) => {
|
|
75
|
-
const availableCommands = program.commands.map((c) => c._name);
|
|
76
|
-
const actualCommand = cmd.args[0];
|
|
77
|
-
if (actualCommand) {
|
|
78
|
-
const suggestion = availableCommands.find(c => leven(c, actualCommand) < c.length * 0.4);
|
|
79
|
-
if (suggestion)
|
|
80
|
-
console.error(`Unknown command '${actualCommand}', did you mean '${suggestion}'?\n`);
|
|
81
|
-
else
|
|
82
|
-
console.error(`Unknown command '${actualCommand}'.\n`);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
console.error('Unknown command.');
|
|
86
|
-
}
|
|
87
|
-
program.help();
|
|
88
|
-
});
|
|
89
|
-
program.parse(argv);
|
|
90
|
-
if (process.argv.length <= 2) {
|
|
91
|
-
program.help();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const commander = require("commander");
|
|
13
|
+
const leven = require("leven");
|
|
14
|
+
const create_namespace_1 = require("./create-namespace");
|
|
15
|
+
const publish_1 = require("./publish");
|
|
16
|
+
const util_1 = require("./util");
|
|
17
|
+
const get_1 = require("./get");
|
|
18
|
+
const pkg = require('../package.json');
|
|
19
|
+
module.exports = function (argv) {
|
|
20
|
+
const program = new commander.Command();
|
|
21
|
+
program.usage('<command> [options]')
|
|
22
|
+
.option('-r, --registryUrl <url>', 'Use the registry API at this base URL.')
|
|
23
|
+
.option('-p, --pat <token>', 'Personal access token.')
|
|
24
|
+
.option('--debug', 'Include debug information on error')
|
|
25
|
+
.version(pkg.version, '-V, --version', 'Print the Eclipse Open VSX CLI version');
|
|
26
|
+
const createNamespaceCmd = program.command('create-namespace <name>');
|
|
27
|
+
createNamespaceCmd.description('Create a new namespace')
|
|
28
|
+
.action((name) => {
|
|
29
|
+
const { registryUrl, pat } = program.opts();
|
|
30
|
+
create_namespace_1.createNamespace({ name, registryUrl, pat })
|
|
31
|
+
.catch(util_1.handleError(program.debug));
|
|
32
|
+
});
|
|
33
|
+
const publishCmd = program.command('publish [extension.vsix]');
|
|
34
|
+
publishCmd.description('Publish an extension, packaging it first if necessary.')
|
|
35
|
+
.option('-t, --target <targets...>', 'Target architectures')
|
|
36
|
+
.option('-i, --packagePath <paths...>', 'Publish the provided VSIX packages.')
|
|
37
|
+
.option('--baseContentUrl <url>', 'Prepend all relative links in README.md with this URL.')
|
|
38
|
+
.option('--baseImagesUrl <url>', 'Prepend all relative image links in README.md with this URL.')
|
|
39
|
+
.option('--yarn', 'Use yarn instead of npm while packing extension files.')
|
|
40
|
+
.option('--pre-release', 'Mark this package as a pre-release')
|
|
41
|
+
.action((extensionFile, { target, packagePath, baseContentUrl, baseImagesUrl, yarn, preRelease }) => {
|
|
42
|
+
if (extensionFile !== undefined && packagePath !== undefined) {
|
|
43
|
+
console.error('\u274c Please specify either a package file or a package path, but not both.\n');
|
|
44
|
+
publishCmd.help();
|
|
45
|
+
}
|
|
46
|
+
if (extensionFile !== undefined && target !== undefined) {
|
|
47
|
+
console.warn("Ignoring option '--target' for prepackaged extension.");
|
|
48
|
+
target = undefined;
|
|
49
|
+
}
|
|
50
|
+
if (extensionFile !== undefined && baseContentUrl !== undefined)
|
|
51
|
+
console.warn("Ignoring option '--baseContentUrl' for prepackaged extension.");
|
|
52
|
+
if (extensionFile !== undefined && baseImagesUrl !== undefined)
|
|
53
|
+
console.warn("Ignoring option '--baseImagesUrl' for prepackaged extension.");
|
|
54
|
+
if (extensionFile !== undefined && yarn !== undefined)
|
|
55
|
+
console.warn("Ignoring option '--yarn' for prepackaged extension.");
|
|
56
|
+
const { registryUrl, pat } = program.opts();
|
|
57
|
+
publish_1.publish({ extensionFile, registryUrl, pat, targets: typeof target === 'string' ? [target] : target, packagePath: typeof packagePath === 'string' ? [packagePath] : packagePath, baseContentUrl, baseImagesUrl, yarn, preRelease })
|
|
58
|
+
.catch(util_1.handleError(program.debug, 'See the documentation for more information:\n'
|
|
59
|
+
+ 'https://github.com/eclipse/openvsx/wiki/Publishing-Extensions'));
|
|
60
|
+
});
|
|
61
|
+
const getCmd = program.command('get <namespace.extension>');
|
|
62
|
+
getCmd.description('Download an extension or its metadata.')
|
|
63
|
+
.option('-t, --target <target>', 'Target architecture')
|
|
64
|
+
.option('-v, --versionRange <version>', 'Specify an exact version or a version range.')
|
|
65
|
+
.option('-o, --output <path>', 'Save the output in the specified file or directory.')
|
|
66
|
+
.option('--metadata', 'Print the extension\'s metadata instead of downloading it.')
|
|
67
|
+
.action((extensionId, { target, versionRange, output, metadata }) => {
|
|
68
|
+
const { registryUrl } = program.opts();
|
|
69
|
+
get_1.getExtension({ extensionId, target: target, version: versionRange, registryUrl, output, metadata })
|
|
70
|
+
.catch(util_1.handleError(program.debug));
|
|
71
|
+
});
|
|
72
|
+
program
|
|
73
|
+
.command('*', '', { noHelp: true })
|
|
74
|
+
.action((cmd) => {
|
|
75
|
+
const availableCommands = program.commands.map((c) => c._name);
|
|
76
|
+
const actualCommand = cmd.args[0];
|
|
77
|
+
if (actualCommand) {
|
|
78
|
+
const suggestion = availableCommands.find(c => leven(c, actualCommand) < c.length * 0.4);
|
|
79
|
+
if (suggestion)
|
|
80
|
+
console.error(`Unknown command '${actualCommand}', did you mean '${suggestion}'?\n`);
|
|
81
|
+
else
|
|
82
|
+
console.error(`Unknown command '${actualCommand}'.\n`);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
console.error('Unknown command.');
|
|
86
|
+
}
|
|
87
|
+
program.help();
|
|
88
|
+
});
|
|
89
|
+
program.parse(argv);
|
|
90
|
+
if (process.argv.length <= 2) {
|
|
91
|
+
program.help();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
94
|
//# sourceMappingURL=main.js.map
|
package/lib/ovsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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);
|
|
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);
|