workon 1.4.0 → 2.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.
- package/.history/package_20250807114243.json +43 -0
- package/.history/package_20250807114257.json +43 -0
- package/.history/package_20250807114404.json +43 -0
- package/.history/package_20250807114409.json +43 -0
- package/.history/package_20250807114510.json +43 -0
- package/.history/package_20250807114637.json +43 -0
- package/CHANGELOG.md +15 -1
- package/cli/manage.js +29 -166
- package/cli/open.js +48 -103
- package/commands/base.js +105 -0
- package/commands/core/cwd/index.js +86 -0
- package/commands/core/ide/index.js +84 -0
- package/commands/core/web/index.js +109 -0
- package/commands/extensions/claude/index.js +211 -0
- package/commands/extensions/docker/index.js +167 -0
- package/commands/extensions/npm/index.js +208 -0
- package/commands/registry.js +196 -0
- package/docs/adr/001-command-centric-architecture.md +304 -0
- package/docs/adr/002-positional-command-arguments.md +396 -0
- package/lib/validation.js +14 -68
- package/package.json +2 -2
- package/test-architecture.js +145 -0
- package/test-registry.js +57 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workon",
|
|
3
|
+
"version": null,
|
|
4
|
+
"description": "Work on something great!",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"release": "standard-version"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"productivity"
|
|
15
|
+
],
|
|
16
|
+
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
+
"standard-version": "^4.2.0"
|
|
21
|
+
},
|
|
22
|
+
"config": {
|
|
23
|
+
"commitizen": {
|
|
24
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"conf": "^1.1.2",
|
|
29
|
+
"deep-assign": "^2.0.0",
|
|
30
|
+
"flat": "^2.0.1",
|
|
31
|
+
"inquirer": "^3.1.1",
|
|
32
|
+
"loog": "^1.4.0",
|
|
33
|
+
"omelette": "^0.4.4",
|
|
34
|
+
"openurl2": "^1.0.1",
|
|
35
|
+
"phylo": "^1.0.0-beta.7",
|
|
36
|
+
"simple-git": "^1.73.0",
|
|
37
|
+
"switchit": "^1.0.7"
|
|
38
|
+
},
|
|
39
|
+
"bin": {
|
|
40
|
+
"workon": "bin/workon",
|
|
41
|
+
"wo": "bin/workon"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workon",
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
|
+
"description": "Work on something great!",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"release": "standard-version"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"productivity"
|
|
15
|
+
],
|
|
16
|
+
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
+
"standard-version": "^4.2.0"
|
|
21
|
+
},
|
|
22
|
+
"config": {
|
|
23
|
+
"commitizen": {
|
|
24
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"conf": "^1.1.2",
|
|
29
|
+
"deep-assign": "^2.0.0",
|
|
30
|
+
"flat": "^2.0.1",
|
|
31
|
+
"inquirer": "^3.1.1",
|
|
32
|
+
"loog": "^1.4.0",
|
|
33
|
+
"omelette": "^0.4.4",
|
|
34
|
+
"openurl2": "^1.0.1",
|
|
35
|
+
"phylo": "^1.0.0-beta.7",
|
|
36
|
+
"simple-git": "^1.73.0",
|
|
37
|
+
"switchit": "^1.0.7"
|
|
38
|
+
},
|
|
39
|
+
"bin": {
|
|
40
|
+
"workon": "bin/workon",
|
|
41
|
+
"wo": "bin/workon"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workon",
|
|
3
|
+
"version": "",
|
|
4
|
+
"description": "Work on something great!",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"release": "standard-version"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"productivity"
|
|
15
|
+
],
|
|
16
|
+
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
+
"standard-version": "^4.2.0"
|
|
21
|
+
},
|
|
22
|
+
"config": {
|
|
23
|
+
"commitizen": {
|
|
24
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"conf": "^1.1.2",
|
|
29
|
+
"deep-assign": "^2.0.0",
|
|
30
|
+
"flat": "^2.0.1",
|
|
31
|
+
"inquirer": "^3.1.1",
|
|
32
|
+
"loog": "^1.4.0",
|
|
33
|
+
"omelette": "^0.4.4",
|
|
34
|
+
"openurl2": "^1.0.1",
|
|
35
|
+
"phylo": "^1.0.0-beta.7",
|
|
36
|
+
"simple-git": "^1.73.0",
|
|
37
|
+
"switchit": "^1.0.7"
|
|
38
|
+
},
|
|
39
|
+
"bin": {
|
|
40
|
+
"workon": "bin/workon",
|
|
41
|
+
"wo": "bin/workon"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workon",
|
|
3
|
+
"version": "",
|
|
4
|
+
"description": "Work on something great!",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"release": "standard-version"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"productivity"
|
|
15
|
+
],
|
|
16
|
+
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
+
"standard-version": "^4.2.0"
|
|
21
|
+
},
|
|
22
|
+
"config": {
|
|
23
|
+
"commitizen": {
|
|
24
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"conf": "^1.1.2",
|
|
29
|
+
"deep-assign": "^2.0.0",
|
|
30
|
+
"flat": "^2.0.1",
|
|
31
|
+
"inquirer": "^3.1.1",
|
|
32
|
+
"loog": "^1.4.0",
|
|
33
|
+
"omelette": "^0.4.4",
|
|
34
|
+
"openurl2": "^1.0.1",
|
|
35
|
+
"phylo": "^1.0.0-beta.7",
|
|
36
|
+
"simple-git": "^1.73.0",
|
|
37
|
+
"switchit": "^1.0.7"
|
|
38
|
+
},
|
|
39
|
+
"bin": {
|
|
40
|
+
"workon": "bin/workon",
|
|
41
|
+
"wo": "bin/workon"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workon",
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "Work on something great!",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"release": "standard-version"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"productivity"
|
|
15
|
+
],
|
|
16
|
+
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
+
"standard-version": "^4.2.0"
|
|
21
|
+
},
|
|
22
|
+
"config": {
|
|
23
|
+
"commitizen": {
|
|
24
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"conf": "^1.1.2",
|
|
29
|
+
"deep-assign": "^2.0.0",
|
|
30
|
+
"flat": "^2.0.1",
|
|
31
|
+
"inquirer": "^3.1.1",
|
|
32
|
+
"loog": "^1.4.0",
|
|
33
|
+
"omelette": "^0.4.4",
|
|
34
|
+
"openurl2": "^1.0.1",
|
|
35
|
+
"phylo": "^1.0.0-beta.7",
|
|
36
|
+
"simple-git": "^1.73.0",
|
|
37
|
+
"switchit": "^1.0.7"
|
|
38
|
+
},
|
|
39
|
+
"bin": {
|
|
40
|
+
"workon": "bin/workon",
|
|
41
|
+
"wo": "bin/workon"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workon",
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
|
+
"description": "Work on something great!",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"release": "standard-version"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+ssh://git@github.com/israelroldan/workon.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"productivity"
|
|
15
|
+
],
|
|
16
|
+
"author": "Israel Roldan (me@isro.me)",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"cz-conventional-changelog": "^2.0.0",
|
|
20
|
+
"standard-version": "^9.5.0"
|
|
21
|
+
},
|
|
22
|
+
"config": {
|
|
23
|
+
"commitizen": {
|
|
24
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"conf": "^1.1.2",
|
|
29
|
+
"deep-assign": "^2.0.0",
|
|
30
|
+
"flat": "^2.0.1",
|
|
31
|
+
"inquirer": "^3.1.1",
|
|
32
|
+
"loog": "^1.4.0",
|
|
33
|
+
"omelette": "^0.4.4",
|
|
34
|
+
"openurl2": "^1.0.1",
|
|
35
|
+
"phylo": "^1.0.0-beta.7",
|
|
36
|
+
"simple-git": "^1.73.0",
|
|
37
|
+
"switchit": "^1.0.7"
|
|
38
|
+
},
|
|
39
|
+
"bin": {
|
|
40
|
+
"workon": "bin/workon",
|
|
41
|
+
"wo": "bin/workon"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.0.0](https://github.com/israelroldan/workon/compare/v2.0.0-alpha.1...v2.0.0) (2025-08-07)
|
|
6
|
+
|
|
7
|
+
## [2.0.0-alpha.1](https://github.com/israelroldan/workon/compare/v1.4.1...v2.0.0-alpha.1) (2025-08-07)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* Refactor to Command-Centric Architecture and enhance command management ([b7f8478](https://github.com/israelroldan/workon/commit/b7f84789e677222af34ae2018b7eb452dd054e34))
|
|
13
|
+
|
|
14
|
+
<a name="1.4.1"></a>
|
|
15
|
+
## [1.4.1](https://github.com/israelroldan/workon/compare/v1.4.0...v1.4.1) (2025-08-07)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
5
19
|
<a name="1.4.0"></a>
|
|
6
20
|
# [1.4.0](https://github.com/israelroldan/workon/compare/v1.3.0...v1.4.0) (2025-08-06)
|
|
7
21
|
|
package/cli/manage.js
CHANGED
|
@@ -3,11 +3,16 @@ const inquirer = require('inquirer');
|
|
|
3
3
|
const File = require('phylo');
|
|
4
4
|
const ProjectValidator = require('../lib/validation');
|
|
5
5
|
const path = require('path');
|
|
6
|
+
const registry = require('../commands/registry');
|
|
6
7
|
|
|
7
8
|
class manage extends command {
|
|
8
|
-
execute(params) {
|
|
9
|
+
async execute(params) {
|
|
9
10
|
let me = this;
|
|
10
11
|
me.validator = new ProjectValidator(me.config);
|
|
12
|
+
|
|
13
|
+
// Initialize command registry
|
|
14
|
+
await registry.initialize();
|
|
15
|
+
|
|
11
16
|
me.showLogo();
|
|
12
17
|
return me.startManagement();
|
|
13
18
|
}
|
|
@@ -123,13 +128,11 @@ class manage extends command {
|
|
|
123
128
|
type: 'checkbox',
|
|
124
129
|
name: 'events',
|
|
125
130
|
message: 'Select events to enable:',
|
|
126
|
-
choices:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
{ name: 'Run NPM command', value: 'npm' }
|
|
132
|
-
]
|
|
131
|
+
choices: registry.getCommandsForManageUI().map(cmd => ({
|
|
132
|
+
name: cmd.name,
|
|
133
|
+
value: cmd.value,
|
|
134
|
+
checked: ['cwd', 'ide'].includes(cmd.value) // Default enable cwd and ide
|
|
135
|
+
}))
|
|
133
136
|
}
|
|
134
137
|
];
|
|
135
138
|
|
|
@@ -138,14 +141,10 @@ class manage extends command {
|
|
|
138
141
|
// Convert events array to object and configure advanced options
|
|
139
142
|
const events = {};
|
|
140
143
|
for (const event of answers.events) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
events[event] =
|
|
145
|
-
} else if (event === 'npm') {
|
|
146
|
-
// Ask for NPM-specific configuration
|
|
147
|
-
const npmConfig = await me.configureNpmEvent();
|
|
148
|
-
events[event] = npmConfig;
|
|
144
|
+
const command = registry.getCommandByName(event);
|
|
145
|
+
if (command && command.configuration) {
|
|
146
|
+
const config = await command.configuration.configureInteractive();
|
|
147
|
+
events[event] = config;
|
|
149
148
|
} else {
|
|
150
149
|
events[event] = 'true';
|
|
151
150
|
}
|
|
@@ -248,13 +247,11 @@ class manage extends command {
|
|
|
248
247
|
type: 'checkbox',
|
|
249
248
|
name: 'events',
|
|
250
249
|
message: 'Select events to enable:',
|
|
251
|
-
choices:
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
{ name: 'Run NPM command', value: 'npm', checked: currentEvents.includes('npm') }
|
|
257
|
-
]
|
|
250
|
+
choices: registry.getCommandsForManageUI().map(cmd => ({
|
|
251
|
+
name: cmd.name,
|
|
252
|
+
value: cmd.value,
|
|
253
|
+
checked: currentEvents.includes(cmd.value)
|
|
254
|
+
}))
|
|
258
255
|
}
|
|
259
256
|
];
|
|
260
257
|
|
|
@@ -263,43 +260,25 @@ class manage extends command {
|
|
|
263
260
|
// Convert events array to object and configure advanced options
|
|
264
261
|
const events = {};
|
|
265
262
|
for (const event of answers.events) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
type: 'confirm',
|
|
272
|
-
name: 'keep',
|
|
273
|
-
message: 'Keep existing Claude configuration?',
|
|
274
|
-
default: true
|
|
275
|
-
}]);
|
|
276
|
-
|
|
277
|
-
if (keepConfig.keep) {
|
|
278
|
-
events[event] = existingClaudeConfig;
|
|
279
|
-
} else {
|
|
280
|
-
events[event] = await me.configureClaudeEvent();
|
|
281
|
-
}
|
|
282
|
-
} else {
|
|
283
|
-
events[event] = await me.configureClaudeEvent();
|
|
284
|
-
}
|
|
285
|
-
} else if (event === 'npm') {
|
|
286
|
-
// If npm was previously configured with advanced options, preserve or update them
|
|
287
|
-
const existingNpmConfig = project.events && project.events.npm;
|
|
288
|
-
if (existingNpmConfig && typeof existingNpmConfig === 'object') {
|
|
263
|
+
const command = registry.getCommandByName(event);
|
|
264
|
+
if (command && command.configuration) {
|
|
265
|
+
// Check if there's existing configuration to preserve
|
|
266
|
+
const existingConfig = project.events && project.events[event];
|
|
267
|
+
if (existingConfig && typeof existingConfig === 'object') {
|
|
289
268
|
const keepConfig = await inquirer.prompt([{
|
|
290
269
|
type: 'confirm',
|
|
291
270
|
name: 'keep',
|
|
292
|
-
message:
|
|
271
|
+
message: `Keep existing ${command.metadata.displayName} configuration?`,
|
|
293
272
|
default: true
|
|
294
273
|
}]);
|
|
295
274
|
|
|
296
275
|
if (keepConfig.keep) {
|
|
297
|
-
events[event] =
|
|
276
|
+
events[event] = existingConfig;
|
|
298
277
|
} else {
|
|
299
|
-
events[event] = await
|
|
278
|
+
events[event] = await command.configuration.configureInteractive();
|
|
300
279
|
}
|
|
301
280
|
} else {
|
|
302
|
-
events[event] = await
|
|
281
|
+
events[event] = await command.configuration.configureInteractive();
|
|
303
282
|
}
|
|
304
283
|
} else {
|
|
305
284
|
events[event] = 'true';
|
|
@@ -424,122 +403,6 @@ class manage extends command {
|
|
|
424
403
|
}
|
|
425
404
|
}
|
|
426
405
|
|
|
427
|
-
async configureClaudeEvent() {
|
|
428
|
-
let me = this;
|
|
429
|
-
|
|
430
|
-
me.log.log('\n⚙️ Configure Claude Event\n');
|
|
431
|
-
|
|
432
|
-
const claudeQuestions = [
|
|
433
|
-
{
|
|
434
|
-
type: 'confirm',
|
|
435
|
-
name: 'useAdvanced',
|
|
436
|
-
message: 'Configure advanced Claude options?',
|
|
437
|
-
default: false
|
|
438
|
-
}
|
|
439
|
-
];
|
|
440
|
-
|
|
441
|
-
const claudeAnswer = await inquirer.prompt(claudeQuestions);
|
|
442
|
-
|
|
443
|
-
if (!claudeAnswer.useAdvanced) {
|
|
444
|
-
return 'true';
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
const advancedQuestions = [
|
|
448
|
-
{
|
|
449
|
-
type: 'input',
|
|
450
|
-
name: 'flags',
|
|
451
|
-
message: 'Claude flags (comma-separated, e.g. --resume,--debug):',
|
|
452
|
-
filter: (input) => {
|
|
453
|
-
if (!input.trim()) return [];
|
|
454
|
-
return input.split(',').map(flag => flag.trim()).filter(flag => flag);
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
type: 'confirm',
|
|
459
|
-
name: 'split_terminal',
|
|
460
|
-
message: 'Enable split terminal (Claude + shell side-by-side with tmux)?',
|
|
461
|
-
default: false
|
|
462
|
-
}
|
|
463
|
-
];
|
|
464
|
-
|
|
465
|
-
const advancedAnswers = await inquirer.prompt(advancedQuestions);
|
|
466
|
-
|
|
467
|
-
const config = {};
|
|
468
|
-
|
|
469
|
-
if (advancedAnswers.flags && advancedAnswers.flags.length > 0) {
|
|
470
|
-
config.flags = advancedAnswers.flags;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
if (advancedAnswers.split_terminal) {
|
|
474
|
-
config.split_terminal = true;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
return config;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
async configureNpmEvent() {
|
|
481
|
-
let me = this;
|
|
482
|
-
|
|
483
|
-
me.log.log('\n📦 Configure NPM Event\n');
|
|
484
|
-
|
|
485
|
-
const npmQuestions = [
|
|
486
|
-
{
|
|
487
|
-
type: 'input',
|
|
488
|
-
name: 'command',
|
|
489
|
-
message: 'NPM script to run (e.g., dev, start, test):',
|
|
490
|
-
default: 'dev',
|
|
491
|
-
validate: (value) => {
|
|
492
|
-
if (!value.trim()) {
|
|
493
|
-
return 'NPM command cannot be empty';
|
|
494
|
-
}
|
|
495
|
-
return true;
|
|
496
|
-
}
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
type: 'confirm',
|
|
500
|
-
name: 'useAdvanced',
|
|
501
|
-
message: 'Configure advanced NPM options?',
|
|
502
|
-
default: false
|
|
503
|
-
}
|
|
504
|
-
];
|
|
505
|
-
|
|
506
|
-
const basicAnswers = await inquirer.prompt(npmQuestions);
|
|
507
|
-
|
|
508
|
-
if (!basicAnswers.useAdvanced) {
|
|
509
|
-
return basicAnswers.command;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
const advancedQuestions = [
|
|
513
|
-
{
|
|
514
|
-
type: 'confirm',
|
|
515
|
-
name: 'watch',
|
|
516
|
-
message: 'Enable watch mode (if supported by command)?',
|
|
517
|
-
default: true
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
type: 'confirm',
|
|
521
|
-
name: 'auto_restart',
|
|
522
|
-
message: 'Auto-restart on crashes?',
|
|
523
|
-
default: false
|
|
524
|
-
}
|
|
525
|
-
];
|
|
526
|
-
|
|
527
|
-
const advancedAnswers = await inquirer.prompt(advancedQuestions);
|
|
528
|
-
|
|
529
|
-
const config = {
|
|
530
|
-
command: basicAnswers.command
|
|
531
|
-
};
|
|
532
|
-
|
|
533
|
-
if (advancedAnswers.watch) {
|
|
534
|
-
config.watch = true;
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
if (advancedAnswers.auto_restart) {
|
|
538
|
-
config.auto_restart = true;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
return config;
|
|
542
|
-
}
|
|
543
406
|
}
|
|
544
407
|
|
|
545
408
|
manage.define({
|