oclif 4.0.0-beta.2 → 4.0.0-beta.5
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/bin/dev.js +1 -1
- package/bin/run.js +1 -0
- package/lib/aws.js +1 -1
- package/lib/commands/manifest.d.ts +1 -1
- package/lib/commands/manifest.js +34 -34
- package/lib/commands/pack/win.d.ts +1 -1
- package/lib/commands/pack/win.js +13 -13
- package/lib/commands/readme.d.ts +7 -7
- package/lib/commands/readme.js +72 -72
- package/lib/generators/cli.d.ts +1 -1
- package/lib/generators/cli.js +17 -17
- package/lib/generators/command.d.ts +1 -1
- package/lib/generators/command.js +3 -3
- package/lib/generators/hook.d.ts +1 -1
- package/lib/generators/hook.js +3 -3
- package/{.oclif.manifest.json → oclif.manifest.json} +293 -293
- package/package.json +5 -5
package/bin/dev.js
CHANGED
package/bin/run.js
CHANGED
package/lib/aws.js
CHANGED
package/lib/commands/manifest.js
CHANGED
|
@@ -31,40 +31,6 @@ class Manifest extends core_1.Command {
|
|
|
31
31
|
summary: 'append commands from JIT plugins in manifest',
|
|
32
32
|
}),
|
|
33
33
|
};
|
|
34
|
-
async executeCommand(command, options) {
|
|
35
|
-
return new Promise((resolve) => {
|
|
36
|
-
(0, node_child_process_1.exec)(command, options, (error, stderr, stdout) => {
|
|
37
|
-
if (error)
|
|
38
|
-
this.error(error);
|
|
39
|
-
const debugString = options?.cwd
|
|
40
|
-
? `executing command: ${command} in ${options.cwd}`
|
|
41
|
-
: `executing command: ${command}`;
|
|
42
|
-
this.debug(debugString);
|
|
43
|
-
this.debug(stdout);
|
|
44
|
-
this.debug(stderr);
|
|
45
|
-
resolve({ stderr: stderr.toString(), stdout: stdout.toString() });
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
async getTarballUrl(plugin, version) {
|
|
50
|
-
const { stderr } = await this.executeCommand(`npm view ${plugin}@${version} --json`);
|
|
51
|
-
const { dist } = JSON.parse(stderr);
|
|
52
|
-
return dist.tarball;
|
|
53
|
-
}
|
|
54
|
-
async getVersion(plugin, version) {
|
|
55
|
-
if (version.startsWith('^') || version.startsWith('~')) {
|
|
56
|
-
// Grab latest from npm to get all the versions so we can find the max satisfying version.
|
|
57
|
-
// We explicitly ask for latest since this command is typically run inside of `npm prepack`,
|
|
58
|
-
// which sets the npm_config_tag env var, which is used as the default anytime a tag isn't
|
|
59
|
-
// provided to `npm view`. This can be problematic if you're building the `nightly` version
|
|
60
|
-
// of a CLI and all the JIT plugins don't have a `nightly` tag themselves.
|
|
61
|
-
// TL;DR - always ask for latest to avoid potentially requesting a non-existent tag.
|
|
62
|
-
const { stderr } = await this.executeCommand(`npm view ${plugin}@latest --json`);
|
|
63
|
-
const { versions } = JSON.parse(stderr);
|
|
64
|
-
return (0, semver_1.maxSatisfying)(versions, version) ?? version.replace('^', '').replace('~', '');
|
|
65
|
-
}
|
|
66
|
-
return version;
|
|
67
|
-
}
|
|
68
34
|
async run() {
|
|
69
35
|
const { flags } = await this.parse(Manifest);
|
|
70
36
|
try {
|
|
@@ -123,5 +89,39 @@ class Manifest extends core_1.Command {
|
|
|
123
89
|
(0, fs_extra_1.writeFileSync)(file, JSON.stringify(plugin.manifest, null, 2));
|
|
124
90
|
this.log(`wrote manifest to ${file}`);
|
|
125
91
|
}
|
|
92
|
+
async executeCommand(command, options) {
|
|
93
|
+
return new Promise((resolve) => {
|
|
94
|
+
(0, node_child_process_1.exec)(command, options, (error, stderr, stdout) => {
|
|
95
|
+
if (error)
|
|
96
|
+
this.error(error);
|
|
97
|
+
const debugString = options?.cwd
|
|
98
|
+
? `executing command: ${command} in ${options.cwd}`
|
|
99
|
+
: `executing command: ${command}`;
|
|
100
|
+
this.debug(debugString);
|
|
101
|
+
this.debug(stdout);
|
|
102
|
+
this.debug(stderr);
|
|
103
|
+
resolve({ stderr: stderr.toString(), stdout: stdout.toString() });
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async getTarballUrl(plugin, version) {
|
|
108
|
+
const { stderr } = await this.executeCommand(`npm view ${plugin}@${version} --json`);
|
|
109
|
+
const { dist } = JSON.parse(stderr);
|
|
110
|
+
return dist.tarball;
|
|
111
|
+
}
|
|
112
|
+
async getVersion(plugin, version) {
|
|
113
|
+
if (version.startsWith('^') || version.startsWith('~')) {
|
|
114
|
+
// Grab latest from npm to get all the versions so we can find the max satisfying version.
|
|
115
|
+
// We explicitly ask for latest since this command is typically run inside of `npm prepack`,
|
|
116
|
+
// which sets the npm_config_tag env var, which is used as the default anytime a tag isn't
|
|
117
|
+
// provided to `npm view`. This can be problematic if you're building the `nightly` version
|
|
118
|
+
// of a CLI and all the JIT plugins don't have a `nightly` tag themselves.
|
|
119
|
+
// TL;DR - always ask for latest to avoid potentially requesting a non-existent tag.
|
|
120
|
+
const { stderr } = await this.executeCommand(`npm view ${plugin}@latest --json`);
|
|
121
|
+
const { versions } = JSON.parse(stderr);
|
|
122
|
+
return (0, semver_1.maxSatisfying)(versions, version) ?? version.replace('^', '').replace('~', '');
|
|
123
|
+
}
|
|
124
|
+
return version;
|
|
125
|
+
}
|
|
126
126
|
}
|
|
127
127
|
exports.default = Manifest;
|
|
@@ -7,6 +7,6 @@ export default class PackWin extends Command {
|
|
|
7
7
|
tarball: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
8
8
|
targets: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
9
9
|
};
|
|
10
|
-
private checkForNSIS;
|
|
11
10
|
run(): Promise<void>;
|
|
11
|
+
private checkForNSIS;
|
|
12
12
|
}
|
package/lib/commands/pack/win.js
CHANGED
|
@@ -226,19 +226,6 @@ the CLI should already exist in a directory named after the CLI that is the root
|
|
|
226
226
|
description: 'comma-separated targets to pack (e.g.: win32-x64,win32-x86)',
|
|
227
227
|
}),
|
|
228
228
|
};
|
|
229
|
-
async checkForNSIS() {
|
|
230
|
-
try {
|
|
231
|
-
await exec('makensis');
|
|
232
|
-
}
|
|
233
|
-
catch (error) {
|
|
234
|
-
if (error.code === 1)
|
|
235
|
-
return;
|
|
236
|
-
if (error.code === 127)
|
|
237
|
-
this.error('install makensis');
|
|
238
|
-
else
|
|
239
|
-
throw error;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
229
|
async run() {
|
|
243
230
|
await this.checkForNSIS();
|
|
244
231
|
const { flags } = await this.parse(PackWin);
|
|
@@ -290,6 +277,19 @@ the CLI should already exist in a directory named after the CLI that is the root
|
|
|
290
277
|
this.log(`built ${o}`);
|
|
291
278
|
}));
|
|
292
279
|
}
|
|
280
|
+
async checkForNSIS() {
|
|
281
|
+
try {
|
|
282
|
+
await exec('makensis');
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
if (error.code === 1)
|
|
286
|
+
return;
|
|
287
|
+
if (error.code === 127)
|
|
288
|
+
this.error('install makensis');
|
|
289
|
+
else
|
|
290
|
+
throw error;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
293
|
}
|
|
294
294
|
exports.default = PackWin;
|
|
295
295
|
async function signWindows(o, arch, config, windows) {
|
package/lib/commands/readme.d.ts
CHANGED
|
@@ -8,14 +8,8 @@ export default class Readme extends Command {
|
|
|
8
8
|
'repository-prefix': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
9
9
|
version: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
10
10
|
};
|
|
11
|
-
private HelpClass;
|
|
12
11
|
private flags;
|
|
13
|
-
|
|
14
|
-
* fetches the path to a command
|
|
15
|
-
*/
|
|
16
|
-
private commandPath;
|
|
17
|
-
private commandUsage;
|
|
18
|
-
private repo;
|
|
12
|
+
private HelpClass;
|
|
19
13
|
commandCode(config: Interfaces.Config, c: Command.Cached): string | undefined;
|
|
20
14
|
commands(config: Interfaces.Config, commands: Command.Cached[]): string;
|
|
21
15
|
createTopicFile(file: string, config: Interfaces.Config, topic: Interfaces.Topic, commands: Command.Cached[]): void;
|
|
@@ -25,4 +19,10 @@ export default class Readme extends Command {
|
|
|
25
19
|
run(): Promise<void>;
|
|
26
20
|
toc(__: Interfaces.Config, readme: string): string;
|
|
27
21
|
usage(config: Interfaces.Config): string;
|
|
22
|
+
/**
|
|
23
|
+
* fetches the path to a command
|
|
24
|
+
*/
|
|
25
|
+
private commandPath;
|
|
26
|
+
private commandUsage;
|
|
27
|
+
private repo;
|
|
28
28
|
}
|
package/lib/commands/readme.js
CHANGED
|
@@ -31,78 +31,8 @@ Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
|
|
|
31
31
|
description: 'version to use in readme links. defaults to the version in package.json',
|
|
32
32
|
}),
|
|
33
33
|
};
|
|
34
|
-
HelpClass;
|
|
35
34
|
flags;
|
|
36
|
-
|
|
37
|
-
* fetches the path to a command
|
|
38
|
-
*/
|
|
39
|
-
commandPath(plugin, c) {
|
|
40
|
-
const commandsDir = plugin.pjson.oclif.commands;
|
|
41
|
-
if (!commandsDir)
|
|
42
|
-
return;
|
|
43
|
-
const hasTypescript = plugin.pjson.devDependencies?.typescript || plugin.pjson.dependencies?.typescript;
|
|
44
|
-
let p = path.join(plugin.root, commandsDir, ...c.id.split(':'));
|
|
45
|
-
const outDir = path.dirname(commandsDir.replace(`.${path.sep}`, ''));
|
|
46
|
-
const outDirRegex = new RegExp('^' + outDir + (path.sep === '\\' ? '\\\\' : path.sep));
|
|
47
|
-
if (fs.pathExistsSync(path.join(p, 'index.js'))) {
|
|
48
|
-
p = path.join(p, 'index.js');
|
|
49
|
-
}
|
|
50
|
-
else if (fs.pathExistsSync(p + '.js')) {
|
|
51
|
-
p += '.js';
|
|
52
|
-
}
|
|
53
|
-
else if (hasTypescript) {
|
|
54
|
-
// check if non-compiled scripts are available
|
|
55
|
-
const base = p.replace(plugin.root + path.sep, '');
|
|
56
|
-
p = path.join(plugin.root, base.replace(outDirRegex, 'src' + path.sep));
|
|
57
|
-
if (fs.pathExistsSync(path.join(p, 'index.ts'))) {
|
|
58
|
-
p = path.join(p, 'index.ts');
|
|
59
|
-
}
|
|
60
|
-
else if (fs.pathExistsSync(p + '.ts')) {
|
|
61
|
-
p += '.ts';
|
|
62
|
-
}
|
|
63
|
-
else
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
else
|
|
67
|
-
return;
|
|
68
|
-
p = p.replace(plugin.root + path.sep, '');
|
|
69
|
-
if (hasTypescript) {
|
|
70
|
-
p = p.replace(outDirRegex, 'src' + path.sep).replace(/\.js$/, '.ts');
|
|
71
|
-
}
|
|
72
|
-
p = p.replaceAll('\\', '/'); // Replace windows '\' by '/'
|
|
73
|
-
return p;
|
|
74
|
-
}
|
|
75
|
-
commandUsage(config, command) {
|
|
76
|
-
const arg = (arg) => {
|
|
77
|
-
const name = arg.name.toUpperCase();
|
|
78
|
-
if (arg.required)
|
|
79
|
-
return `${name}`;
|
|
80
|
-
return `[${name}]`;
|
|
81
|
-
};
|
|
82
|
-
const id = (0, core_1.toConfiguredId)(command.id, config);
|
|
83
|
-
const defaultUsage = () => (0, util_1.compact)([
|
|
84
|
-
id,
|
|
85
|
-
Object.values(command.args)
|
|
86
|
-
.filter((a) => !a.hidden)
|
|
87
|
-
.map((a) => arg(a))
|
|
88
|
-
.join(' '),
|
|
89
|
-
]).join(' ');
|
|
90
|
-
const usages = (0, util_1.castArray)(command.usage);
|
|
91
|
-
return (0, util_1.template)({ command, config })(usages.length === 0 ? defaultUsage() : usages[0]);
|
|
92
|
-
}
|
|
93
|
-
repo(plugin) {
|
|
94
|
-
const pjson = { ...plugin.pjson };
|
|
95
|
-
normalize(pjson);
|
|
96
|
-
const repo = pjson.repository && pjson.repository.url;
|
|
97
|
-
if (!repo)
|
|
98
|
-
return;
|
|
99
|
-
const url = new node_url_1.URL(repo);
|
|
100
|
-
if (!['github.com', 'gitlab.com'].includes(url.hostname) &&
|
|
101
|
-
!pjson.oclif.repositoryPrefix &&
|
|
102
|
-
!this.flags['repository-prefix'])
|
|
103
|
-
return;
|
|
104
|
-
return `https://${url.hostname}${url.pathname.replace(/\.git$/, '')}`;
|
|
105
|
-
}
|
|
35
|
+
HelpClass;
|
|
106
36
|
commandCode(config, c) {
|
|
107
37
|
const pluginName = c.pluginName;
|
|
108
38
|
if (!pluginName)
|
|
@@ -178,7 +108,7 @@ Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
|
|
|
178
108
|
}
|
|
179
109
|
renderCommand(config, c) {
|
|
180
110
|
this.debug('rendering command', c.id);
|
|
181
|
-
const title = (0, util_1.template)({ command: c, config })(c.summary
|
|
111
|
+
const title = (0, util_1.template)({ command: c, config })(c.summary ?? c.description ?? '')
|
|
182
112
|
.trim()
|
|
183
113
|
.split('\n')[0];
|
|
184
114
|
const help = new this.HelpClass(config, { maxWidth: columns, stripAnsi: true });
|
|
@@ -274,5 +204,75 @@ USAGE
|
|
|
274
204
|
.join('\n')
|
|
275
205
|
.trim();
|
|
276
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* fetches the path to a command
|
|
209
|
+
*/
|
|
210
|
+
commandPath(plugin, c) {
|
|
211
|
+
const commandsDir = plugin.pjson.oclif.commands;
|
|
212
|
+
if (!commandsDir)
|
|
213
|
+
return;
|
|
214
|
+
const hasTypescript = plugin.pjson.devDependencies?.typescript || plugin.pjson.dependencies?.typescript;
|
|
215
|
+
let p = path.join(plugin.root, commandsDir, ...c.id.split(':'));
|
|
216
|
+
const outDir = path.dirname(commandsDir.replace(`.${path.sep}`, ''));
|
|
217
|
+
const outDirRegex = new RegExp('^' + outDir + (path.sep === '\\' ? '\\\\' : path.sep));
|
|
218
|
+
if (fs.pathExistsSync(path.join(p, 'index.js'))) {
|
|
219
|
+
p = path.join(p, 'index.js');
|
|
220
|
+
}
|
|
221
|
+
else if (fs.pathExistsSync(p + '.js')) {
|
|
222
|
+
p += '.js';
|
|
223
|
+
}
|
|
224
|
+
else if (hasTypescript) {
|
|
225
|
+
// check if non-compiled scripts are available
|
|
226
|
+
const base = p.replace(plugin.root + path.sep, '');
|
|
227
|
+
p = path.join(plugin.root, base.replace(outDirRegex, 'src' + path.sep));
|
|
228
|
+
if (fs.pathExistsSync(path.join(p, 'index.ts'))) {
|
|
229
|
+
p = path.join(p, 'index.ts');
|
|
230
|
+
}
|
|
231
|
+
else if (fs.pathExistsSync(p + '.ts')) {
|
|
232
|
+
p += '.ts';
|
|
233
|
+
}
|
|
234
|
+
else
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
else
|
|
238
|
+
return;
|
|
239
|
+
p = p.replace(plugin.root + path.sep, '');
|
|
240
|
+
if (hasTypescript) {
|
|
241
|
+
p = p.replace(outDirRegex, 'src' + path.sep).replace(/\.js$/, '.ts');
|
|
242
|
+
}
|
|
243
|
+
p = p.replaceAll('\\', '/'); // Replace windows '\' by '/'
|
|
244
|
+
return p;
|
|
245
|
+
}
|
|
246
|
+
commandUsage(config, command) {
|
|
247
|
+
const arg = (arg) => {
|
|
248
|
+
const name = arg.name.toUpperCase();
|
|
249
|
+
if (arg.required)
|
|
250
|
+
return `${name}`;
|
|
251
|
+
return `[${name}]`;
|
|
252
|
+
};
|
|
253
|
+
const id = (0, core_1.toConfiguredId)(command.id, config);
|
|
254
|
+
const defaultUsage = () => (0, util_1.compact)([
|
|
255
|
+
id,
|
|
256
|
+
Object.values(command.args)
|
|
257
|
+
.filter((a) => !a.hidden)
|
|
258
|
+
.map((a) => arg(a))
|
|
259
|
+
.join(' '),
|
|
260
|
+
]).join(' ');
|
|
261
|
+
const usages = (0, util_1.castArray)(command.usage);
|
|
262
|
+
return (0, util_1.template)({ command, config })(usages.length === 0 ? defaultUsage() : usages[0]);
|
|
263
|
+
}
|
|
264
|
+
repo(plugin) {
|
|
265
|
+
const pjson = { ...plugin.pjson };
|
|
266
|
+
normalize(pjson);
|
|
267
|
+
const repo = pjson.repository && pjson.repository.url;
|
|
268
|
+
if (!repo)
|
|
269
|
+
return;
|
|
270
|
+
const url = new node_url_1.URL(repo);
|
|
271
|
+
if (!['github.com', 'gitlab.com'].includes(url.hostname) &&
|
|
272
|
+
!pjson.oclif.repositoryPrefix &&
|
|
273
|
+
!this.flags['repository-prefix'])
|
|
274
|
+
return;
|
|
275
|
+
return `https://${url.hostname}${url.pathname.replace(/\.git$/, '')}`;
|
|
276
|
+
}
|
|
277
277
|
}
|
|
278
278
|
exports.default = Readme;
|
package/lib/generators/cli.d.ts
CHANGED
|
@@ -33,8 +33,8 @@ export default class CLI extends Generator {
|
|
|
33
33
|
repository?: string;
|
|
34
34
|
yarn: boolean;
|
|
35
35
|
constructor(args: string | string[], opts: Generator.GeneratorOptions);
|
|
36
|
-
private _gitignore;
|
|
37
36
|
end(): void;
|
|
38
37
|
prompting(): Promise<void>;
|
|
39
38
|
writing(): void;
|
|
39
|
+
private _gitignore;
|
|
40
40
|
}
|
package/lib/generators/cli.js
CHANGED
|
@@ -30,23 +30,6 @@ class CLI extends Generator {
|
|
|
30
30
|
yarn: hasYarn,
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
_gitignore() {
|
|
34
|
-
const existing = this.fs.exists(this.destinationPath('.gitignore'))
|
|
35
|
-
? this.fs.read(this.destinationPath('.gitignore')).split('\n')
|
|
36
|
-
: [];
|
|
37
|
-
return ((0, util_1.uniq)((0, util_1.compact)([
|
|
38
|
-
'*-debug.log',
|
|
39
|
-
'*-error.log',
|
|
40
|
-
'node_modules',
|
|
41
|
-
'/tmp',
|
|
42
|
-
'/dist',
|
|
43
|
-
this.yarn ? '/package-lock.json' : '/yarn.lock',
|
|
44
|
-
'/lib',
|
|
45
|
-
...existing,
|
|
46
|
-
]))
|
|
47
|
-
.sort()
|
|
48
|
-
.join('\n') + '\n');
|
|
49
|
-
}
|
|
50
33
|
end() {
|
|
51
34
|
this.spawnCommandSync(this.env.options.nodePackageManager, ['run', 'build'], { cwd: this.env.cwd });
|
|
52
35
|
this.spawnCommandSync(path.join(this.env.cwd, 'node_modules', '.bin', 'oclif'), ['readme'], {
|
|
@@ -231,5 +214,22 @@ class CLI extends Generator {
|
|
|
231
214
|
this.fs.write(this.destinationPath('.gitignore'), this._gitignore());
|
|
232
215
|
this.fs.delete(this.destinationPath('LICENSE'));
|
|
233
216
|
}
|
|
217
|
+
_gitignore() {
|
|
218
|
+
const existing = this.fs.exists(this.destinationPath('.gitignore'))
|
|
219
|
+
? this.fs.read(this.destinationPath('.gitignore')).split('\n')
|
|
220
|
+
: [];
|
|
221
|
+
return ((0, util_1.uniq)((0, util_1.compact)([
|
|
222
|
+
'*-debug.log',
|
|
223
|
+
'*-error.log',
|
|
224
|
+
'node_modules',
|
|
225
|
+
'/tmp',
|
|
226
|
+
'/dist',
|
|
227
|
+
this.yarn ? '/package-lock.json' : '/yarn.lock',
|
|
228
|
+
'/lib',
|
|
229
|
+
...existing,
|
|
230
|
+
]))
|
|
231
|
+
.sort()
|
|
232
|
+
.join('\n') + '\n');
|
|
233
|
+
}
|
|
234
234
|
}
|
|
235
235
|
exports.default = CLI;
|
|
@@ -15,9 +15,6 @@ class Command extends Generator {
|
|
|
15
15
|
name: opts.name,
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
hasMocha() {
|
|
19
|
-
return Boolean(this.pjson.devDependencies?.mocha);
|
|
20
|
-
}
|
|
21
18
|
async prompting() {
|
|
22
19
|
this.pjson = this.fs.readJSON('package.json');
|
|
23
20
|
if (!this.pjson)
|
|
@@ -46,5 +43,8 @@ class Command extends Generator {
|
|
|
46
43
|
this.fs.copyTpl(this.templatePath('test/command.test.ts.ejs'), this.destinationPath(`test/commands/${cmdPath}.test.ts`), opts);
|
|
47
44
|
}
|
|
48
45
|
}
|
|
46
|
+
hasMocha() {
|
|
47
|
+
return Boolean(this.pjson.devDependencies?.mocha);
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
50
|
exports.default = Command;
|
package/lib/generators/hook.d.ts
CHANGED
package/lib/generators/hook.js
CHANGED
|
@@ -11,9 +11,6 @@ class Hook extends Generator {
|
|
|
11
11
|
super(args, options);
|
|
12
12
|
this.options = options;
|
|
13
13
|
}
|
|
14
|
-
hasMocha() {
|
|
15
|
-
return Boolean(this.pjson.devDependencies?.mocha);
|
|
16
|
-
}
|
|
17
14
|
async prompting() {
|
|
18
15
|
this.pjson = this.fs.readJSON('package.json');
|
|
19
16
|
this.pjson.oclif = this.pjson.oclif || {};
|
|
@@ -40,5 +37,8 @@ class Hook extends Generator {
|
|
|
40
37
|
}
|
|
41
38
|
this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson);
|
|
42
39
|
}
|
|
40
|
+
hasMocha() {
|
|
41
|
+
return Boolean(this.pjson.devDependencies?.mocha);
|
|
42
|
+
}
|
|
43
43
|
}
|
|
44
44
|
exports.default = Hook;
|