@jujulego/jill 2.5.2 → 3.0.0-alpha.1
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/dist/commands/exec.d.ts +1 -1
- package/dist/commons/logger/thread.gateway.d.ts +0 -1
- package/dist/{core.plugin-Bxu0Sx70.js → core.plugin-CxgfxFUI.js} +184 -184
- package/dist/{core.plugin-Bxu0Sx70.js.map → core.plugin-CxgfxFUI.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/{ink-command-S3TpJLFi.js → ink-command-CsbkuRbm.js} +108 -119
- package/dist/ink-command-CsbkuRbm.js.map +1 -0
- package/dist/inversify.config.d.ts +1 -1
- package/dist/{jill.application-CGujSe1_.js → jill.application-DNJpmnCF.js} +67 -69
- package/dist/{jill.application-CGujSe1_.js.map → jill.application-DNJpmnCF.js.map} +1 -1
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/json.d.ts +0 -1
- package/dist/utils/worker-cache.d.ts +0 -1
- package/dist/{workspace-tree-CyjZrimj.js → workspace-tree-VWKE0B6b.js} +117 -117
- package/dist/{workspace-tree-CyjZrimj.js.map → workspace-tree-VWKE0B6b.js.map} +1 -1
- package/package.json +26 -28
- package/dist/ink-command-S3TpJLFi.js.map +0 -1
package/dist/commands/exec.d.ts
CHANGED
|
@@ -21,6 +21,6 @@ export declare class ExecCommand extends TaskCommand<IExecCommandArgs> {
|
|
|
21
21
|
} & {
|
|
22
22
|
"deps-mode": "all";
|
|
23
23
|
}>;
|
|
24
|
-
prepare(args: ArgumentsCamelCase<IExecCommandArgs & ITaskCommandArgs>): AsyncGenerator<import("@jujulego/tasks").Task<import("@jujulego/tasks").TaskContext>, void,
|
|
24
|
+
prepare(args: ArgumentsCamelCase<IExecCommandArgs & ITaskCommandArgs>): AsyncGenerator<import("@jujulego/tasks").Task<import("@jujulego/tasks").TaskContext>, void, unknown>;
|
|
25
25
|
handler(args: ArgumentsCamelCase<IExecCommandArgs & ITaskCommandArgs>): Promise<void>;
|
|
26
26
|
}
|
|
@@ -3,9 +3,9 @@ import { _ as _$1 } from '@swc/helpers/_/_ts_param';
|
|
|
3
3
|
import { Logger, withLabel } from '@jujulego/logger';
|
|
4
4
|
import { inject } from 'inversify';
|
|
5
5
|
import symbols from 'log-symbols';
|
|
6
|
-
import { b as LazyCurrentProject, L as LoadProject, T as TaskExpressionService, k as TaskExpressionError, l as TaskSyntaxError, S as ScriptsFilter, a as PrivateFilter, A as AffectedFilter, P as Pipeline, d as LazyCurrentWorkspace, c as LoadWorkspace, W as WorkspaceTree, f as Plugin } from './workspace-tree-
|
|
7
|
-
import { f as Command, E as ExitException, I as InkCommand, y as printJson, a as List } from './ink-command-
|
|
8
|
-
import { T as TaskCommand } from './jill.application-
|
|
6
|
+
import { b as LazyCurrentProject, L as LoadProject, T as TaskExpressionService, k as TaskExpressionError, l as TaskSyntaxError, S as ScriptsFilter, a as PrivateFilter, A as AffectedFilter, P as Pipeline, d as LazyCurrentWorkspace, c as LoadWorkspace, W as WorkspaceTree, f as Plugin } from './workspace-tree-VWKE0B6b.js';
|
|
7
|
+
import { f as Command, E as ExitException, I as InkCommand, y as printJson, a as List } from './ink-command-CsbkuRbm.js';
|
|
8
|
+
import { T as TaskCommand } from './jill.application-DNJpmnCF.js';
|
|
9
9
|
import cp from 'node:child_process';
|
|
10
10
|
import process$1 from 'node:process';
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -48,49 +48,49 @@ class EachCommand extends TaskCommand {
|
|
|
48
48
|
// Methods
|
|
49
49
|
builder(parser) {
|
|
50
50
|
return this.addTaskOptions(parser)// Run options
|
|
51
|
-
.positional(
|
|
52
|
-
type:
|
|
51
|
+
.positional('expr', {
|
|
52
|
+
type: 'string',
|
|
53
53
|
demandOption: true,
|
|
54
|
-
desc:
|
|
55
|
-
}).option(
|
|
56
|
-
default:
|
|
57
|
-
desc:
|
|
58
|
-
}).option(
|
|
59
|
-
alias:
|
|
54
|
+
desc: 'Script or task expression'
|
|
55
|
+
}).option('build-script', {
|
|
56
|
+
default: 'build',
|
|
57
|
+
desc: 'Script to use to build dependencies'
|
|
58
|
+
}).option('deps-mode', {
|
|
59
|
+
alias: 'd',
|
|
60
60
|
choice: [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
'all',
|
|
62
|
+
'prod',
|
|
63
|
+
'none'
|
|
64
64
|
],
|
|
65
|
-
default:
|
|
66
|
-
desc:
|
|
67
|
-
}).option(
|
|
68
|
-
type:
|
|
65
|
+
default: 'all',
|
|
66
|
+
desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
|
|
67
|
+
}).option('allow-no-workspaces', {
|
|
68
|
+
type: 'boolean',
|
|
69
69
|
default: false,
|
|
70
|
-
desc:
|
|
70
|
+
desc: 'Allow no matching workspaces. Without it jill will exit with code 1 if no workspace matches'
|
|
71
71
|
})// Filters
|
|
72
|
-
.option(
|
|
73
|
-
type:
|
|
74
|
-
group:
|
|
75
|
-
desc:
|
|
76
|
-
}).option(
|
|
77
|
-
alias:
|
|
78
|
-
type:
|
|
79
|
-
coerce: (rev)=>rev ===
|
|
80
|
-
group:
|
|
81
|
-
desc:
|
|
82
|
-
}).option(
|
|
83
|
-
type:
|
|
84
|
-
group:
|
|
85
|
-
desc:
|
|
86
|
-
}).option(
|
|
87
|
-
type:
|
|
88
|
-
default:
|
|
89
|
-
group:
|
|
90
|
-
desc:
|
|
72
|
+
.option('private', {
|
|
73
|
+
type: 'boolean',
|
|
74
|
+
group: 'Filters:',
|
|
75
|
+
desc: 'Print only private workspaces'
|
|
76
|
+
}).option('affected', {
|
|
77
|
+
alias: 'a',
|
|
78
|
+
type: 'string',
|
|
79
|
+
coerce: (rev)=>rev === '' ? 'master' : rev,
|
|
80
|
+
group: 'Filters:',
|
|
81
|
+
desc: 'Print only affected workspaces towards given git revision. If no revision is given, it will check towards master. Replaces %name by workspace name.'
|
|
82
|
+
}).option('affected-rev-sort', {
|
|
83
|
+
type: 'string',
|
|
84
|
+
group: 'Filters:',
|
|
85
|
+
desc: 'Sort applied to git tag / git branch command'
|
|
86
|
+
}).option('affected-rev-fallback', {
|
|
87
|
+
type: 'string',
|
|
88
|
+
default: 'master',
|
|
89
|
+
group: 'Filters:',
|
|
90
|
+
desc: 'Fallback revision, used if no revision matching the given format is found'
|
|
91
91
|
})// Config
|
|
92
92
|
.strict(false).parserConfiguration({
|
|
93
|
-
|
|
93
|
+
'unknown-options-as-args': true
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
async *prepare(argv) {
|
|
@@ -98,11 +98,11 @@ class EachCommand extends TaskCommand {
|
|
|
98
98
|
try {
|
|
99
99
|
// Extract expression
|
|
100
100
|
const expr = argv._.map((arg)=>arg.toString());
|
|
101
|
-
if (expr[0] ===
|
|
101
|
+
if (expr[0] === 'each') {
|
|
102
102
|
expr.splice(0, 1);
|
|
103
103
|
}
|
|
104
104
|
expr.unshift(argv.expr);
|
|
105
|
-
const tree = this.taskExpression.parse(expr.join(
|
|
105
|
+
const tree = this.taskExpression.parse(expr.join(' '));
|
|
106
106
|
const scripts = Array.from(this.taskExpression.extractScripts(tree));
|
|
107
107
|
// Create script tasks
|
|
108
108
|
const pipeline = this._preparePipeline(argv, scripts);
|
|
@@ -151,8 +151,8 @@ _([
|
|
|
151
151
|
], EachCommand.prototype, "project", void 0);
|
|
152
152
|
EachCommand = _([
|
|
153
153
|
Command({
|
|
154
|
-
command:
|
|
155
|
-
describe:
|
|
154
|
+
command: 'each <expr>',
|
|
155
|
+
describe: 'Run a task expression in many workspace, after having built all theirs dependencies.',
|
|
156
156
|
middlewares: [
|
|
157
157
|
LoadProject
|
|
158
158
|
]
|
|
@@ -165,35 +165,35 @@ class ExecCommand extends TaskCommand {
|
|
|
165
165
|
// Constructor
|
|
166
166
|
constructor(logger){
|
|
167
167
|
super();
|
|
168
|
-
this._logger = logger.child(withLabel(
|
|
168
|
+
this._logger = logger.child(withLabel('exec'));
|
|
169
169
|
}
|
|
170
170
|
// Methods
|
|
171
171
|
builder(parser) {
|
|
172
|
-
return this.addTaskOptions(parser).positional(
|
|
173
|
-
type:
|
|
172
|
+
return this.addTaskOptions(parser).positional('command', {
|
|
173
|
+
type: 'string',
|
|
174
174
|
demandOption: true
|
|
175
|
-
}).option(
|
|
176
|
-
default:
|
|
177
|
-
desc:
|
|
178
|
-
}).option(
|
|
179
|
-
alias:
|
|
175
|
+
}).option('build-script', {
|
|
176
|
+
default: 'build',
|
|
177
|
+
desc: 'Script to use to build dependencies'
|
|
178
|
+
}).option('deps-mode', {
|
|
179
|
+
alias: 'd',
|
|
180
180
|
choice: [
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
'all',
|
|
182
|
+
'prod',
|
|
183
|
+
'none'
|
|
184
184
|
],
|
|
185
|
-
default:
|
|
186
|
-
desc:
|
|
185
|
+
default: 'all',
|
|
186
|
+
desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
|
|
187
187
|
})// Documentation
|
|
188
|
-
.example(
|
|
188
|
+
.example('jill eslint', '').example('jill eslint --env-info', 'Unknown arguments are passed down to command. Here it would run eslint --env-info').example('jill eslint -- -v', 'You can use -- to stop argument parsing. Here it would run eslint -v')// Config
|
|
189
189
|
.strict(false).parserConfiguration({
|
|
190
|
-
|
|
190
|
+
'unknown-options-as-args': true
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
async *prepare(args) {
|
|
194
194
|
// Extract arguments
|
|
195
195
|
const rest = args._.map((arg)=>arg.toString());
|
|
196
|
-
if (rest[0] ===
|
|
196
|
+
if (rest[0] === 'exec') {
|
|
197
197
|
rest.splice(0, 1);
|
|
198
198
|
}
|
|
199
199
|
// Run script in workspace
|
|
@@ -213,9 +213,9 @@ class ExecCommand extends TaskCommand {
|
|
|
213
213
|
if (!args.plan) {
|
|
214
214
|
this.app.unmount();
|
|
215
215
|
// Execute command
|
|
216
|
-
this._logger.debug`${this._finalTask.cmd} ${this._finalTask.args.join(
|
|
216
|
+
this._logger.debug`${this._finalTask.cmd} ${this._finalTask.args.join(' ')}`;
|
|
217
217
|
const child = cp.spawn(this._finalTask.cmd, this._finalTask.args, {
|
|
218
|
-
stdio:
|
|
218
|
+
stdio: 'inherit',
|
|
219
219
|
cwd: this._finalTask.cwd,
|
|
220
220
|
env: {
|
|
221
221
|
...process$1.env,
|
|
@@ -225,7 +225,7 @@ class ExecCommand extends TaskCommand {
|
|
|
225
225
|
windowsHide: true
|
|
226
226
|
});
|
|
227
227
|
const code = await new Promise((resolve)=>{
|
|
228
|
-
child.on(
|
|
228
|
+
child.on('close', (code)=>{
|
|
229
229
|
resolve(code ?? 0);
|
|
230
230
|
});
|
|
231
231
|
});
|
|
@@ -243,11 +243,11 @@ _([
|
|
|
243
243
|
], ExecCommand.prototype, "workspace", void 0);
|
|
244
244
|
ExecCommand = _([
|
|
245
245
|
Command({
|
|
246
|
-
command:
|
|
246
|
+
command: 'exec <command>',
|
|
247
247
|
aliases: [
|
|
248
|
-
|
|
248
|
+
'$0'
|
|
249
249
|
],
|
|
250
|
-
describe:
|
|
250
|
+
describe: 'Run command inside workspace, after all its dependencies has been built.',
|
|
251
251
|
middlewares: [
|
|
252
252
|
LoadProject,
|
|
253
253
|
LoadWorkspace
|
|
@@ -264,22 +264,22 @@ class GroupCommand extends TaskCommand {
|
|
|
264
264
|
}
|
|
265
265
|
// Methods
|
|
266
266
|
builder(parser) {
|
|
267
|
-
return this.addTaskOptions(parser).positional(
|
|
267
|
+
return this.addTaskOptions(parser).positional('script', {
|
|
268
268
|
demandOption: true,
|
|
269
|
-
desc:
|
|
270
|
-
coerce: (expr)=>this.taskExpr.parse(expr.join(
|
|
271
|
-
}).option(
|
|
272
|
-
default:
|
|
273
|
-
desc:
|
|
274
|
-
}).option(
|
|
275
|
-
alias:
|
|
269
|
+
desc: 'Task expression',
|
|
270
|
+
coerce: (expr)=>this.taskExpr.parse(expr.join(' '))
|
|
271
|
+
}).option('build-script', {
|
|
272
|
+
default: 'build',
|
|
273
|
+
desc: 'Script to use to build dependencies'
|
|
274
|
+
}).option('deps-mode', {
|
|
275
|
+
alias: 'd',
|
|
276
276
|
choice: [
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
277
|
+
'all',
|
|
278
|
+
'prod',
|
|
279
|
+
'none'
|
|
280
280
|
],
|
|
281
|
-
default:
|
|
282
|
-
desc:
|
|
281
|
+
default: 'all',
|
|
282
|
+
desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
async *prepare(args) {
|
|
@@ -296,8 +296,8 @@ _([
|
|
|
296
296
|
], GroupCommand.prototype, "workspace", void 0);
|
|
297
297
|
GroupCommand = _([
|
|
298
298
|
Command({
|
|
299
|
-
command:
|
|
300
|
-
describe:
|
|
299
|
+
command: 'group <script..>',
|
|
300
|
+
describe: 'Run many scripts inside a workspace (experimental)',
|
|
301
301
|
deprecated: true,
|
|
302
302
|
middlewares: [
|
|
303
303
|
LoadProject,
|
|
@@ -309,30 +309,30 @@ GroupCommand = _([
|
|
|
309
309
|
|
|
310
310
|
// Constants
|
|
311
311
|
const LONG_ATTRIBUTES = [
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
'name',
|
|
313
|
+
'version',
|
|
314
|
+
'root'
|
|
315
315
|
];
|
|
316
316
|
const JSON_ATTRIBUTES = [
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
317
|
+
'name',
|
|
318
|
+
'version',
|
|
319
|
+
'slug',
|
|
320
|
+
'root'
|
|
321
321
|
];
|
|
322
322
|
const DEFAULT_ATTRIBUTES = [
|
|
323
|
-
|
|
323
|
+
'name'
|
|
324
324
|
];
|
|
325
325
|
const EXTRACTORS = {
|
|
326
326
|
name: (wks)=>wks.name,
|
|
327
|
-
version: (wks, json)=>wks.manifest.version || (json ? undefined : chalk.grey(
|
|
327
|
+
version: (wks, json)=>wks.manifest.version || (json ? undefined : chalk.grey('unset')),
|
|
328
328
|
root: (wks)=>wks.cwd,
|
|
329
329
|
slug: (wks)=>slugify.default(wks.name)
|
|
330
330
|
};
|
|
331
331
|
const COMPARATORS = {
|
|
332
|
-
name: (a =
|
|
333
|
-
version: (a, b)=>compare(parse(a) ??
|
|
334
|
-
root: (a =
|
|
335
|
-
slug: (a =
|
|
332
|
+
name: (a = '', b = '')=>a.localeCompare(b),
|
|
333
|
+
version: (a, b)=>compare(parse(a) ?? '0.0.0', parse(b) ?? '0.0.0'),
|
|
334
|
+
root: (a = '', b = '')=>a.localeCompare(b),
|
|
335
|
+
slug: (a = '', b = '')=>a.localeCompare(b)
|
|
336
336
|
};
|
|
337
337
|
// Utils
|
|
338
338
|
function buildExtractor(attrs) {
|
|
@@ -353,76 +353,76 @@ class ListCommand extends InkCommand {
|
|
|
353
353
|
// Methods
|
|
354
354
|
builder(parser) {
|
|
355
355
|
return parser// Filters
|
|
356
|
-
.option(
|
|
357
|
-
type:
|
|
358
|
-
group:
|
|
359
|
-
desc:
|
|
360
|
-
}).option(
|
|
361
|
-
type:
|
|
356
|
+
.option('private', {
|
|
357
|
+
type: 'boolean',
|
|
358
|
+
group: 'Filters:',
|
|
359
|
+
desc: 'Print only private workspaces'
|
|
360
|
+
}).option('with-script', {
|
|
361
|
+
type: 'array',
|
|
362
362
|
string: true,
|
|
363
|
-
group:
|
|
364
|
-
desc:
|
|
365
|
-
}).option(
|
|
366
|
-
alias:
|
|
367
|
-
type:
|
|
368
|
-
coerce: (rev)=>rev ===
|
|
369
|
-
group:
|
|
370
|
-
desc:
|
|
371
|
-
}).option(
|
|
372
|
-
type:
|
|
373
|
-
group:
|
|
374
|
-
desc:
|
|
375
|
-
}).option(
|
|
376
|
-
type:
|
|
377
|
-
default:
|
|
378
|
-
group:
|
|
379
|
-
desc:
|
|
363
|
+
group: 'Filters:',
|
|
364
|
+
desc: 'Print only workspaces having the given script'
|
|
365
|
+
}).option('affected', {
|
|
366
|
+
alias: 'a',
|
|
367
|
+
type: 'string',
|
|
368
|
+
coerce: (rev)=>rev === '' ? 'master' : rev,
|
|
369
|
+
group: 'Filters:',
|
|
370
|
+
desc: 'Print only affected workspaces towards given git revision. If no revision is given, it will check towards master. Replaces %name by workspace name.'
|
|
371
|
+
}).option('affected-rev-sort', {
|
|
372
|
+
type: 'string',
|
|
373
|
+
group: 'Filters:',
|
|
374
|
+
desc: 'Sort applied to git tag / git branch command'
|
|
375
|
+
}).option('affected-rev-fallback', {
|
|
376
|
+
type: 'string',
|
|
377
|
+
default: 'master',
|
|
378
|
+
group: 'Filters:',
|
|
379
|
+
desc: 'Fallback revision, used if no revision matching the given format is found'
|
|
380
380
|
})// Format
|
|
381
|
-
.option(
|
|
382
|
-
type:
|
|
381
|
+
.option('attrs', {
|
|
382
|
+
type: 'array',
|
|
383
383
|
choices: [
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
384
|
+
'name',
|
|
385
|
+
'version',
|
|
386
|
+
'root',
|
|
387
|
+
'slug'
|
|
388
388
|
],
|
|
389
|
-
group:
|
|
390
|
-
desc:
|
|
391
|
-
}).option(
|
|
392
|
-
type:
|
|
393
|
-
group:
|
|
394
|
-
desc:
|
|
395
|
-
}).option(
|
|
396
|
-
alias:
|
|
397
|
-
type:
|
|
398
|
-
group:
|
|
399
|
-
desc:
|
|
400
|
-
}).option(
|
|
401
|
-
type:
|
|
402
|
-
group:
|
|
403
|
-
desc:
|
|
389
|
+
group: 'Format:',
|
|
390
|
+
desc: 'Select printed attributes'
|
|
391
|
+
}).option('headers', {
|
|
392
|
+
type: 'boolean',
|
|
393
|
+
group: 'Format:',
|
|
394
|
+
desc: 'Prints columns headers'
|
|
395
|
+
}).option('long', {
|
|
396
|
+
alias: 'l',
|
|
397
|
+
type: 'boolean',
|
|
398
|
+
group: 'Format:',
|
|
399
|
+
desc: 'Prints name, version and root of all workspaces'
|
|
400
|
+
}).option('json', {
|
|
401
|
+
type: 'boolean',
|
|
402
|
+
group: 'Format:',
|
|
403
|
+
desc: 'Prints data as a JSON array'
|
|
404
404
|
})// Sort
|
|
405
|
-
.option(
|
|
406
|
-
alias:
|
|
407
|
-
type:
|
|
405
|
+
.option('sort-by', {
|
|
406
|
+
alias: 's',
|
|
407
|
+
type: 'array',
|
|
408
408
|
choices: [
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
409
|
+
'name',
|
|
410
|
+
'version',
|
|
411
|
+
'root',
|
|
412
|
+
'slug'
|
|
413
413
|
],
|
|
414
|
-
group:
|
|
415
|
-
desc:
|
|
416
|
-
}).option(
|
|
417
|
-
alias:
|
|
418
|
-
type:
|
|
414
|
+
group: 'Sort:',
|
|
415
|
+
desc: 'Sort output by given attribute. By default sorts by name if printed'
|
|
416
|
+
}).option('order', {
|
|
417
|
+
alias: 'o',
|
|
418
|
+
type: 'string',
|
|
419
419
|
choices: [
|
|
420
|
-
|
|
421
|
-
|
|
420
|
+
'asc',
|
|
421
|
+
'desc'
|
|
422
422
|
],
|
|
423
|
-
default:
|
|
424
|
-
group:
|
|
425
|
-
desc:
|
|
423
|
+
default: 'asc',
|
|
424
|
+
group: 'Sort:',
|
|
425
|
+
desc: 'Sort order'
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
428
|
async *render(args) {
|
|
@@ -444,7 +444,7 @@ class ListCommand extends InkCommand {
|
|
|
444
444
|
} else {
|
|
445
445
|
for (const d of data){
|
|
446
446
|
if (d.root) {
|
|
447
|
-
d.root = path.relative(process.cwd(), d.root) ||
|
|
447
|
+
d.root = path.relative(process.cwd(), d.root) || '.';
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
yield /*#__PURE__*/ jsx(List, {
|
|
@@ -470,13 +470,13 @@ class ListCommand extends InkCommand {
|
|
|
470
470
|
if (attrs.length > 0 && sortBy.length > 0) {
|
|
471
471
|
const miss = sortBy.filter((attr)=>!attrs.includes(attr));
|
|
472
472
|
if (miss.length > 0) {
|
|
473
|
-
this.logger.error(`Cannot sort by non printed attributes. Missing ${miss.join(
|
|
473
|
+
this.logger.error(`Cannot sort by non printed attributes. Missing ${miss.join(', ')}.`);
|
|
474
474
|
throw new ExitException(1);
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
if (sortBy.length === 0 && attrs.includes(
|
|
477
|
+
if (sortBy.length === 0 && attrs.includes('name')) {
|
|
478
478
|
sortBy = [
|
|
479
|
-
|
|
479
|
+
'name'
|
|
480
480
|
];
|
|
481
481
|
}
|
|
482
482
|
return {
|
|
@@ -498,7 +498,7 @@ class ListCommand extends InkCommand {
|
|
|
498
498
|
return pipeline;
|
|
499
499
|
}
|
|
500
500
|
_dataComparator(sortBy, order) {
|
|
501
|
-
const factor = order ===
|
|
501
|
+
const factor = order === 'asc' ? 1 : -1;
|
|
502
502
|
return (a, b)=>{
|
|
503
503
|
for (const attr of sortBy){
|
|
504
504
|
const diff = COMPARATORS[attr](a[attr], b[attr]);
|
|
@@ -515,11 +515,11 @@ _([
|
|
|
515
515
|
], ListCommand.prototype, "project", void 0);
|
|
516
516
|
ListCommand = _([
|
|
517
517
|
Command({
|
|
518
|
-
command:
|
|
518
|
+
command: 'list',
|
|
519
519
|
aliases: [
|
|
520
|
-
|
|
520
|
+
'ls'
|
|
521
521
|
],
|
|
522
|
-
describe:
|
|
522
|
+
describe: 'List workspace',
|
|
523
523
|
middlewares: [
|
|
524
524
|
LoadProject
|
|
525
525
|
]
|
|
@@ -536,37 +536,37 @@ class RunCommand extends TaskCommand {
|
|
|
536
536
|
}
|
|
537
537
|
// Methods
|
|
538
538
|
builder(parser) {
|
|
539
|
-
return this.addTaskOptions(parser).positional(
|
|
540
|
-
type:
|
|
539
|
+
return this.addTaskOptions(parser).positional('expr', {
|
|
540
|
+
type: 'string',
|
|
541
541
|
demandOption: true,
|
|
542
|
-
desc:
|
|
543
|
-
}).option(
|
|
544
|
-
default:
|
|
545
|
-
desc:
|
|
546
|
-
}).option(
|
|
547
|
-
alias:
|
|
542
|
+
desc: 'Script or task expression'
|
|
543
|
+
}).option('build-script', {
|
|
544
|
+
default: 'build',
|
|
545
|
+
desc: 'Script to use to build dependencies'
|
|
546
|
+
}).option('deps-mode', {
|
|
547
|
+
alias: 'd',
|
|
548
548
|
choice: [
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
549
|
+
'all',
|
|
550
|
+
'prod',
|
|
551
|
+
'none'
|
|
552
552
|
],
|
|
553
|
-
default:
|
|
554
|
-
desc:
|
|
553
|
+
default: 'all',
|
|
554
|
+
desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
|
|
555
555
|
})// Config
|
|
556
556
|
.strict(false).parserConfiguration({
|
|
557
|
-
|
|
557
|
+
'unknown-options-as-args': true
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
560
|
async *prepare(args) {
|
|
561
561
|
// Extract expression
|
|
562
562
|
const expr = args._.map((arg)=>arg.toString());
|
|
563
|
-
if (expr[0] ===
|
|
563
|
+
if (expr[0] === 'run') {
|
|
564
564
|
expr.splice(0, 1);
|
|
565
565
|
}
|
|
566
566
|
expr.unshift(args.expr);
|
|
567
567
|
// Parse task expression
|
|
568
568
|
try {
|
|
569
|
-
const tree = this.taskExpression.parse(expr.join(
|
|
569
|
+
const tree = this.taskExpression.parse(expr.join(' '));
|
|
570
570
|
yield await this.taskExpression.buildTask(tree.roots[0], this.workspace, {
|
|
571
571
|
buildScript: args.buildScript,
|
|
572
572
|
buildDeps: args.depsMode
|
|
@@ -589,8 +589,8 @@ _([
|
|
|
589
589
|
], RunCommand.prototype, "workspace", void 0);
|
|
590
590
|
RunCommand = _([
|
|
591
591
|
Command({
|
|
592
|
-
command:
|
|
593
|
-
describe:
|
|
592
|
+
command: 'run <expr>',
|
|
593
|
+
describe: 'Run a task expression in a workspace, after having built all its dependencies.',
|
|
594
594
|
middlewares: [
|
|
595
595
|
LoadProject,
|
|
596
596
|
LoadWorkspace
|
|
@@ -613,8 +613,8 @@ _([
|
|
|
613
613
|
], TreeCommand.prototype, "workspace", void 0);
|
|
614
614
|
TreeCommand = _([
|
|
615
615
|
Command({
|
|
616
|
-
command:
|
|
617
|
-
describe:
|
|
616
|
+
command: 'tree',
|
|
617
|
+
describe: 'Print workspace dependency tree',
|
|
618
618
|
middlewares: [
|
|
619
619
|
LoadProject,
|
|
620
620
|
LoadWorkspace
|
|
@@ -626,7 +626,7 @@ class CorePlugin {
|
|
|
626
626
|
}
|
|
627
627
|
CorePlugin = _([
|
|
628
628
|
Plugin({
|
|
629
|
-
name:
|
|
629
|
+
name: 'core',
|
|
630
630
|
commands: [
|
|
631
631
|
EachCommand,
|
|
632
632
|
ExecCommand,
|
|
@@ -639,4 +639,4 @@ CorePlugin = _([
|
|
|
639
639
|
], CorePlugin);
|
|
640
640
|
|
|
641
641
|
export { CorePlugin };
|
|
642
|
-
//# sourceMappingURL=core.plugin-
|
|
642
|
+
//# sourceMappingURL=core.plugin-CxgfxFUI.js.map
|