@oclif/core 3.0.0-beta.9 → 3.0.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.
Files changed (142) hide show
  1. package/README.md +4 -2
  2. package/flush.d.ts +3 -0
  3. package/flush.js +1 -0
  4. package/handle.js +1 -0
  5. package/lib/args.d.ts +2 -2
  6. package/lib/args.js +17 -18
  7. package/lib/{ux → cli-ux}/action/base.d.ts +19 -21
  8. package/lib/{ux → cli-ux}/action/base.js +126 -120
  9. package/lib/{ux → cli-ux}/action/simple.js +25 -30
  10. package/lib/{ux → cli-ux}/action/spinner.d.ts +9 -7
  11. package/lib/{ux → cli-ux}/action/spinner.js +45 -37
  12. package/lib/{ux → cli-ux}/action/spinners.js +187 -187
  13. package/lib/cli-ux/action/types.d.ts +5 -0
  14. package/lib/cli-ux/action/types.js +2 -0
  15. package/lib/{ux → cli-ux}/config.d.ts +5 -5
  16. package/lib/{ux → cli-ux}/config.js +17 -17
  17. package/lib/{ux → cli-ux}/exit.js +3 -0
  18. package/lib/cli-ux/flush.d.ts +1 -0
  19. package/lib/cli-ux/flush.js +28 -0
  20. package/lib/cli-ux/index.d.ts +39 -0
  21. package/lib/{ux → cli-ux}/index.js +74 -88
  22. package/lib/{ux → cli-ux}/list.js +3 -3
  23. package/lib/{ux → cli-ux}/prompt.d.ts +3 -3
  24. package/lib/{ux → cli-ux}/prompt.js +35 -25
  25. package/lib/{ux → cli-ux}/stream.d.ts +6 -6
  26. package/lib/{ux → cli-ux}/stream.js +11 -10
  27. package/lib/cli-ux/styled/index.d.ts +4 -0
  28. package/lib/cli-ux/styled/index.js +11 -0
  29. package/lib/{ux → cli-ux}/styled/object.js +7 -9
  30. package/lib/{ux → cli-ux}/styled/table.d.ts +10 -10
  31. package/lib/{ux → cli-ux}/styled/table.js +130 -133
  32. package/lib/{ux → cli-ux}/styled/tree.js +11 -13
  33. package/lib/cli-ux/wait.js +5 -0
  34. package/lib/command.d.ts +82 -88
  35. package/lib/command.js +196 -175
  36. package/lib/config/config.d.ts +89 -90
  37. package/lib/config/config.js +466 -566
  38. package/lib/config/index.d.ts +0 -1
  39. package/lib/config/index.js +1 -3
  40. package/lib/config/plugin-loader.d.ts +12 -12
  41. package/lib/config/plugin-loader.js +72 -56
  42. package/lib/config/plugin.d.ts +25 -24
  43. package/lib/config/plugin.js +188 -154
  44. package/lib/config/ts-node.d.ts +2 -1
  45. package/lib/config/ts-node.js +71 -58
  46. package/lib/config/util.d.ts +1 -11
  47. package/lib/config/util.js +6 -59
  48. package/lib/errors/config.d.ts +1 -1
  49. package/lib/errors/config.js +6 -6
  50. package/lib/errors/errors/cli.d.ts +7 -7
  51. package/lib/errors/errors/cli.js +20 -16
  52. package/lib/errors/errors/exit.d.ts +1 -4
  53. package/lib/errors/errors/exit.js +1 -1
  54. package/lib/errors/errors/module-load.d.ts +1 -4
  55. package/lib/errors/errors/module-load.js +1 -1
  56. package/lib/errors/errors/pretty-print.d.ts +1 -1
  57. package/lib/errors/errors/pretty-print.js +12 -10
  58. package/lib/errors/handle.d.ts +12 -2
  59. package/lib/errors/handle.js +26 -14
  60. package/lib/errors/index.d.ts +10 -10
  61. package/lib/errors/index.js +25 -24
  62. package/lib/errors/logger.d.ts +2 -2
  63. package/lib/errors/logger.js +14 -13
  64. package/lib/execute.d.ts +6 -6
  65. package/lib/execute.js +10 -9
  66. package/lib/flags.d.ts +103 -32
  67. package/lib/flags.js +79 -45
  68. package/lib/help/command.d.ts +16 -14
  69. package/lib/help/command.js +178 -163
  70. package/lib/help/docopts.d.ts +5 -5
  71. package/lib/help/docopts.js +50 -54
  72. package/lib/help/formatter.d.ts +37 -37
  73. package/lib/help/formatter.js +66 -55
  74. package/lib/help/index.d.ts +25 -21
  75. package/lib/help/index.js +169 -147
  76. package/lib/help/root.d.ts +1 -1
  77. package/lib/help/root.js +15 -17
  78. package/lib/help/util.d.ts +2 -8
  79. package/lib/help/util.js +8 -28
  80. package/lib/index.d.ts +19 -20
  81. package/lib/index.js +37 -43
  82. package/lib/interfaces/config.d.ts +67 -66
  83. package/lib/interfaces/errors.d.ts +5 -5
  84. package/lib/interfaces/help.d.ts +17 -17
  85. package/lib/interfaces/hooks.d.ts +49 -49
  86. package/lib/interfaces/index.d.ts +7 -7
  87. package/lib/interfaces/manifest.d.ts +1 -1
  88. package/lib/interfaces/parser.d.ts +175 -51
  89. package/lib/interfaces/pjson.d.ts +41 -41
  90. package/lib/interfaces/plugin.d.ts +47 -41
  91. package/lib/interfaces/s3-manifest.d.ts +7 -7
  92. package/lib/interfaces/topic.d.ts +1 -1
  93. package/lib/interfaces/ts-config.d.ts +7 -7
  94. package/lib/main.d.ts +2 -2
  95. package/lib/main.js +16 -16
  96. package/lib/module-loader.d.ts +67 -77
  97. package/lib/module-loader.js +183 -150
  98. package/lib/parser/errors.d.ts +7 -7
  99. package/lib/parser/errors.js +29 -22
  100. package/lib/parser/help.js +5 -5
  101. package/lib/parser/index.js +2 -2
  102. package/lib/parser/parse.d.ts +9 -6
  103. package/lib/parser/parse.js +253 -221
  104. package/lib/parser/validate.js +53 -33
  105. package/lib/performance.d.ts +43 -32
  106. package/lib/performance.js +133 -91
  107. package/lib/screen.js +2 -2
  108. package/lib/settings.d.ts +11 -12
  109. package/lib/settings.js +2 -2
  110. package/lib/util/aggregate-flags.d.ts +2 -0
  111. package/lib/util/aggregate-flags.js +13 -0
  112. package/lib/util/cache-command.d.ts +3 -0
  113. package/lib/util/cache-command.js +109 -0
  114. package/lib/util/cache-default-value.d.ts +2 -0
  115. package/lib/util/cache-default-value.js +28 -0
  116. package/lib/util/ensure-arg-object.d.ts +12 -0
  117. package/lib/util/ensure-arg-object.js +14 -0
  118. package/lib/util/fs.d.ts +7 -0
  119. package/lib/util/fs.js +54 -0
  120. package/lib/util/os.d.ts +19 -0
  121. package/lib/util/os.js +28 -0
  122. package/lib/{util.d.ts → util/util.d.ts} +7 -16
  123. package/lib/util/util.js +98 -0
  124. package/package.json +35 -37
  125. package/lib/util.js +0 -126
  126. package/lib/ux/flush.d.ts +0 -1
  127. package/lib/ux/flush.js +0 -27
  128. package/lib/ux/index.d.ts +0 -58
  129. package/lib/ux/styled/index.d.ts +0 -6
  130. package/lib/ux/styled/index.js +0 -13
  131. package/lib/ux/styled/json.d.ts +0 -1
  132. package/lib/ux/styled/json.js +0 -15
  133. package/lib/ux/wait.js +0 -7
  134. package/lib/{ux → cli-ux}/action/simple.d.ts +4 -4
  135. package/lib/{ux → cli-ux}/action/spinners.d.ts +117 -117
  136. package/lib/{ux → cli-ux}/exit.d.ts +2 -2
  137. package/lib/{ux → cli-ux}/list.d.ts +0 -0
  138. package/lib/{ux → cli-ux}/styled/object.d.ts +0 -0
  139. package/lib/{ux → cli-ux}/styled/progress.d.ts +0 -0
  140. package/lib/{ux → cli-ux}/styled/progress.js +0 -0
  141. package/lib/{ux → cli-ux}/styled/tree.d.ts +1 -1
  142. /package/lib/{ux → cli-ux}/wait.d.ts +0 -0
