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/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.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
- }
1
+ {
2
+ "name": "ovsx",
3
+ "version": "0.5.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": "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/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);