oclif 4.23.18 → 4.23.20
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/commands/manifest.js +30 -10
- package/oclif.manifest.json +1 -1
- package/package.json +4 -2
package/lib/commands/manifest.js
CHANGED
|
@@ -37,8 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
const core_1 = require("@oclif/core");
|
|
40
|
+
const cross_spawn_1 = require("cross-spawn");
|
|
40
41
|
const fs_extra_1 = require("fs-extra");
|
|
41
|
-
const node_child_process_1 = require("node:child_process");
|
|
42
42
|
const os = __importStar(require("node:os"));
|
|
43
43
|
const node_path_1 = __importDefault(require("node:path"));
|
|
44
44
|
async function fileExists(filePath) {
|
|
@@ -82,7 +82,7 @@ class Manifest extends core_1.Command {
|
|
|
82
82
|
await (0, fs_extra_1.remove)(fullPath);
|
|
83
83
|
await (0, fs_extra_1.mkdir)(fullPath, { recursive: true });
|
|
84
84
|
const tarball = await this.downloadTarball(jitPlugin, version, fullPath);
|
|
85
|
-
await this.executeCommand(
|
|
85
|
+
await this.executeCommand('tar', ['-xzf', `${tarball}`], { cwd: fullPath });
|
|
86
86
|
const manifest = (await (0, fs_extra_1.readJSON)(node_path_1.default.join(fullPath, 'package', 'oclif.manifest.json')));
|
|
87
87
|
for (const command of Object.values(manifest.commands)) {
|
|
88
88
|
command.pluginType = 'jit';
|
|
@@ -127,28 +127,48 @@ class Manifest extends core_1.Command {
|
|
|
127
127
|
return plugin.manifest;
|
|
128
128
|
}
|
|
129
129
|
async downloadTarball(plugin, version, tarballStoragePath) {
|
|
130
|
-
const {
|
|
130
|
+
const { stdout } = await this.executeCommand('npm', [
|
|
131
|
+
'pack',
|
|
132
|
+
`${plugin}@${version}`,
|
|
133
|
+
'--pack-destination',
|
|
134
|
+
`${tarballStoragePath}`,
|
|
135
|
+
'--json',
|
|
136
|
+
]);
|
|
131
137
|
// You can `npm pack` with multiple modules to download multiple at a time. There will be at least 1 if the command
|
|
132
138
|
// succeeded.
|
|
133
|
-
const tarballs = JSON.parse(
|
|
139
|
+
const tarballs = JSON.parse(stdout);
|
|
134
140
|
if (!Array.isArray(tarballs) || tarballs.length !== 1) {
|
|
135
141
|
throw new Error(`Could not download tarballs for ${plugin}. Tarball download was not in the correct format.`);
|
|
136
142
|
}
|
|
137
143
|
const { filename } = tarballs[0];
|
|
138
144
|
return node_path_1.default.join(tarballStoragePath, filename);
|
|
139
145
|
}
|
|
140
|
-
async executeCommand(command, options) {
|
|
141
|
-
return new Promise((resolve) => {
|
|
142
|
-
(0,
|
|
143
|
-
|
|
144
|
-
|
|
146
|
+
async executeCommand(command, args, options) {
|
|
147
|
+
return new Promise((resolve, reject) => {
|
|
148
|
+
const child = options ? (0, cross_spawn_1.spawn)(command, args, options) : (0, cross_spawn_1.spawn)(command, args);
|
|
149
|
+
let stdout = '';
|
|
150
|
+
let stderr = '';
|
|
151
|
+
child.stdout.on('data', (data) => {
|
|
152
|
+
stdout += data.toString();
|
|
153
|
+
});
|
|
154
|
+
child.stderr.on('data', (data) => {
|
|
155
|
+
stderr += data.toString();
|
|
156
|
+
});
|
|
157
|
+
child.on('error', (error) => {
|
|
158
|
+
reject(error);
|
|
159
|
+
});
|
|
160
|
+
child.on('close', (code) => {
|
|
161
|
+
if (code !== 0) {
|
|
162
|
+
reject(new Error(stderr || `Command "${command}" failed with exit code ${code}`));
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
145
165
|
const debugString = options?.cwd
|
|
146
166
|
? `executing command: ${command} in ${options.cwd}`
|
|
147
167
|
: `executing command: ${command}`;
|
|
148
168
|
this.debug(debugString);
|
|
149
169
|
this.debug(stdout);
|
|
150
170
|
this.debug(stderr);
|
|
151
|
-
resolve({ stderr
|
|
171
|
+
resolve({ stderr, stdout });
|
|
152
172
|
});
|
|
153
173
|
});
|
|
154
174
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oclif",
|
|
3
3
|
"description": "oclif: create your own CLI",
|
|
4
|
-
"version": "4.23.
|
|
4
|
+
"version": "4.23.20",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bin": {
|
|
7
7
|
"oclif": "bin/run.js"
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"ansis": "^3.16.0",
|
|
21
21
|
"async-retry": "^1.3.3",
|
|
22
22
|
"change-case": "^4",
|
|
23
|
+
"cross-spawn": "^7.0.6",
|
|
23
24
|
"debug": "^4.4.0",
|
|
24
25
|
"ejs": "^3.1.10",
|
|
25
26
|
"find-yarn-workspace-root": "^2.0.0",
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"github-slugger": "^2",
|
|
28
29
|
"got": "^13",
|
|
29
30
|
"normalize-package-data": "^6",
|
|
30
|
-
"semver": "^7.8.
|
|
31
|
+
"semver": "^7.8.5",
|
|
31
32
|
"tiny-jsonc": "^1.0.2",
|
|
32
33
|
"validate-npm-package-name": "^5.0.1"
|
|
33
34
|
},
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"@types/async-retry": "^1.4.5",
|
|
41
42
|
"@types/chai": "^4.3.17",
|
|
42
43
|
"@types/cli-progress": "^3.11.6",
|
|
44
|
+
"@types/cross-spawn": "^6.0.6",
|
|
43
45
|
"@types/debug": "^4.1.13",
|
|
44
46
|
"@types/ejs": "^3.1.5",
|
|
45
47
|
"@types/fs-extra": "^9.0",
|