@@ -1,6 +1,5 @@
1
1
  import { Command } from '../command';
2
2
  import { AlphabetLowercase, AlphabetUppercase } from './alphabet';
3
- import { Config } from './config';
4
3
  export type FlagOutput = {
5
4
  [name: string]: any;
6
5
  };
@@ -155,15 +154,13 @@ export type FlagProps = {
155
154
  */
156
155
  aliases?: string[];
157
156
  /**
158
- * Emit deprecation warning when a flag alias is provided
157
+ * Alternate short chars that can be used for this flag.
159
158
  */
160
- deprecateAliases?: boolean;
159
+ charAliases?: (AlphabetLowercase | AlphabetUppercase)[];
161
160
  /**
162
- * Delimiter to separate the values for a multiple value flag.
163
- * Only respected if multiple is set to true. Default behavior is to
164
- * separate on spaces.
161
+ * Emit deprecation warning when a flag alias is provided
165
162
  */
166
- delimiter?: ',';
163
+ deprecateAliases?: boolean;
167
164
  /**
168
165
  * If true, the value returned by defaultHelp will not be cached in the oclif.manifest.json.
169
166
  * This is helpful if the default value contains sensitive data that shouldn't be published to npm.
@@ -201,13 +198,19 @@ export type BooleanFlagProps = FlagProps & {
201
198
  export type OptionFlagProps = FlagProps & {
202
199
  type: 'option';
203
200
  helpValue?: string;
204
- options?: string[];
201
+ options?: readonly string[];
205
202
  multiple?: boolean;
203
+ /**
204
+ * Delimiter to separate the values for a multiple value flag.
205
+ * Only respected if multiple is set to true. Default behavior is to
206
+ * separate on spaces.
207
+ */
208
+ delimiter?: ',';
206
209
  };
