oclif 3.5.0 → 3.6.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.
@@ -1 +1,483 @@
1
- {"version":"3.5.0","commands":{"generate":{"id":"generate","description":"generate a new CLI\nThis will clone the template repo 'oclif/hello-world' and update package properties","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{},"args":{"name":{"name":"name","description":"directory name of new project","required":true}}},"manifest":{"id":"manifest","description":"generates plugin manifest json","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{},"args":{"path":{"name":"path","description":"path to plugin","default":"."}}},"promote":{"id":"promote","description":"promote CLI builds to a S3 release channel","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to the oclif CLI project root","required":true,"multiple":false,"default":"."},"version":{"name":"version","type":"option","description":"semantic version of the CLI to promote","required":true,"multiple":false},"sha":{"name":"sha","type":"option","description":"7-digit short git commit SHA of the CLI to promote","required":true,"multiple":false},"channel":{"name":"channel","type":"option","description":"which channel to promote to","required":true,"multiple":false,"default":"stable"},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to promote (e.g.: linux-arm,win32-x64)","multiple":false},"deb":{"name":"deb","type":"boolean","char":"d","description":"promote debian artifacts","allowNo":false},"macos":{"name":"macos","type":"boolean","char":"m","description":"promote macOS pkg","allowNo":false},"win":{"name":"win","type":"boolean","char":"w","description":"promote Windows exe","allowNo":false},"max-age":{"name":"max-age","type":"option","char":"a","description":"cache control max-age in seconds","multiple":false,"default":"86400"},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true},"indexes":{"name":"indexes","type":"boolean","description":"append the promoted urls into the index files","allowNo":false}},"args":{}},"readme":{"id":"readme","description":"adds commands to README.md in current directory\nThe readme must have any of the following tags inside of it for it to be replaced or else it will do nothing:\n# Usage\n<!-- usage -->\n# Commands\n<!-- commands -->\n# Table of contents\n<!-- toc -->\n\nCustomize the code URL prefix by setting oclif.repositoryPrefix in package.json.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"dir":{"name":"dir","type":"option","description":"output directory for multi docs","required":true,"multiple":false,"default":"docs"},"multi":{"name":"multi","type":"boolean","description":"create a different markdown page for each topic","allowNo":false},"aliases":{"name":"aliases","type":"boolean","description":"include aliases in the command list","allowNo":true}},"args":{}},"generate:command":{"id":"generate:command","description":"add a command to an existing CLI or plugin","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false}},"args":{"name":{"name":"name","description":"name of command","required":true}}},"generate:hook":{"id":"generate:hook","description":"add a hook to an existing CLI or plugin","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false},"event":{"name":"event","type":"option","description":"event to run hook on","multiple":false,"default":"init"}},"args":{"name":{"name":"name","description":"name of hook (snake_case)","required":true}}},"pack:deb":{"id":"pack:deb","description":"pack CLI into debian package","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"tarball":{"name":"tarball","type":"option","char":"t","description":"optionally specify a path to a tarball already generated by NPM","required":false,"multiple":false}},"args":{}},"pack:macos":{"id":"pack:macos","description":"pack CLI into macOS .pkg","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"additional-cli":{"name":"additional-cli","type":"option","description":"an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"","hidden":true,"multiple":false},"tarball":{"name":"tarball","type":"option","char":"t","description":"optionally specify a path to a tarball already generated by NPM","required":false,"multiple":false},"targets":{"name":"targets","type":"option","description":"comma-separated targets to pack (e.g.: darwin-x64,darwin-arm64)","multiple":false}},"args":{}},"pack:tarballs":{"id":"pack:tarballs","description":"packages oclif CLI into tarballs\n\nThis can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to pack (e.g.: linux-arm,win32-x64)","multiple":false},"xz":{"name":"xz","type":"boolean","description":"also build xz","allowNo":true},"parallel":{"name":"parallel","type":"boolean","description":"build tarballs in parallel","allowNo":false},"tarball":{"name":"tarball","type":"option","char":"l","description":"optionally specify a path to a tarball already generated by NPM","required":false,"multiple":false}},"args":{}},"pack:win":{"id":"pack:win","description":"create windows installer from oclif CLI\n\n This command requires WINDOWS_SIGNING (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) to be set in the environment","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"additional-cli":{"name":"additional-cli","type":"option","description":"an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"","hidden":true,"multiple":false},"tarball":{"name":"tarball","type":"option","char":"t","description":"optionally specify a path to a tarball already generated by NPM","required":false,"multiple":false}},"args":{}},"upload:deb":{"id":"upload:deb","description":"upload deb package built with pack:deb","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":{}},"upload:macos":{"id":"upload:macos","description":"upload macos installers built with pack:macos","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to upload (e.g.: darwin-x64,darwin-arm64)","multiple":false}},"args":{}},"upload:tarballs":{"id":"upload:tarballs","description":"upload an oclif CLI to S3\n\n\"aws-sdk\" will need to be installed as a devDependency to upload.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to upload (e.g.: linux-arm,win32-x64)","multiple":false},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true}},"args":{}},"upload:win":{"id":"upload:win","description":"upload windows installers built with pack:win","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":{}}}}
1
+ {
2
+ "version": "3.6.0",
3
+ "commands": {
4
+ "generate": {
5
+ "id": "generate",
6
+ "description": "generate a new CLI\nThis will clone the template repo 'oclif/hello-world' and update package properties",
7
+ "strict": true,
8
+ "pluginName": "oclif",
9
+ "pluginAlias": "oclif",
10
+ "pluginType": "core",
11
+ "aliases": [],
12
+ "flags": {},
13
+ "args": {
14
+ "name": {
15
+ "name": "name",
16
+ "description": "directory name of new project",
17
+ "required": true
18
+ }
19
+ }
20
+ },
21
+ "manifest": {
22
+ "id": "manifest",
23
+ "description": "generates plugin manifest json",
24
+ "strict": true,
25
+ "pluginName": "oclif",
26
+ "pluginAlias": "oclif",
27
+ "pluginType": "core",
28
+ "aliases": [],
29
+ "flags": {
30
+ "jit": {
31
+ "name": "jit",
32
+ "type": "boolean",
33
+ "summary": "append commands from JIT plugins in manifest",
34
+ "allowNo": true
35
+ }
36
+ },
37
+ "args": {
38
+ "path": {
39
+ "name": "path",
40
+ "description": "path to plugin",
41
+ "default": "."
42
+ }
43
+ }
44
+ },
45
+ "promote": {
46
+ "id": "promote",
47
+ "description": "promote CLI builds to a S3 release channel",
48
+ "strict": true,
49
+ "pluginName": "oclif",
50
+ "pluginAlias": "oclif",
51
+ "pluginType": "core",
52
+ "aliases": [],
53
+ "flags": {
54
+ "root": {
55
+ "name": "root",
56
+ "type": "option",
57
+ "char": "r",
58
+ "description": "path to the oclif CLI project root",
59
+ "required": true,
60
+ "multiple": false,
61
+ "default": "."
62
+ },
63
+ "version": {
64
+ "name": "version",
65
+ "type": "option",
66
+ "description": "semantic version of the CLI to promote",
67
+ "required": true,
68
+ "multiple": false
69
+ },
70
+ "sha": {
71
+ "name": "sha",
72
+ "type": "option",
73
+ "description": "7-digit short git commit SHA of the CLI to promote",
74
+ "required": true,
75
+ "multiple": false
76
+ },
77
+ "channel": {
78
+ "name": "channel",
79
+ "type": "option",
80
+ "description": "which channel to promote to",
81
+ "required": true,
82
+ "multiple": false,
83
+ "default": "stable"
84
+ },
85
+ "targets": {
86
+ "name": "targets",
87
+ "type": "option",
88
+ "char": "t",
89
+ "description": "comma-separated targets to promote (e.g.: linux-arm,win32-x64)",
90
+ "multiple": false
91
+ },
92
+ "deb": {
93
+ "name": "deb",
94
+ "type": "boolean",
95
+ "char": "d",
96
+ "description": "promote debian artifacts",
97
+ "allowNo": false
98
+ },
99
+ "macos": {
100
+ "name": "macos",
101
+ "type": "boolean",
102
+ "char": "m",
103
+ "description": "promote macOS pkg",
104
+ "allowNo": false
105
+ },
106
+ "win": {
107
+ "name": "win",
108
+ "type": "boolean",
109
+ "char": "w",
110
+ "description": "promote Windows exe",
111
+ "allowNo": false
112
+ },
113
+ "max-age": {
114
+ "name": "max-age",
115
+ "type": "option",
116
+ "char": "a",
117
+ "description": "cache control max-age in seconds",
118
+ "multiple": false,
119
+ "default": "86400"
120
+ },
121
+ "xz": {
122
+ "name": "xz",
123
+ "type": "boolean",
124
+ "description": "also upload xz",
125
+ "allowNo": true
126
+ },
127
+ "indexes": {
128
+ "name": "indexes",
129
+ "type": "boolean",
130
+ "description": "append the promoted urls into the index files",
131
+ "allowNo": false
132
+ }
133
+ },
134
+ "args": {}
135
+ },
136
+ "readme": {
137
+ "id": "readme",
138
+ "description": "adds commands to README.md in current directory\nThe readme must have any of the following tags inside of it for it to be replaced or else it will do nothing:\n# Usage\n<!-- usage -->\n# Commands\n<!-- commands -->\n# Table of contents\n<!-- toc -->\n\nCustomize the code URL prefix by setting oclif.repositoryPrefix in package.json.\n",
139
+ "strict": true,
140
+ "pluginName": "oclif",
141
+ "pluginAlias": "oclif",
142
+ "pluginType": "core",
143
+ "aliases": [],
144
+ "flags": {
145
+ "dir": {
146
+ "name": "dir",
147
+ "type": "option",
148
+ "description": "output directory for multi docs",
149
+ "required": true,
150
+ "multiple": false,
151
+ "default": "docs"
152
+ },
153
+ "multi": {
154
+ "name": "multi",
155
+ "type": "boolean",
156
+ "description": "create a different markdown page for each topic",
157
+ "allowNo": false
158
+ },
159
+ "aliases": {
160
+ "name": "aliases",
161
+ "type": "boolean",
162
+ "description": "include aliases in the command list",
163
+ "allowNo": true
164
+ }
165
+ },
166
+ "args": {}
167
+ },
168
+ "generate:command": {
169
+ "id": "generate:command",
170
+ "description": "add a command to an existing CLI or plugin",
171
+ "strict": true,
172
+ "pluginName": "oclif",
173
+ "pluginAlias": "oclif",
174
+ "pluginType": "core",
175
+ "aliases": [],
176
+ "flags": {
177
+ "force": {
178
+ "name": "force",
179
+ "type": "boolean",
180
+ "description": "overwrite existing files",
181
+ "allowNo": false
182
+ }
183
+ },
184
+ "args": {
185
+ "name": {
186
+ "name": "name",
187
+ "description": "name of command",
188
+ "required": true
189
+ }
190
+ }
191
+ },
192
+ "generate:hook": {
193
+ "id": "generate:hook",
194
+ "description": "add a hook to an existing CLI or plugin",
195
+ "strict": true,
196
+ "pluginName": "oclif",
197
+ "pluginAlias": "oclif",
198
+ "pluginType": "core",
199
+ "aliases": [],
200
+ "flags": {
201
+ "force": {
202
+ "name": "force",
203
+ "type": "boolean",
204
+ "description": "overwrite existing files",
205
+ "allowNo": false
206
+ },
207
+ "event": {
208
+ "name": "event",
209
+ "type": "option",
210
+ "description": "event to run hook on",
211
+ "multiple": false,
212
+ "default": "init"
213
+ }
214
+ },
215
+ "args": {
216
+ "name": {
217
+ "name": "name",
218
+ "description": "name of hook (snake_case)",
219
+ "required": true
220
+ }
221
+ }
222
+ },
223
+ "pack:deb": {
224
+ "id": "pack:deb",
225
+ "description": "pack CLI into debian package",
226
+ "strict": true,
227
+ "pluginName": "oclif",
228
+ "pluginAlias": "oclif",
229
+ "pluginType": "core",
230
+ "aliases": [],
231
+ "flags": {
232
+ "root": {
233
+ "name": "root",
234
+ "type": "option",
235
+ "char": "r",
236
+ "description": "path to oclif CLI root",
237
+ "required": true,
238
+ "multiple": false,
239
+ "default": "."
240
+ },
241
+ "tarball": {
242
+ "name": "tarball",
243
+ "type": "option",
244
+ "char": "t",
245
+ "description": "optionally specify a path to a tarball already generated by NPM",
246
+ "required": false,
247
+ "multiple": false
248
+ }
249
+ },
250
+ "args": {}
251
+ },
252
+ "pack:macos": {
253
+ "id": "pack:macos",
254
+ "description": "pack CLI into macOS .pkg",
255
+ "strict": true,
256
+ "pluginName": "oclif",
257
+ "pluginAlias": "oclif",
258
+ "pluginType": "core",
259
+ "aliases": [],
260
+ "flags": {
261
+ "root": {
262
+ "name": "root",
263
+ "type": "option",
264
+ "char": "r",
265
+ "description": "path to oclif CLI root",
266
+ "required": true,
267
+ "multiple": false,
268
+ "default": "."
269
+ },
270
+ "additional-cli": {
271
+ "name": "additional-cli",
272
+ "type": "option",
273
+ "description": "an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"",
274
+ "hidden": true,
275
+ "multiple": false
276
+ },
277
+ "tarball": {
278
+ "name": "tarball",
279
+ "type": "option",
280
+ "char": "t",
281
+ "description": "optionally specify a path to a tarball already generated by NPM",
282
+ "required": false,
283
+ "multiple": false
284
+ },
285
+ "targets": {
286
+ "name": "targets",
287
+ "type": "option",
288
+ "description": "comma-separated targets to pack (e.g.: darwin-x64,darwin-arm64)",
289
+ "multiple": false
290
+ }
291
+ },
292
+ "args": {}
293
+ },
294
+ "pack:tarballs": {
295
+ "id": "pack:tarballs",
296
+ "description": "packages oclif CLI into tarballs\n\nThis can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.\n",
297
+ "strict": true,
298
+ "pluginName": "oclif",
299
+ "pluginAlias": "oclif",
300
+ "pluginType": "core",
301
+ "aliases": [],
302
+ "flags": {
303
+ "root": {
304
+ "name": "root",
305
+ "type": "option",
306
+ "char": "r",
307
+ "description": "path to oclif CLI root",
308
+ "required": true,
309
+ "multiple": false,
310
+ "default": "."
311
+ },
312
+ "targets": {
313
+ "name": "targets",
314
+ "type": "option",
315
+ "char": "t",
316
+ "description": "comma-separated targets to pack (e.g.: linux-arm,win32-x64)",
317
+ "multiple": false
318
+ },
319
+ "xz": {
320
+ "name": "xz",
321
+ "type": "boolean",
322
+ "description": "also build xz",
323
+ "allowNo": true
324
+ },
325
+ "parallel": {
326
+ "name": "parallel",
327
+ "type": "boolean",
328
+ "description": "build tarballs in parallel",
329
+ "allowNo": false
330
+ },
331
+ "tarball": {
332
+ "name": "tarball",
333
+ "type": "option",
334
+ "char": "l",
335
+ "description": "optionally specify a path to a tarball already generated by NPM",
336
+ "required": false,
337
+ "multiple": false
338
+ }
339
+ },
340
+ "args": {}
341
+ },
342
+ "pack:win": {
343
+ "id": "pack:win",
344
+ "description": "create windows installer from oclif CLI\n\n This command requires WINDOWS_SIGNING (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) to be set in the environment",
345
+ "strict": true,
346
+ "pluginName": "oclif",
347
+ "pluginAlias": "oclif",
348
+ "pluginType": "core",
349
+ "aliases": [],
350
+ "flags": {
351
+ "root": {
352
+ "name": "root",
353
+ "type": "option",
354
+ "char": "r",
355
+ "description": "path to oclif CLI root",
356
+ "required": true,
357
+ "multiple": false,
358
+ "default": "."
359
+ },
360
+ "additional-cli": {
361
+ "name": "additional-cli",
362
+ "type": "option",
363
+ "description": "an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"",
364
+ "hidden": true,
365
+ "multiple": false
366
+ },
367
+ "tarball": {
368
+ "name": "tarball",
369
+ "type": "option",
370
+ "char": "t",
371
+ "description": "optionally specify a path to a tarball already generated by NPM",
372
+ "required": false,
373
+ "multiple": false
374
+ }
375
+ },
376
+ "args": {}
377
+ },
378
+ "upload:deb": {
379
+ "id": "upload:deb",
380
+ "description": "upload deb package built with pack:deb",
381
+ "strict": true,
382
+ "pluginName": "oclif",
383
+ "pluginAlias": "oclif",
384
+ "pluginType": "core",
385
+ "aliases": [],
386
+ "flags": {
387
+ "root": {
388
+ "name": "root",
389
+ "type": "option",
390
+ "char": "r",
391
+ "description": "path to oclif CLI root",
392
+ "required": true,
393
+ "multiple": false,
394
+ "default": "."
395
+ }
396
+ },
397
+ "args": {}
398
+ },
399
+ "upload:macos": {
400
+ "id": "upload:macos",
401
+ "description": "upload macos installers built with pack:macos",
402
+ "strict": true,
403
+ "pluginName": "oclif",
404
+ "pluginAlias": "oclif",
405
+ "pluginType": "core",
406
+ "aliases": [],
407
+ "flags": {
408
+ "root": {
409
+ "name": "root",
410
+ "type": "option",
411
+ "char": "r",
412
+ "description": "path to oclif CLI root",
413
+ "required": true,
414
+ "multiple": false,
415
+ "default": "."
416
+ },
417
+ "targets": {
418
+ "name": "targets",
419
+ "type": "option",
420
+ "char": "t",
421
+ "description": "comma-separated targets to upload (e.g.: darwin-x64,darwin-arm64)",
422
+ "multiple": false
423
+ }
424
+ },
425
+ "args": {}
426
+ },
427
+ "upload:tarballs": {
428
+ "id": "upload:tarballs",
429
+ "description": "upload an oclif CLI to S3\n\n\"aws-sdk\" will need to be installed as a devDependency to upload.\n",
430
+ "strict": true,
431
+ "pluginName": "oclif",
432
+ "pluginAlias": "oclif",
433
+ "pluginType": "core",
434
+ "aliases": [],
435
+ "flags": {
436
+ "root": {
437
+ "name": "root",
438
+ "type": "option",
439
+ "char": "r",
440
+ "description": "path to oclif CLI root",
441
+ "required": true,
442
+ "multiple": false,
443
+ "default": "."
444
+ },
445
+ "targets": {
446
+ "name": "targets",
447
+ "type": "option",
448
+ "char": "t",
449
+ "description": "comma-separated targets to upload (e.g.: linux-arm,win32-x64)",
450
+ "multiple": false
451
+ },
452
+ "xz": {
453
+ "name": "xz",
454
+ "type": "boolean",
455
+ "description": "also upload xz",
456
+ "allowNo": true
457
+ }
458
+ },
459
+ "args": {}
460
+ },
461
+ "upload:win": {
462
+ "id": "upload:win",
463
+ "description": "upload windows installers built with pack:win",
464
+ "strict": true,
465
+ "pluginName": "oclif",
466
+ "pluginAlias": "oclif",
467
+ "pluginType": "core",
468
+ "aliases": [],
469
+ "flags": {
470
+ "root": {
471
+ "name": "root",
472
+ "type": "option",
473
+ "char": "r",
474
+ "description": "path to oclif CLI root",
475
+ "required": true,
476
+ "multiple": false,
477
+ "default": "."
478
+ }
479
+ },
480
+ "args": {}
481
+ }
482
+ }
483
+ }
@@ -1,8 +1,13 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command, Interfaces } from '@oclif/core';
2
2
  export default class Manifest extends Command {
3
3
  static description: string;
4
4
  static args: {
5
5
  path: import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
6
6
  };
7
+ static flags: {
8
+ jit: Interfaces.BooleanFlag<boolean>;
9
+ };
7
10
  run(): Promise<void>;
11
+ private cloneRepo;
12
+ private executeCommand;
8
13
  }
@@ -3,14 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
4
  const fs = require("fs-extra");
5
5
  const path = require("path");
6
+ const os = require("os");
7
+ const semver = require("semver");
8
+ const shelljs_1 = require("shelljs");
9
+ async function fileExists(filePath) {
10
+ try {
11
+ await fs.access(filePath);
12
+ return true;
13
+ }
14
+ catch (_a) {
15
+ return false;
16
+ }
17
+ }
6
18
  class Manifest extends core_1.Command {
7
19
  async run() {
20
+ const { flags } = await this.parse(Manifest);
8
21
  try {
9
22
  fs.unlinkSync('oclif.manifest.json');
10
23
  }
11
24
  catch (_a) { }
12
25
  const { args } = await this.parse(Manifest);
13
26
  const root = path.resolve(args.path);
27
+ const packageJson = fs.readJSONSync('package.json');
28
+ let jitPluginManifests = [];
29
+ if (flags.jit && packageJson.oclif.jitPlugins) {
30
+ this.debug('jitPlugins: %s', packageJson.oclif.jitPlugins);
31
+ const tmpDir = os.tmpdir();
32
+ const promises = Object.entries(packageJson.oclif.jitPlugins).map(async ([jitPlugin, version]) => {
33
+ const pluginDir = jitPlugin.replace('/', '-').replace('@', '');
34
+ const repo = this.executeCommand(`npm view ${jitPlugin} repository --json`);
35
+ const stdout = JSON.parse(repo.stdout);
36
+ const repoUrl = stdout.url.replace(`${stdout.type}+`, '');
37
+ const fullPath = path.join(tmpDir, pluginDir);
38
+ if (await fileExists(fullPath))
39
+ await fs.remove(fullPath);
40
+ const versions = JSON.parse(this.executeCommand(`npm view ${jitPlugin} versions --json`).stdout);
41
+ const maxSatisfying = semver.maxSatisfying(versions, version);
42
+ this.cloneRepo(repoUrl, fullPath, maxSatisfying);
43
+ this.executeCommand('yarn', { cwd: fullPath });
44
+ this.executeCommand('yarn build', { cwd: fullPath });
45
+ const plugin = new core_1.Plugin({ root: fullPath, type: 'jit', ignoreManifest: true, errorOnManifestCreate: true });
46
+ await plugin.load();
47
+ return plugin.manifest;
48
+ });
49
+ core_1.ux.action.start('Generating JIT plugin manifests');
50
+ jitPluginManifests = await Promise.all(promises);
51
+ core_1.ux.action.stop();
52
+ }
14
53
  let plugin = new core_1.Plugin({ root, type: 'core', ignoreManifest: true, errorOnManifestCreate: true });
15
54
  if (!plugin)
16
55
  throw new Error('plugin not found');
@@ -26,12 +65,45 @@ class Manifest extends core_1.Command {
26
65
  }
27
66
  const dotfile = plugin.pjson.files.find((f) => f.endsWith('.oclif.manifest.json'));
28
67
  const file = path.join(plugin.root, `${dotfile ? '.' : ''}oclif.manifest.json`);
29
- fs.writeFileSync(file, JSON.stringify(plugin.manifest));
68
+ for (const manifest of jitPluginManifests) {
69
+ plugin.manifest.commands = Object.assign(Object.assign({}, plugin.manifest.commands), manifest.commands);
70
+ }
71
+ fs.writeFileSync(file, JSON.stringify(plugin.manifest, null, 2));
30
72
  this.log(`wrote manifest to ${file}`);
31
73
  }
74
+ cloneRepo(repoUrl, fullPath, tag) {
75
+ try {
76
+ this.executeCommand(`git clone --branch ${tag} ${repoUrl} ${fullPath} --depth 1`);
77
+ }
78
+ catch (_a) {
79
+ try {
80
+ this.executeCommand(`git clone --branch v${tag} ${repoUrl} ${fullPath} --depth 1`);
81
+ }
82
+ catch (_b) {
83
+ throw new Error(`Unable to clone repo ${repoUrl} with tag ${tag}`);
84
+ }
85
+ }
86
+ }
87
+ executeCommand(command, options) {
88
+ const debugString = (options === null || options === void 0 ? void 0 : options.cwd) ? `executing command: ${command} in ${options.cwd}` : `executing command: ${command}`;
89
+ this.debug(debugString);
90
+ const result = (0, shelljs_1.exec)(command, Object.assign(Object.assign({}, options), { silent: true, async: false }));
91
+ if (result.code !== 0) {
92
+ this.error(result.stderr);
93
+ }
94
+ this.debug(result.stdout);
95
+ return result;
96
+ }
32
97
  }
33
98
  exports.default = Manifest;
34
99
  Manifest.description = 'generates plugin manifest json';
35
100
  Manifest.args = {
36
101
  path: core_1.Args.string({ description: 'path to plugin', default: '.' }),
37
102
  };
103
+ Manifest.flags = {
104
+ jit: core_1.Flags.boolean({
105
+ allowNo: true,
106
+ summary: 'append commands from JIT plugins in manifest',
107
+ default: true,
108
+ }),
109
+ };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "oclif",
3
3
  "description": "oclif: create your own CLI",
4
- "version": "3.5.0",
4
+ "version": "3.6.0",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run"
8
8
  },
9
9
  "bugs": "https://github.com/oclif/oclif/issues",
10
10
  "dependencies": {
11
- "@oclif/core": "^2.0.2-beta.6",
11
+ "@oclif/core": "^2.0.2-beta.10",
12
12
  "@oclif/plugin-help": "^5.1.19",
13
13
  "@oclif/plugin-not-found": "^2.3.7",
14
14
  "@oclif/plugin-warn-if-update-available": "^2.0.14",
@@ -22,6 +22,7 @@
22
22
  "lodash": "^4.17.21",
23
23
  "normalize-package-data": "^3.0.3",
24
24
  "semver": "^7.3.8",
25
+ "shelljs": "^0.8.5",
25
26
  "tslib": "^2.3.1",
26
27
  "yeoman-environment": "^3.11.1",
27
28
  "yeoman-generator": "^5.6.1",
@@ -56,7 +57,6 @@
56
57
  "mocha": "^9.2.2",
57
58
  "npm-run-path": "^4.0.1",
58
59
  "nps": "^5.10.0",
59
- "shelljs": "^0.8.5",
60
60
  "shx": "^0.3.4",
61
61
  "tmp": "^0.2.1",
62
62
  "ts-node": "^10.7.0",