@oclif/core 3.0.0-beta.2 → 3.0.0-beta.21
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/README.md +10 -6
- package/flush.js +1 -1
- package/handle.js +1 -1
- package/lib/args.d.ts +1 -1
- package/lib/args.js +17 -18
- package/lib/cli-ux/action/base.d.ts +3 -5
- package/lib/cli-ux/action/base.js +32 -26
- package/lib/cli-ux/action/simple.js +13 -18
- package/lib/cli-ux/action/spinner.d.ts +4 -2
- package/lib/cli-ux/action/spinner.js +27 -19
- package/lib/cli-ux/action/spinners.js +1 -1
- package/lib/cli-ux/action/types.d.ts +5 -0
- package/lib/cli-ux/action/types.js +2 -0
- package/lib/cli-ux/config.d.ts +0 -1
- package/lib/cli-ux/config.js +17 -21
- package/lib/cli-ux/exit.d.ts +1 -1
- package/lib/cli-ux/exit.js +4 -1
- package/lib/cli-ux/flush.d.ts +1 -0
- package/lib/cli-ux/flush.js +28 -0
- package/lib/cli-ux/index.d.ts +10 -30
- package/lib/cli-ux/index.js +32 -75
- package/lib/cli-ux/list.js +3 -3
- package/lib/cli-ux/prompt.js +32 -22
- package/lib/cli-ux/stream.js +1 -0
- package/lib/cli-ux/styled/index.d.ts +5 -6
- package/lib/cli-ux/styled/index.js +11 -11
- package/lib/cli-ux/styled/json.js +8 -5
- package/lib/cli-ux/styled/object.js +7 -9
- package/lib/cli-ux/styled/table.d.ts +4 -4
- package/lib/cli-ux/styled/table.js +61 -64
- package/lib/cli-ux/styled/tree.js +1 -3
- package/lib/cli-ux/wait.js +3 -5
- package/lib/command.d.ts +15 -19
- package/lib/command.js +117 -96
- package/lib/config/config.d.ts +16 -23
- package/lib/config/config.js +180 -334
- package/lib/config/index.d.ts +1 -1
- package/lib/config/index.js +1 -2
- package/lib/config/plugin-loader.d.ts +30 -0
- package/lib/config/plugin-loader.js +145 -0
- package/lib/config/plugin.d.ts +6 -11
- package/lib/config/plugin.js +112 -78
- package/lib/config/ts-node.d.ts +2 -1
- package/lib/config/ts-node.js +64 -51
- package/lib/config/util.d.ts +1 -11
- package/lib/config/util.js +6 -59
- package/lib/errors/config.js +1 -1
- package/lib/errors/errors/cli.d.ts +1 -1
- package/lib/errors/errors/cli.js +18 -14
- package/lib/errors/errors/exit.d.ts +0 -3
- package/lib/errors/errors/exit.js +1 -1
- package/lib/errors/errors/module-load.d.ts +0 -3
- package/lib/errors/errors/module-load.js +1 -1
- package/lib/errors/errors/pretty-print.js +11 -9
- package/lib/errors/handle.d.ts +12 -2
- package/lib/errors/handle.js +28 -18
- package/lib/errors/index.d.ts +2 -2
- package/lib/errors/index.js +20 -19
- package/lib/errors/logger.js +9 -8
- package/lib/execute.d.ts +49 -0
- package/lib/execute.js +63 -0
- package/lib/flags.d.ts +102 -31
- package/lib/flags.js +81 -46
- package/lib/help/command.d.ts +2 -0
- package/lib/help/command.js +68 -53
- package/lib/help/docopts.js +9 -13
- package/lib/help/formatter.d.ts +1 -1
- package/lib/help/formatter.js +35 -24
- package/lib/help/index.d.ts +7 -3
- package/lib/help/index.js +77 -55
- package/lib/help/root.js +7 -9
- package/lib/help/util.d.ts +1 -7
- package/lib/help/util.js +8 -28
- package/lib/index.d.ts +19 -18
- package/lib/index.js +36 -48
- package/lib/interfaces/config.d.ts +30 -30
- package/lib/interfaces/errors.d.ts +1 -1
- package/lib/interfaces/hooks.d.ts +3 -3
- package/lib/interfaces/index.d.ts +14 -14
- package/lib/interfaces/parser.d.ts +188 -116
- package/lib/interfaces/pjson.d.ts +2 -1
- package/lib/interfaces/plugin.d.ts +10 -1
- package/lib/main.d.ts +0 -48
- package/lib/main.js +11 -66
- package/lib/module-loader.d.ts +68 -79
- package/lib/module-loader.js +183 -150
- package/lib/parser/errors.d.ts +3 -3
- package/lib/parser/errors.js +17 -10
- package/lib/parser/help.js +5 -5
- package/lib/parser/parse.d.ts +3 -0
- package/lib/parser/parse.js +114 -115
- package/lib/parser/validate.js +45 -25
- package/lib/performance.d.ts +5 -1
- package/lib/performance.js +40 -19
- package/lib/util/aggregate-flags.d.ts +2 -0
- package/lib/util/aggregate-flags.js +13 -0
- package/lib/util/cache-command.d.ts +3 -0
- package/lib/util/cache-command.js +109 -0
- package/lib/util/cache-default-value.d.ts +2 -0
- package/lib/util/cache-default-value.js +28 -0
- package/lib/util/ensure-arg-object.d.ts +12 -0
- package/lib/util/ensure-arg-object.js +14 -0
- package/lib/util/fs.d.ts +7 -0
- package/lib/util/fs.js +54 -0
- package/lib/util/os.d.ts +19 -0
- package/lib/util/os.js +28 -0
- package/lib/{util.d.ts → util/util.d.ts} +6 -15
- package/lib/util/util.js +98 -0
- package/package.json +32 -34
- package/lib/cli-ux/action/pride-spinner.d.ts +0 -4
- package/lib/cli-ux/action/pride-spinner.js +0 -30
- package/lib/util.js +0 -126
package/lib/command.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Command = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const Errors = require("./errors");
|
|
10
|
-
const Parser = require("./parser");
|
|
11
|
-
const util_2 = require("./help/util");
|
|
12
|
-
const flags_1 = require("./flags");
|
|
13
|
-
const util_3 = require("./util");
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Errors = tslib_1.__importStar(require("./errors"));
|
|
6
|
+
const Parser = tslib_1.__importStar(require("./parser"));
|
|
7
|
+
const node_util_1 = require("node:util");
|
|
8
|
+
const util_1 = require("./help/util");
|
|
14
9
|
const stream_1 = require("./cli-ux/stream");
|
|
15
|
-
const
|
|
10
|
+
const config_1 = require("./config");
|
|
11
|
+
const aggregate_flags_1 = require("./util/aggregate-flags");
|
|
12
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
13
|
+
const node_url_1 = require("node:url");
|
|
14
|
+
const fs_1 = require("./util/fs");
|
|
15
|
+
const util_2 = require("./util/util");
|
|
16
|
+
const cli_ux_1 = require("./cli-ux");
|
|
17
|
+
const pjson = (0, fs_1.requireJson)(__dirname, '..', 'package.json');
|
|
16
18
|
/**
|
|
17
19
|
* swallows stdout epipe errors
|
|
18
20
|
* this occurs when stdout closes such as when piping to head
|
|
@@ -22,40 +24,68 @@ stream_1.stdout.on('error', (err) => {
|
|
|
22
24
|
return;
|
|
23
25
|
throw err;
|
|
24
26
|
});
|
|
25
|
-
const jsonFlag = {
|
|
26
|
-
json: (0, flags_1.boolean)({
|
|
27
|
-
description: 'Format output as json.',
|
|
28
|
-
helpGroup: 'GLOBAL',
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
27
|
/**
|
|
32
28
|
* An abstract class which acts as the base for each command
|
|
33
29
|
* in your project.
|
|
34
30
|
*/
|
|
35
31
|
class Command {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
static
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
32
|
+
argv;
|
|
33
|
+
config;
|
|
34
|
+
static _base = `${pjson.name}@${pjson.version}`;
|
|
35
|
+
/** A command ID, used mostly in error or verbose reporting. */
|
|
36
|
+
static id;
|
|
37
|
+
/**
|
|
38
|
+
* The tweet-sized description for your class, used in a parent-commands
|
|
39
|
+
* sub-command listing and as the header for the command help.
|
|
40
|
+
*/
|
|
41
|
+
static summary;
|
|
42
|
+
/**
|
|
43
|
+
* A full description of how to use the command.
|
|
44
|
+
*
|
|
45
|
+
* If no summary, the first line of the description will be used as the summary.
|
|
46
|
+
*/
|
|
47
|
+
static description;
|
|
48
|
+
/** Hide the command from help */
|
|
49
|
+
static hidden;
|
|
50
|
+
/** Mark the command as a given state (e.g. beta or deprecated) in help */
|
|
51
|
+
static state;
|
|
52
|
+
static deprecationOptions;
|
|
53
|
+
/**
|
|
54
|
+
* Emit deprecation warning when a command alias is used
|
|
55
|
+
*/
|
|
56
|
+
static deprecateAliases;
|
|
57
|
+
/**
|
|
58
|
+
* An override string (or strings) for the default usage documentation.
|
|
59
|
+
*/
|
|
60
|
+
static usage;
|
|
61
|
+
static help;
|
|
62
|
+
/** An array of aliases for this command. */
|
|
63
|
+
static aliases = [];
|
|
64
|
+
/** When set to false, allows a variable amount of arguments */
|
|
65
|
+
static strict = true;
|
|
66
|
+
/** An order-dependent object of arguments for the command */
|
|
67
|
+
static args = {};
|
|
68
|
+
static plugin;
|
|
69
|
+
static pluginName;
|
|
70
|
+
static pluginType;
|
|
71
|
+
static pluginAlias;
|
|
72
|
+
/**
|
|
73
|
+
* An array of examples to show at the end of the command's help.
|
|
74
|
+
*
|
|
75
|
+
* IF only a string is provided, it will try to look for a line that starts
|
|
76
|
+
* with the cmd.bin as the example command and the rest as the description.
|
|
77
|
+
* If found, the command will be formatted appropriately.
|
|
78
|
+
*
|
|
79
|
+
* ```
|
|
80
|
+
* EXAMPLES:
|
|
81
|
+
* A description of a particular use case.
|
|
82
|
+
*
|
|
83
|
+
* $ <%= config.bin => command flags
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
static examples;
|
|
87
|
+
static hasDynamicHelp = false;
|
|
88
|
+
static enableJsonFlag = false;
|
|
59
89
|
/**
|
|
60
90
|
* instantiate and run the command
|
|
61
91
|
*
|
|
@@ -69,7 +99,7 @@ class Command {
|
|
|
69
99
|
argv = process.argv.slice(2);
|
|
70
100
|
// Handle the case when a file URL string is passed in such as 'import.meta.url'; covert to file path.
|
|
71
101
|
if (typeof opts === 'string' && opts.startsWith('file://')) {
|
|
72
|
-
opts = (0,
|
|
102
|
+
opts = (0, node_url_1.fileURLToPath)(opts);
|
|
73
103
|
}
|
|
74
104
|
const config = await config_1.Config.load(opts || require.main?.filename || __dirname);
|
|
75
105
|
const cmd = new this(argv, config);
|
|
@@ -80,19 +110,11 @@ class Command {
|
|
|
80
110
|
}
|
|
81
111
|
return cmd._run();
|
|
82
112
|
}
|
|
83
|
-
static
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.flags = {}; // force the flags setter to run
|
|
89
|
-
}
|
|
90
|
-
static get flags() {
|
|
91
|
-
return this._flags;
|
|
92
|
-
}
|
|
93
|
-
static set flags(flags) {
|
|
94
|
-
this._flags = Object.assign({}, this._flags ?? {}, this.baseFlags, flags);
|
|
95
|
-
}
|
|
113
|
+
static baseFlags;
|
|
114
|
+
/** A hash of flags for the command */
|
|
115
|
+
static flags;
|
|
116
|
+
id;
|
|
117
|
+
debug;
|
|
96
118
|
constructor(argv, config) {
|
|
97
119
|
this.argv = argv;
|
|
98
120
|
this.config = config;
|
|
@@ -101,7 +123,9 @@ class Command {
|
|
|
101
123
|
this.debug = require('debug')(this.id ? `${this.config.bin}:${this.id}` : this.config.bin);
|
|
102
124
|
}
|
|
103
125
|
catch {
|
|
104
|
-
this.debug = () => {
|
|
126
|
+
this.debug = () => {
|
|
127
|
+
// noop
|
|
128
|
+
};
|
|
105
129
|
}
|
|
106
130
|
}
|
|
107
131
|
get ctor() {
|
|
@@ -140,14 +164,14 @@ class Command {
|
|
|
140
164
|
}
|
|
141
165
|
log(message = '', ...args) {
|
|
142
166
|
if (!this.jsonEnabled()) {
|
|
143
|
-
message = typeof message === 'string' ? message : (0,
|
|
144
|
-
stream_1.stdout.write((0,
|
|
167
|
+
message = typeof message === 'string' ? message : (0, node_util_1.inspect)(message);
|
|
168
|
+
stream_1.stdout.write((0, node_util_1.format)(message, ...args) + '\n');
|
|
145
169
|
}
|
|
146
170
|
}
|
|
147
171
|
logToStderr(message = '', ...args) {
|
|
148
172
|
if (!this.jsonEnabled()) {
|
|
149
|
-
message = typeof message === 'string' ? message : (0,
|
|
150
|
-
stream_1.stderr.write((0,
|
|
173
|
+
message = typeof message === 'string' ? message : (0, node_util_1.inspect)(message);
|
|
174
|
+
stream_1.stderr.write((0, node_util_1.format)(message, ...args) + '\n');
|
|
151
175
|
}
|
|
152
176
|
}
|
|
153
177
|
/**
|
|
@@ -156,16 +180,19 @@ class Command {
|
|
|
156
180
|
* @returns {boolean} true if the command supports json and the --json flag is present
|
|
157
181
|
*/
|
|
158
182
|
jsonEnabled() {
|
|
159
|
-
//
|
|
183
|
+
// If the command doesn't support json, return false
|
|
160
184
|
if (!this.ctor.enableJsonFlag)
|
|
161
185
|
return false;
|
|
162
|
-
//
|
|
163
|
-
if (this.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
186
|
+
// If the CONTENT_TYPE env var is set to json, return true
|
|
187
|
+
if (this.config.scopedEnvVar?.('CONTENT_TYPE')?.toLowerCase() === 'json')
|
|
188
|
+
return true;
|
|
189
|
+
const passThroughIndex = this.argv.indexOf('--');
|
|
190
|
+
const jsonIndex = this.argv.indexOf('--json');
|
|
191
|
+
return passThroughIndex === -1
|
|
192
|
+
? // If '--' is not present, then check for `--json` in this.argv
|
|
193
|
+
jsonIndex > -1
|
|
194
|
+
: // If '--' is present, return true only the --json flag exists and is before the '--'
|
|
195
|
+
jsonIndex > -1 && jsonIndex < passThroughIndex;
|
|
169
196
|
}
|
|
170
197
|
async init() {
|
|
171
198
|
this.debug('init version: %s argv: %o', this.ctor._base, this.argv);
|
|
@@ -179,45 +206,49 @@ class Command {
|
|
|
179
206
|
this.warnIfCommandDeprecated();
|
|
180
207
|
}
|
|
181
208
|
warnIfFlagDeprecated(flags) {
|
|
209
|
+
const allFlags = (0, aggregate_flags_1.aggregateFlags)(this.ctor.flags, this.ctor.baseFlags, this.ctor.enableJsonFlag);
|
|
182
210
|
for (const flag of Object.keys(flags)) {
|
|
183
|
-
const flagDef =
|
|
211
|
+
const flagDef = allFlags[flag];
|
|
184
212
|
const deprecated = flagDef?.deprecated;
|
|
185
213
|
if (deprecated) {
|
|
186
|
-
this.warn((0,
|
|
214
|
+
this.warn((0, util_1.formatFlagDeprecationWarning)(flag, deprecated));
|
|
187
215
|
}
|
|
188
216
|
const deprecateAliases = flagDef?.deprecateAliases;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
217
|
+
if (deprecateAliases) {
|
|
218
|
+
const aliases = (0, util_2.uniq)([...(flagDef?.aliases ?? []), ...(flagDef?.charAliases ?? [])]).map((a) => a.length === 1 ? `-${a}` : `--${a}`);
|
|
219
|
+
if (aliases.length === 0)
|
|
220
|
+
return;
|
|
221
|
+
const foundAliases = aliases.filter((alias) => this.argv.some((a) => a.startsWith(alias)));
|
|
192
222
|
for (const alias of foundAliases) {
|
|
193
223
|
let preferredUsage = `--${flagDef?.name}`;
|
|
194
224
|
if (flagDef?.char) {
|
|
195
225
|
preferredUsage += ` | -${flagDef?.char}`;
|
|
196
226
|
}
|
|
197
|
-
this.warn((0,
|
|
227
|
+
this.warn((0, util_1.formatFlagDeprecationWarning)(alias, { to: preferredUsage }));
|
|
198
228
|
}
|
|
199
229
|
}
|
|
200
230
|
}
|
|
201
231
|
}
|
|
202
232
|
warnIfCommandDeprecated() {
|
|
203
|
-
const [id] = (0,
|
|
233
|
+
const [id] = (0, util_1.normalizeArgv)(this.config);
|
|
204
234
|
if (this.ctor.deprecateAliases && this.ctor.aliases.includes(id)) {
|
|
205
|
-
const cmdName = (0,
|
|
206
|
-
const aliasName = (0,
|
|
207
|
-
this.warn((0,
|
|
235
|
+
const cmdName = (0, util_1.toConfiguredId)(this.ctor.id, this.config);
|
|
236
|
+
const aliasName = (0, util_1.toConfiguredId)(id, this.config);
|
|
237
|
+
this.warn((0, util_1.formatCommandDeprecationWarning)(aliasName, { to: cmdName }));
|
|
208
238
|
}
|
|
209
239
|
if (this.ctor.state === 'deprecated') {
|
|
210
|
-
const cmdName = (0,
|
|
211
|
-
this.warn((0,
|
|
240
|
+
const cmdName = (0, util_1.toConfiguredId)(this.ctor.id, this.config);
|
|
241
|
+
this.warn((0, util_1.formatCommandDeprecationWarning)(cmdName, this.ctor.deprecationOptions));
|
|
212
242
|
}
|
|
213
243
|
}
|
|
214
244
|
async parse(options, argv = this.argv) {
|
|
215
245
|
if (!options)
|
|
216
246
|
options = this.ctor;
|
|
217
|
-
const opts = {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
247
|
+
const opts = {
|
|
248
|
+
context: this,
|
|
249
|
+
...options,
|
|
250
|
+
flags: (0, aggregate_flags_1.aggregateFlags)(options.flags, options.baseFlags, options.enableJsonFlag),
|
|
251
|
+
};
|
|
221
252
|
const results = await Parser.parse(argv, opts);
|
|
222
253
|
this.warnIfFlagDeprecated(results.flags ?? {});
|
|
223
254
|
return results;
|
|
@@ -231,7 +262,7 @@ class Command {
|
|
|
231
262
|
if (!err.message)
|
|
232
263
|
throw err;
|
|
233
264
|
try {
|
|
234
|
-
cli_ux_1.ux.action.stop(
|
|
265
|
+
cli_ux_1.ux.action.stop(chalk_1.default.bold.red('!'));
|
|
235
266
|
}
|
|
236
267
|
catch { }
|
|
237
268
|
throw err;
|
|
@@ -239,7 +270,7 @@ class Command {
|
|
|
239
270
|
}
|
|
240
271
|
async finally(_) {
|
|
241
272
|
try {
|
|
242
|
-
const config = Errors
|
|
273
|
+
const { config } = Errors;
|
|
243
274
|
if (config.errorLogger)
|
|
244
275
|
await config.errorLogger.flush();
|
|
245
276
|
}
|
|
@@ -264,17 +295,7 @@ class Command {
|
|
|
264
295
|
catch {
|
|
265
296
|
keys.push(this.config.scopedEnvVarKey(envVar));
|
|
266
297
|
}
|
|
267
|
-
keys.map(key => delete process.env[key]);
|
|
298
|
+
keys.map((key) => delete process.env[key]);
|
|
268
299
|
}
|
|
269
300
|
}
|
|
270
301
|
exports.Command = Command;
|
|
271
|
-
Command._base = `${pjson.name}@${pjson.version}`;
|
|
272
|
-
/** An array of aliases for this command. */
|
|
273
|
-
Command.aliases = [];
|
|
274
|
-
/** When set to false, allows a variable amount of arguments */
|
|
275
|
-
Command.strict = true;
|
|
276
|
-
/** An order-dependent object of arguments for the command */
|
|
277
|
-
Command.args = {};
|
|
278
|
-
Command.hasDynamicHelp = false;
|
|
279
|
-
Command['_--'] = false;
|
|
280
|
-
Command._enableJsonFlag = false;
|
package/lib/config/config.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Config as IConfig, ArchTypes, PlatformTypes, LoadOptions, VersionDetails } from '../interfaces/config';
|
|
1
|
+
import { ArchTypes, Config as IConfig, LoadOptions, PlatformTypes, VersionDetails } from '../interfaces/config';
|
|
3
2
|
import { Hook, Hooks, PJSON, Topic } from '../interfaces';
|
|
4
|
-
import
|
|
3
|
+
import { Plugin as IPlugin, Options } from '../interfaces/plugin';
|
|
5
4
|
import { Command } from '../command';
|
|
6
5
|
export declare class Config implements IConfig {
|
|
7
6
|
options: Options;
|
|
@@ -22,7 +21,7 @@ export declare class Config implements IConfig {
|
|
|
22
21
|
npmRegistry?: string;
|
|
23
22
|
pjson: PJSON.CLI;
|
|
24
23
|
platform: PlatformTypes;
|
|
25
|
-
plugins: IPlugin
|
|
24
|
+
plugins: Map<string, IPlugin>;
|
|
26
25
|
root: string;
|
|
27
26
|
shell: string;
|
|
28
27
|
topicSeparator: ':' | ' ';
|
|
@@ -39,15 +38,15 @@ export declare class Config implements IConfig {
|
|
|
39
38
|
private _commands;
|
|
40
39
|
private _topics;
|
|
41
40
|
private _commandIDs;
|
|
41
|
+
private pluginLoader;
|
|
42
42
|
private static _rootPlugin;
|
|
43
43
|
constructor(options: Options);
|
|
44
44
|
static load(opts?: LoadOptions): Promise<Config>;
|
|
45
|
-
static get rootPlugin():
|
|
45
|
+
static get rootPlugin(): IPlugin | undefined;
|
|
46
46
|
load(): Promise<void>;
|
|
47
|
-
loadPluginsAndCommands(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
loadUserPlugins(): Promise<void>;
|
|
47
|
+
loadPluginsAndCommands(opts?: {
|
|
48
|
+
force: boolean;
|
|
49
|
+
}): Promise<void>;
|
|
51
50
|
runHook<T extends keyof Hooks>(event: T, opts: Hooks[T]['options'], timeout?: number, captureErrors?: boolean): Promise<Hook.Result<Hooks[T]['return']>>;
|
|
52
51
|
runCommand<T = unknown>(id: string, argv?: string[], cachedCommand?: Command.Loadable | null): Promise<T>;
|
|
53
52
|
scopedEnvVar(k: string): string | undefined;
|
|
@@ -114,11 +113,6 @@ export declare class Config implements IConfig {
|
|
|
114
113
|
protected macosCacheDir(): string | undefined;
|
|
115
114
|
protected _shell(): string;
|
|
116
115
|
protected _debug(): number;
|
|
117
|
-
protected loadPlugins(root: string, type: string, plugins: (string | {
|
|
118
|
-
root?: string;
|
|
119
|
-
name?: string;
|
|
120
|
-
tag?: string;
|
|
121
|
-
})[], parent?: Plugin.Plugin): Promise<void>;
|
|
122
116
|
protected warn(err: string | Error | {
|
|
123
117
|
name: string;
|
|
124
118
|
detail: string;
|
|
@@ -150,14 +144,13 @@ export declare class Config implements IConfig {
|
|
|
150
144
|
*/
|
|
151
145
|
private determinePriority;
|
|
152
146
|
/**
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
* Insert legacy plugins
|
|
148
|
+
*
|
|
149
|
+
* Replace invalid CLI plugins (cli-engine plugins, mostly Heroku) loaded via `this.loadPlugins`
|
|
150
|
+
* with oclif-compatible ones returned by @oclif/plugin-legacy init hook.
|
|
151
|
+
*
|
|
152
|
+
* @param plugins array of oclif-compatible plugins
|
|
153
|
+
* @returns void
|
|
154
|
+
*/
|
|
161
155
|
private insertLegacyPlugins;
|
|
162
156
|
}
|
|
163
|
-
export declare function toCached(c: Command.Class, plugin?: IPlugin | undefined, isWritingManifest?: boolean): Promise<Command.Cached>;
|