207
210
  export type FlagParserContext = Command & {
208
211
  token: FlagToken;
209
212
  };
210
- export type FlagParser<T, I extends string | boolean, P = CustomOptions> = (input: I, context: FlagParserContext, opts: P & OptionFlag<T, P>) => Promise<T>;
213
+ export type FlagParser<T, I extends string | boolean, P = CustomOptions> = (input: I, context: FlagParserContext, opts: P & OptionFlag<T, P>) => T extends Array<infer U> ? Promise<U | undefined> : Promise<T | undefined>;
211
214
  export type ArgParserContext = Command & {
212
215
  token: ArgToken;
213
216
  };
@@ -234,45 +237,185 @@ export type BooleanFlag<T> = FlagProps & BooleanFlagProps & {
234
237
  default?: FlagDefault<boolean>;
235
238
  parse: (input: boolean, context: FlagParserContext, opts: FlagProps & BooleanFlagProps) => Promise<T>;
236
239
  };
237
- export type OptionFlagDefaults<T, P = CustomOptions, M = false> = FlagProps & OptionFlagProps & {
238
- parse: FlagParser<T, string, P>;
239
- defaultHelp?: FlagDefaultHelp<T>;
240
- input: string[];
241
- default?: M extends true ? FlagDefault<T[] | undefined, P> : FlagDefault<T | undefined, P>;
242
- };
243
240
  export type OptionFlag<T, P = CustomOptions> = FlagProps & OptionFlagProps & {
244
- parse: FlagParser<T, string, P>;
241
+ parse: FlagParser<T | undefined, string, P>;
245
242
  defaultHelp?: FlagDefaultHelp<T, P>;
246
243
  input: string[];
247
- } & ({
248
244
  default?: FlagDefault<T | undefined, P>;
245
+ };
246
+ type ReturnTypeSwitches = {
247
+ multiple: boolean;
248
+ requiredOrDefaulted: boolean;
249
+ };
250
+ /**
251
+ * The logic here is as follows:
252
+ * - If requiredOrDefaulted is true && multiple is true, then the return type is T[]
253
+ * - It's possible that T extends an Array, if so we want to return T so that the return isn't T[][]
254
+ * - If requiredOrDefaulted is true && multiple is false, then the return type is T
255
+ * - If requiredOrDefaulted is false && multiple is true, then the return type is T[] | undefined
256
+ * - It's possible that T extends an Array, if so we want to return T so that the return isn't T[][]
257
+ * - If requiredOrDefaulted is false && multiple is false, then the return type is T | undefined
258
+ */
259
+ type FlagReturnType<T, R extends ReturnTypeSwitches> = R['requiredOrDefaulted'] extends true ? R['multiple'] extends true ? [T] extends [Array<unknown>] ? T : T[] : T : R['multiple'] extends true ? [T] extends [Array<unknown>] ? T | undefined : T[] | undefined : T | undefined;
260
+ /**
261
+ * FlagDefinition types a function that takes `options` and returns an OptionFlag<T>.
262
+ *
263
+ * This is returned by `Flags.custom()` and `Flags.option()`, which each take a `defaults` object
264
+ * that mirrors the OptionFlag interface.
265
+ *
266
+ * The `T` in the `OptionFlag<T>` return type is determined by a combination of the provided defaults for
267
+ * `multiple`, `required`, and `default` and the provided options for those same properties. If these properties
268
+ * are provided in the options, they override the defaults.
269
+ *
270
+ * no options or defaults -> T | undefined
271
+ * `required` -> T
272
+ * `default` -> T
273
+ * `multiple` -> T[] | undefined
274
+ * `required` + `multiple` -> T[]
275
+ * `default` + `multiple` -> T[]
276
+ */
277
+ export type FlagDefinition<T, P = CustomOptions, R extends ReturnTypeSwitches = {
249
278
  multiple: false;
250
- } | {
251
- default?: FlagDefault<T[] | undefined, P>;
252
- multiple: true;
253
- });
254
- export type FlagDefinition<T, P = CustomOptions> = {
279
+ requiredOrDefaulted: false;
280
+ }> = {
281
+ (options: P & {
282
+ multiple: false;
283
+ required: true;
284
+ } & Partial<OptionFlag<FlagReturnType<T, {
285
+ multiple: false;
286
+ requiredOrDefaulted: true;
287
+ }>, P>>): OptionFlag<FlagReturnType<T, {
288
+ multiple: false;
289
+ requiredOrDefaulted: true;
290
+ }>>;
255
291
  (options: P & {
256
292
  multiple: true;
293
+ required: false;
294
+ } & Partial<OptionFlag<FlagReturnType<T, {
295
+ multiple: true;
296
+ requiredOrDefaulted: false;
297
+ }>, P>>): OptionFlag<FlagReturnType<T, {
298
+ multiple: true;
299
+ requiredOrDefaulted: false;
300
+ }>>;
301
+ (options: P & {
302
+ multiple: false;
303
+ required: false;
304
+ } & Partial<OptionFlag<FlagReturnType<T, {
305
+ multiple: false;
306
+ requiredOrDefaulted: false;
307
+ }>, P>>): OptionFlag<FlagReturnType<T, {
308
+ multiple: false;
309
+ requiredOrDefaulted: false;
310
+ }>>;
311
+ (options: R['multiple'] extends true ? // `multiple` is defaulted to true and either `required=true` or `default` are provided in options
312
+ P & ({
313
+ required: true;
314
+ } | {
315
+ default: OptionFlag<FlagReturnType<T, {
316
+ multiple: R['multiple'];
317
+ requiredOrDefaulted: true;
318
+ }>, P>['default'];
319
+ }) & Partial<OptionFlag<FlagReturnType<T, {
320
+ multiple: R['multiple'];
321
+ requiredOrDefaulted: true;
322
+ }>, P>> : // `multiple` is NOT defaulted to true and either `required=true` or `default` are provided in options
323
+ P & {
324
+ multiple?: false | undefined;
257
325
  } & ({
258
326
  required: true;
259
327
  } | {
260
- default: FlagDefault<T[]>;
261
- }) & Partial<OptionFlag<T, P>>): OptionFlag<T[]>;
262
- (options: P & {
328
+ default: OptionFlag<FlagReturnType<T, {
329
+ multiple: R['multiple'];
330
+ requiredOrDefaulted: true;
331
+ }>, P>['default'];
332
+ }) & Partial<OptionFlag<FlagReturnType<T, {
333
+ multiple: R['multiple'];
334
+ requiredOrDefaulted: true;
335
+ }>, P>>): OptionFlag<FlagReturnType<T, {
336
+ multiple: R['multiple'];
337
+ requiredOrDefaulted: true;
338
+ }>>;
339
+ (options: R['multiple'] extends true ? // `multiple` is defaulted to true and either `required=true` or `default` are provided in options
340
+ P & ({
341
+ required: true;
342
+ } | {
343
+ default: OptionFlag<FlagReturnType<T, {
344
+ multiple: true;
345
+ requiredOrDefaulted: true;
346
+ }>, P>['default'];
347
+ }) & Partial<OptionFlag<FlagReturnType<T, {
263
348
  multiple: true;
264
- } & Partial<OptionFlag<T>>): OptionFlag<T[] | undefined>;
265
- (options: P & ({
349
+ requiredOrDefaulted: true;
350
+ }>, P>> : // `multiple` is NOT defaulted to true but `multiple=true` and either `required=true` or `default` are provided in options
351
+ P & {
352
+ multiple: true;
353
+ } & ({
354
+ required: true;
355
+ } | {
356
+ default: OptionFlag<FlagReturnType<T, {
357
+ multiple: true;
358
+ requiredOrDefaulted: true;
359
+ }>, P>['default'];
360
+ }) & Partial<OptionFlag<FlagReturnType<T, {
361
+ multiple: true;
362
+ requiredOrDefaulted: true;
363
+ }>, P>>): OptionFlag<FlagReturnType<T, {
364
+ multiple: true;
365
+ requiredOrDefaulted: true;
366
+ }>>;
367
+ (options: P & {
368
+ multiple?: false | undefined;
369
+ } & ({
266
370
  required: true;
267
371
  } | {
268
- default: FlagDefault<T>;
269
- }) & Partial<OptionFlag<T>>): OptionFlag<T>;
270
- (options?: P & Partial<OptionFlag<T>>): OptionFlag<T | undefined>;
372
+ default: OptionFlag<FlagReturnType<T, {
373
+ multiple: R['multiple'];
374
+ requiredOrDefaulted: true;
375
+ }>, P>['default'];
376
+ }) & Partial<OptionFlag<FlagReturnType<T, {
377
+ multiple: R['multiple'];
378
+ requiredOrDefaulted: true;
379
+ }>, P>>): OptionFlag<FlagReturnType<T, {
380
+ multiple: R['multiple'];
381
+ requiredOrDefaulted: true;
382
+ }>>;
383
+ (options: P & {
384
+ required: false;
385
+ } & Partial<OptionFlag<FlagReturnType<T, {
386
+ multiple: R['multiple'];
387
+ requiredOrDefaulted: false;
388
+ }>, P>>): OptionFlag<FlagReturnType<T, {
389
+ multiple: R['multiple'];
390
+ requiredOrDefaulted: false;
391
+ }>>;
392
+ (options: P & {
393
+ multiple: false;
394
+ } & Partial<OptionFlag<FlagReturnType<T, {
395
+ multiple: false;
396
+ requiredOrDefaulted: R['requiredOrDefaulted'];
397
+ }>, P>>): OptionFlag<FlagReturnType<T, {
398
+ multiple: false;
399
+ requiredOrDefaulted: R['requiredOrDefaulted'];
400
+ }>>;
401
+ (options?: P & {
402
+ multiple?: false | undefined;
403
+ } & Partial<OptionFlag<FlagReturnType<T, R>, P>>): OptionFlag<FlagReturnType<T, R>>;
404
+ (options: P & {
405
+ multiple: true;
406
+ } & Partial<OptionFlag<FlagReturnType<T, {
407
+ multiple: true;
408
+ requiredOrDefaulted: R['requiredOrDefaulted'];
409
+ }>, P>>): OptionFlag<FlagReturnType<T, {
410
+ multiple: true;
411
+ requiredOrDefaulted: R['requiredOrDefaulted'];
412
+ }>>;
271
413
  };
272
414
  export type Flag<T> = BooleanFlag<T> | OptionFlag<T>;
273
415
  export type Input<TFlags extends FlagOutput, BFlags extends FlagOutput, AFlags extends ArgOutput> = {
274
416
  flags?: FlagInput<TFlags>;
275
417
  baseFlags?: FlagInput<BFlags>;
418
+ enableJsonFlag?: true | false;
276
419
  args?: ArgInput<AFlags>;
277
420
  strict?: boolean;
278
421
  context?: ParserContext;
@@ -289,33 +432,14 @@ export type ParserInput = {
289
432
  export type ParserContext = Command & {
290
433
  token?: FlagToken | ArgToken;
291
434
  };
292
- export type CompletionContext = {
293
- args?: {
294
- [name: string]: string;
295
- };
296
- flags?: {
297
- [name: string]: string;
298
- };
299
- argv?: string[];
300
- config: Config;
301
- };
302
- export type Completion = {
303
- skipCache?: boolean;
304
- cacheDuration?: number;
305
- cacheKey?(ctx: CompletionContext): Promise<string>;
306
- options(ctx: CompletionContext): Promise<string[]>;
307
- };
308
- export type CompletableOptionFlag<T> = OptionFlag<T> & {
309
- completion?: Completion;
310
- };
311
- export type CompletableFlag<T> = BooleanFlag<T> | CompletableOptionFlag<T>;
312
435
  export type FlagInput<T extends FlagOutput = {
313
436
  [flag: string]: any;
314
437
  }> = {
315
- [P in keyof T]: CompletableFlag<T[P]>;
438
+ [P in keyof T]: Flag<T[P]>;
316
439
  };
317
440
  export type ArgInput<T extends ArgOutput = {
318
441
  [arg: string]: any;
319
442
  }> = {
320
443
  [P in keyof T]: Arg<T[P]>;
321
444
  };
445
+ export {};
@@ -1,7 +1,6 @@
1
1
  import { HelpOptions } from './help';
2
2
  export interface PJSON {
3
3
  [k: string]: any;
4
- version: string;
5
4
  dependencies?: {
6
5
  [name: string]: string;
7
6
  };
@@ -9,111 +8,112 @@ export interface PJSON {
9
8
  [name: string]: string;
10
9
  };
11
10
  oclif: {
12
- schema?: number;
13
11
  bin?: string;
14
12
  dirname?: string;
15
13
  hooks?: Record<string, string | string[]>;
16
14
  plugins?: string[];
15
+ schema?: number;
17
16
  };
17
+ version: string;
18
18
  }
19
19
  export declare namespace PJSON {
20
20
  interface Plugin extends PJSON {
21
21
  name: string;
22
- version: string;
23
22
  oclif: PJSON['oclif'] & {
24
- schema?: number;
25
- description?: string;
26
- topicSeparator?: ':' | ' ';
27
- flexibleTaxonomy?: boolean;
28
- hooks?: {
29
- [name: string]: (string | string[]);
23
+ additionalHelpFlags?: string[];
24
+ additionalVersionFlags?: string[];
25
+ aliases?: {
26
+ [name: string]: null | string;
30
27
  };
31
28
  commands?: string;
32
29
  default?: string;
33
- plugins?: string[];
30
+ description?: string;
34
31
  devPlugins?: string[];
35
- jitPlugins?: Record<string, string>;
32
+ flexibleTaxonomy?: boolean;
36
33
  helpClass?: string;
37
34
  helpOptions?: HelpOptions;
38
- aliases?: {
39
- [name: string]: string | null;
35
+ hooks?: {
36
+ [name: string]: string | string[];
40
37
  };
38
+ jitPlugins?: Record<string, string>;
39
+ plugins?: string[];
41
40
  repositoryPrefix?: string;
41
+ schema?: number;
42
+ state?: 'beta' | 'deprecated' | string;
43
+ topicSeparator?: ' ' | ':';
44
+ topics?: {
45
+ [k: string]: {
46
+ description?: string;
47
+ hidden?: boolean;
48
+ subtopics?: Plugin['oclif']['topics'];
49
+ };
50
+ };
42
51
  update: {
43
- s3: S3;
44
52
  autoupdate?: {
45
- rollout?: number;
46
53
  debounce?: number;
54
+ rollout?: number;
47
55
  };
48
56
  node: {
49
- version?: string;
50
57
  targets?: string[];
58
+ version?: string;
51
59
  };
60
+ s3: S3;
52
61
  };
53
- topics?: {
54
- [k: string]: {
55
- description?: string;
56
- subtopics?: Plugin['oclif']['topics'];
57
- hidden?: boolean;
58
- };
59
- };
60
- additionalHelpFlags?: string[];
61
- additionalVersionFlags?: string[];
62
- state?: 'beta' | 'deprecated' | string;
63
62
  };
63
+ version: string;
64
64
  }
65
65
  interface S3 {
66
66
  acl?: string;
67
67
  bucket?: string;
68
- host?: string;
69
- xz?: boolean;
70
68
  gz?: boolean;
69
+ host?: string;
71
70
  templates: {
72
71
  target: S3.Templates;
73
72
  vanilla: S3.Templates;
74
73
  };
74
+ xz?: boolean;
75
75
  }
76
76
  namespace S3 {
77
77
  interface Templates {
78
78
  baseDir?: string;
79
- versioned?: string;
80
- unversioned?: string;
81
79
  manifest?: string;
80
+ unversioned?: string;
81
+ versioned?: string;
82
82
  }
83
83
  }
84
84
  interface CLI extends Plugin {
85
85
  oclif: Plugin['oclif'] & {
86
- schema?: number;
87
86
  bin?: string;
88
87
  binAliases?: string[];
89
- nsisCustomization?: string;
90
- npmRegistry?: string;
91
- scope?: string;
92
88
  dirname?: string;
93
89
  flexibleTaxonomy?: boolean;
94
90
  jitPlugins?: Record<string, string>;
91
+ npmRegistry?: string;
92
+ nsisCustomization?: string;
93
+ schema?: number;
94
+ scope?: string;
95
95
  };
96
96
  }
97
97
  interface User extends PJSON {
98
- private?: boolean;
99
98
  oclif: PJSON['oclif'] & {
100
- plugins?: (string | PluginTypes.User | PluginTypes.Link)[];
99
+ plugins?: (PluginTypes.Link | PluginTypes.User | string)[];
101
100
  };
101
+ private?: boolean;
102
102
  }
103
- type PluginTypes = PluginTypes.User | PluginTypes.Link | {
103
+ type PluginTypes = {
104
104
  root: string;
105
- };
105
+ } | PluginTypes.Link | PluginTypes.User;
106
106
  namespace PluginTypes {
107
107
  interface User {
108
- type: 'user';
109
108
  name: string;
110
- url?: string;
111
109
  tag?: string;
110
+ type: 'user';
111
+ url?: string;
112
112
  }
113
113
  interface Link {
114
- type: 'link';
115
114
  name: string;
116
115
  root: string;
116
+ type: 'link';
117
117
  }
118
118
  }
119
119
  }
@@ -2,60 +2,67 @@ import { Command } from '../command';
2
2
  import { PJSON } from './pjson';
3
3
  import { Topic } from './topic';
4
4
  export interface PluginOptions {
5
- root: string;
6
- name?: string;
7
- type?: string;
8
- tag?: string;
9
- ignoreManifest?: boolean;
10
- errorOnManifestCreate?: boolean;
11
- respectNoCacheDefault?: boolean;
12
- parent?: Plugin;
13
5
  children?: Plugin[];
6
+ errorOnManifestCreate?: boolean;
14
7
  flexibleTaxonomy?: boolean;
8
+ ignoreManifest?: boolean;
9
+ isRoot?: boolean;
10
+ name?: string;
11
+ parent?: Plugin;
12
+ respectNoCacheDefault?: boolean;
13
+ root: string;
14
+ tag?: string;
15
+ type?: string;
15
16
  }
16
17
  export interface Options extends PluginOptions {
18
+ channel?: string;
17
19
  devPlugins?: boolean;
20
+ enablePerf?: boolean;
18
21
  jitPlugins?: boolean;
22
+ plugins?: Map<string, Plugin>;
19
23
  userPlugins?: boolean;
20
- channel?: string;
21
24
  version?: string;
22
- enablePerf?: boolean;
23
- plugins?: Map<string, Plugin>;
24
25
  }
25
26
  export interface Plugin {
26
27
  /**
27
28
  * ../config version
28
29
  */
29
30
  _base: string;
30
- /**
31
- * name from package.json
32
- */
33
- name: string;
34
31
  /**
35
32
  * aliases from package.json dependencies
36
33
  */
37
34
  alias: string;
35
+ readonly commandIDs: string[];
36
+ commands: Command.Loadable[];
37
+ findCommand(id: string, opts: {
38
+ must: true;
39
+ }): Promise<Command.Class>;
40
+ findCommand(id: string, opts?: {
41
+ must: boolean;
42
+ }): Promise<Command.Class> | undefined;
43
+ readonly hasManifest: boolean;
44
+ hooks: {
45
+ [k: string]: string[];
46
+ };
38
47
  /**
39
- * version from package.json
40
- *
41
- * example: 1.2.3
48
+ * True if the plugin is the root plugin.
42
49
  */
43
- version: string;
50
+ isRoot: boolean;
51
+ load(): Promise<void>;
44
52
  /**
45
- * full package.json
46
- *
47
- * parsed with read-pkg
53
+ * Plugin is written in ESM or CommonJS
48
54
  */
49
- pjson: PJSON.Plugin | PJSON.CLI;
55
+ moduleType: 'commonjs' | 'module';
50
56
  /**
51
- * used to tell the user how the plugin was installed
52
- * examples: core, link, user, dev
57
+ * name from package.json
53
58
  */
54
- type: string;
59
+ name: string;
55
60
  /**
56
- * Plugin is written in ESM or CommonJS
61
+ * full package.json
62
+ *
63
+ * parsed with read-pkg
57
64
  */
58
- moduleType: 'module' | 'commonjs';
65
+ pjson: PJSON.CLI | PJSON.Plugin;
59
66
  /**
60
67
  * base path of plugin
61
68
  */
@@ -65,21 +72,20 @@ export interface Plugin {
65
72
  * only used for user plugins
66
73
  */
67
74
  tag?: string;
75
+ readonly topics: Topic[];
76
+ /**
77
+ * used to tell the user how the plugin was installed
78
+ * examples: core, link, user, dev
79
+ */
80
+ type: string;
68
81
  /**
69
82
  * if it appears to be an npm package but does not look like it's really a CLI plugin, this is set to false
70
83
  */
71
84
  valid: boolean;
72
- commands: Command.Loadable[];
73
- hooks: {
74
- [k: string]: string[];
75
- };
76
- readonly commandIDs: string[];
77
- readonly topics: Topic[];
78
- findCommand(id: string, opts: {
79
- must: true;
80
- }): Promise<Command.Class>;
81
- findCommand(id: string, opts?: {
82
- must: boolean;
83
- }): Promise<Command.Class> | undefined;
84
- load(): Promise<void>;
85
+ /**
86
+ * version from package.json
87
+ *
88
+ * example: 1.2.3
89
+ */
90
+ version: string;
85
91
  }
@@ -1,14 +1,14 @@
1
1
  export interface S3Manifest {
2
- version: string;
3
- sha: string;
4
- gz: string;
5
- xz?: string;
6
- sha256gz: string;
7
- sha256xz?: string;
8
2
  baseDir: string;
9
- rollout?: number;
3
+ gz: string;
10
4
  node: {
11
5
  compatible: string;
12
6
  recommended: string;
13
7
  };
8
+ rollout?: number;
9
+ sha: string;
10
+ sha256gz: string;
11
+ sha256xz?: string;
12
+ version: string;
13
+ xz?: string;
14
14
  }
@@ -1,5 +1,5 @@
1
1
  export interface Topic {
2
- name: string;
3
2
  description?: string;
4
3
  hidden?: boolean;
4
+ name: string;
5
5
  }
@@ -1,20 +1,20 @@
1
1
  export interface TSConfig {
2
2
  compilerOptions: {
3
- rootDir?: string;
4
- rootDirs?: string[];
5
- outDir?: string;
6
- target?: string;
3
+ emitDecoratorMetadata?: boolean;
7
4
  esModuleInterop?: boolean;
8
5
  experimentalDecorators?: boolean;
9
- emitDecoratorMetadata?: boolean;
6
+ jsx?: boolean;
10
7
  module?: string;
11
8
  moduleResolution?: string;
9
+ outDir?: string;
10
+ rootDir?: string;
11
+ rootDirs?: string[];
12
12
  sourceMap?: boolean;
13
- jsx?: boolean;
13
+ target?: string;
14
14
  };
15
15
  'ts-node'?: {
16
16
  esm?: boolean;
17
- experimentalSpecifierResolution?: 'node' | 'explicit';
17
+ experimentalSpecifierResolution?: 'explicit' | 'node';
18
18
  scope?: boolean;
19
19
  };
20
20
  }
package/lib/main.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as Interfaces from './interfaces';
2
1
  import { Config } from './config';
2
+ import * as Interfaces from './interfaces';
3
3
  export declare const helpAddition: (argv: string[], config: Interfaces.Config) => boolean;
4
4
  export declare const versionAddition: (argv: string[], config?: Interfaces.Config) => boolean;
5
- export default function run(argv?: string[], options?: Interfaces.LoadOptions): Promise<unknown>;
5
+ export declare function run(argv?: string[], options?: Interfaces.LoadOptions): Promise<unknown>;