@jujulego/jill 2.5.1 → 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 +3 -2
- package/dist/commons/logger/thread.gateway.d.ts +0 -1
- package/dist/{core.plugin-D4KeO5G0.js → core.plugin-CxgfxFUI.js} +202 -215
- package/dist/core.plugin-CxgfxFUI.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{ink-command-dQCqkmg0.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-BEjmcH4e.js → jill.application-DNJpmnCF.js} +71 -70
- package/dist/jill.application-DNJpmnCF.js.map +1 -0
- 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-BJ9EO1FB.js → workspace-tree-VWKE0B6b.js} +117 -117
- package/dist/{workspace-tree-BJ9EO1FB.js.map → workspace-tree-VWKE0B6b.js.map} +1 -1
- package/package.json +26 -28
- package/dist/core.plugin-D4KeO5G0.js.map +0 -1
- package/dist/ink-command-dQCqkmg0.js.map +0 -1
- package/dist/jill.application-BEjmcH4e.js.map +0 -1
|
@@ -3,10 +3,11 @@ 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,
|
|
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
|
+
import process$1 from 'node:process';
|
|
10
11
|
import { jsx } from 'react/jsx-runtime';
|
|
11
12
|
import chalk from 'chalk';
|
|
12
13
|
import path from 'node:path';
|
|
@@ -47,49 +48,49 @@ class EachCommand extends TaskCommand {
|
|
|
47
48
|
// Methods
|
|
48
49
|
builder(parser) {
|
|
49
50
|
return this.addTaskOptions(parser)// Run options
|
|
50
|
-
.positional(
|
|
51
|
-
type:
|
|
51
|
+
.positional('expr', {
|
|
52
|
+
type: 'string',
|
|
52
53
|
demandOption: true,
|
|
53
|
-
desc:
|
|
54
|
-
}).option(
|
|
55
|
-
default:
|
|
56
|
-
desc:
|
|
57
|
-
}).option(
|
|
58
|
-
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',
|
|
59
60
|
choice: [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
'all',
|
|
62
|
+
'prod',
|
|
63
|
+
'none'
|
|
63
64
|
],
|
|
64
|
-
default:
|
|
65
|
-
desc:
|
|
66
|
-
}).option(
|
|
67
|
-
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',
|
|
68
69
|
default: false,
|
|
69
|
-
desc:
|
|
70
|
+
desc: 'Allow no matching workspaces. Without it jill will exit with code 1 if no workspace matches'
|
|
70
71
|
})// Filters
|
|
71
|
-
.option(
|
|
72
|
-
type:
|
|
73
|
-
group:
|
|
74
|
-
desc:
|
|
75
|
-
}).option(
|
|
76
|
-
alias:
|
|
77
|
-
type:
|
|
78
|
-
coerce: (rev)=>rev ===
|
|
79
|
-
group:
|
|
80
|
-
desc:
|
|
81
|
-
}).option(
|
|
82
|
-
type:
|
|
83
|
-
group:
|
|
84
|
-
desc:
|
|
85
|
-
}).option(
|
|
86
|
-
type:
|
|
87
|
-
default:
|
|
88
|
-
group:
|
|
89
|
-
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'
|
|
90
91
|
})// Config
|
|
91
92
|
.strict(false).parserConfiguration({
|
|
92
|
-
|
|
93
|
+
'unknown-options-as-args': true
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
async *prepare(argv) {
|
|
@@ -97,11 +98,11 @@ class EachCommand extends TaskCommand {
|
|
|
97
98
|
try {
|
|
98
99
|
// Extract expression
|
|
99
100
|
const expr = argv._.map((arg)=>arg.toString());
|
|
100
|
-
if (expr[0] ===
|
|
101
|
+
if (expr[0] === 'each') {
|
|
101
102
|
expr.splice(0, 1);
|
|
102
103
|
}
|
|
103
104
|
expr.unshift(argv.expr);
|
|
104
|
-
const tree = this.taskExpression.parse(expr.join(
|
|
105
|
+
const tree = this.taskExpression.parse(expr.join(' '));
|
|
105
106
|
const scripts = Array.from(this.taskExpression.extractScripts(tree));
|
|
106
107
|
// Create script tasks
|
|
107
108
|
const pipeline = this._preparePipeline(argv, scripts);
|
|
@@ -150,8 +151,8 @@ _([
|
|
|
150
151
|
], EachCommand.prototype, "project", void 0);
|
|
151
152
|
EachCommand = _([
|
|
152
153
|
Command({
|
|
153
|
-
command:
|
|
154
|
-
describe:
|
|
154
|
+
command: 'each <expr>',
|
|
155
|
+
describe: 'Run a task expression in many workspace, after having built all theirs dependencies.',
|
|
155
156
|
middlewares: [
|
|
156
157
|
LoadProject
|
|
157
158
|
]
|
|
@@ -164,81 +165,67 @@ class ExecCommand extends TaskCommand {
|
|
|
164
165
|
// Constructor
|
|
165
166
|
constructor(logger){
|
|
166
167
|
super();
|
|
167
|
-
this._logger = logger.child(withLabel(
|
|
168
|
+
this._logger = logger.child(withLabel('exec'));
|
|
168
169
|
}
|
|
169
170
|
// Methods
|
|
170
171
|
builder(parser) {
|
|
171
|
-
return this.addTaskOptions(parser).positional(
|
|
172
|
-
type:
|
|
172
|
+
return this.addTaskOptions(parser).positional('command', {
|
|
173
|
+
type: 'string',
|
|
173
174
|
demandOption: true
|
|
174
|
-
}).option(
|
|
175
|
-
default:
|
|
176
|
-
desc:
|
|
177
|
-
}).option(
|
|
178
|
-
alias:
|
|
175
|
+
}).option('build-script', {
|
|
176
|
+
default: 'build',
|
|
177
|
+
desc: 'Script to use to build dependencies'
|
|
178
|
+
}).option('deps-mode', {
|
|
179
|
+
alias: 'd',
|
|
179
180
|
choice: [
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
'all',
|
|
182
|
+
'prod',
|
|
183
|
+
'none'
|
|
183
184
|
],
|
|
184
|
-
default:
|
|
185
|
-
desc:
|
|
185
|
+
default: 'all',
|
|
186
|
+
desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
|
|
186
187
|
})// Documentation
|
|
187
|
-
.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
|
|
188
189
|
.strict(false).parserConfiguration({
|
|
189
|
-
|
|
190
|
+
'unknown-options-as-args': true
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
193
|
async *prepare(args) {
|
|
193
|
-
//
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
generators.unshift(this.workspace.devDependencies());
|
|
198
|
-
// eslint-disable-next no-fallthrough
|
|
199
|
-
case "prod":
|
|
200
|
-
generators.unshift(this.workspace.dependencies());
|
|
194
|
+
// Extract arguments
|
|
195
|
+
const rest = args._.map((arg)=>arg.toString());
|
|
196
|
+
if (rest[0] === 'exec') {
|
|
197
|
+
rest.splice(0, 1);
|
|
201
198
|
}
|
|
202
|
-
//
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
199
|
+
// Run script in workspace
|
|
200
|
+
const task = await this.workspace.exec(args.command, rest, {
|
|
201
|
+
buildScript: args.buildScript,
|
|
202
|
+
buildDeps: args.depsMode
|
|
203
|
+
});
|
|
204
|
+
if (args.plan) {
|
|
205
|
+
yield task;
|
|
206
|
+
} else {
|
|
207
|
+
this._finalTask = task;
|
|
208
|
+
yield* task.dependencies;
|
|
211
209
|
}
|
|
212
210
|
}
|
|
213
211
|
async handler(args) {
|
|
214
212
|
await super.handler(args);
|
|
215
213
|
if (!args.plan) {
|
|
216
214
|
this.app.unmount();
|
|
217
|
-
// Extract arguments
|
|
218
|
-
const rest = args._.map((arg)=>arg.toString());
|
|
219
|
-
if (rest[0] === "exec") {
|
|
220
|
-
rest.splice(0, 1);
|
|
221
|
-
}
|
|
222
215
|
// Execute command
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
rest.unshift("exec", args.command);
|
|
228
|
-
}
|
|
229
|
-
this._logger.debug`${command} ${rest.join(" ")}`;
|
|
230
|
-
const child = cp.spawn(command, rest, {
|
|
231
|
-
stdio: "inherit",
|
|
232
|
-
cwd: this.workspace.cwd,
|
|
216
|
+
this._logger.debug`${this._finalTask.cmd} ${this._finalTask.args.join(' ')}`;
|
|
217
|
+
const child = cp.spawn(this._finalTask.cmd, this._finalTask.args, {
|
|
218
|
+
stdio: 'inherit',
|
|
219
|
+
cwd: this._finalTask.cwd,
|
|
233
220
|
env: {
|
|
234
|
-
...process.env,
|
|
235
|
-
|
|
221
|
+
...process$1.env,
|
|
222
|
+
...this._finalTask.env
|
|
236
223
|
},
|
|
237
224
|
shell: true,
|
|
238
225
|
windowsHide: true
|
|
239
226
|
});
|
|
240
227
|
const code = await new Promise((resolve)=>{
|
|
241
|
-
child.on(
|
|
228
|
+
child.on('close', (code)=>{
|
|
242
229
|
resolve(code ?? 0);
|
|
243
230
|
});
|
|
244
231
|
});
|
|
@@ -256,11 +243,11 @@ _([
|
|
|
256
243
|
], ExecCommand.prototype, "workspace", void 0);
|
|
257
244
|
ExecCommand = _([
|
|
258
245
|
Command({
|
|
259
|
-
command:
|
|
246
|
+
command: 'exec <command>',
|
|
260
247
|
aliases: [
|
|
261
|
-
|
|
248
|
+
'$0'
|
|
262
249
|
],
|
|
263
|
-
describe:
|
|
250
|
+
describe: 'Run command inside workspace, after all its dependencies has been built.',
|
|
264
251
|
middlewares: [
|
|
265
252
|
LoadProject,
|
|
266
253
|
LoadWorkspace
|
|
@@ -277,22 +264,22 @@ class GroupCommand extends TaskCommand {
|
|
|
277
264
|
}
|
|
278
265
|
// Methods
|
|
279
266
|
builder(parser) {
|
|
280
|
-
return this.addTaskOptions(parser).positional(
|
|
267
|
+
return this.addTaskOptions(parser).positional('script', {
|
|
281
268
|
demandOption: true,
|
|
282
|
-
desc:
|
|
283
|
-
coerce: (expr)=>this.taskExpr.parse(expr.join(
|
|
284
|
-
}).option(
|
|
285
|
-
default:
|
|
286
|
-
desc:
|
|
287
|
-
}).option(
|
|
288
|
-
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',
|
|
289
276
|
choice: [
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
277
|
+
'all',
|
|
278
|
+
'prod',
|
|
279
|
+
'none'
|
|
293
280
|
],
|
|
294
|
-
default:
|
|
295
|
-
desc:
|
|
281
|
+
default: 'all',
|
|
282
|
+
desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
|
|
296
283
|
});
|
|
297
284
|
}
|
|
298
285
|
async *prepare(args) {
|
|
@@ -309,8 +296,8 @@ _([
|
|
|
309
296
|
], GroupCommand.prototype, "workspace", void 0);
|
|
310
297
|
GroupCommand = _([
|
|
311
298
|
Command({
|
|
312
|
-
command:
|
|
313
|
-
describe:
|
|
299
|
+
command: 'group <script..>',
|
|
300
|
+
describe: 'Run many scripts inside a workspace (experimental)',
|
|
314
301
|
deprecated: true,
|
|
315
302
|
middlewares: [
|
|
316
303
|
LoadProject,
|
|
@@ -322,30 +309,30 @@ GroupCommand = _([
|
|
|
322
309
|
|
|
323
310
|
// Constants
|
|
324
311
|
const LONG_ATTRIBUTES = [
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
312
|
+
'name',
|
|
313
|
+
'version',
|
|
314
|
+
'root'
|
|
328
315
|
];
|
|
329
316
|
const JSON_ATTRIBUTES = [
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
317
|
+
'name',
|
|
318
|
+
'version',
|
|
319
|
+
'slug',
|
|
320
|
+
'root'
|
|
334
321
|
];
|
|
335
322
|
const DEFAULT_ATTRIBUTES = [
|
|
336
|
-
|
|
323
|
+
'name'
|
|
337
324
|
];
|
|
338
325
|
const EXTRACTORS = {
|
|
339
326
|
name: (wks)=>wks.name,
|
|
340
|
-
version: (wks, json)=>wks.manifest.version || (json ? undefined : chalk.grey(
|
|
327
|
+
version: (wks, json)=>wks.manifest.version || (json ? undefined : chalk.grey('unset')),
|
|
341
328
|
root: (wks)=>wks.cwd,
|
|
342
329
|
slug: (wks)=>slugify.default(wks.name)
|
|
343
330
|
};
|
|
344
331
|
const COMPARATORS = {
|
|
345
|
-
name: (a =
|
|
346
|
-
version: (a, b)=>compare(parse(a) ??
|
|
347
|
-
root: (a =
|
|
348
|
-
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)
|
|
349
336
|
};
|
|
350
337
|
// Utils
|
|
351
338
|
function buildExtractor(attrs) {
|
|
@@ -366,76 +353,76 @@ class ListCommand extends InkCommand {
|
|
|
366
353
|
// Methods
|
|
367
354
|
builder(parser) {
|
|
368
355
|
return parser// Filters
|
|
369
|
-
.option(
|
|
370
|
-
type:
|
|
371
|
-
group:
|
|
372
|
-
desc:
|
|
373
|
-
}).option(
|
|
374
|
-
type:
|
|
356
|
+
.option('private', {
|
|
357
|
+
type: 'boolean',
|
|
358
|
+
group: 'Filters:',
|
|
359
|
+
desc: 'Print only private workspaces'
|
|
360
|
+
}).option('with-script', {
|
|
361
|
+
type: 'array',
|
|
375
362
|
string: true,
|
|
376
|
-
group:
|
|
377
|
-
desc:
|
|
378
|
-
}).option(
|
|
379
|
-
alias:
|
|
380
|
-
type:
|
|
381
|
-
coerce: (rev)=>rev ===
|
|
382
|
-
group:
|
|
383
|
-
desc:
|
|
384
|
-
}).option(
|
|
385
|
-
type:
|
|
386
|
-
group:
|
|
387
|
-
desc:
|
|
388
|
-
}).option(
|
|
389
|
-
type:
|
|
390
|
-
default:
|
|
391
|
-
group:
|
|
392
|
-
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'
|
|
393
380
|
})// Format
|
|
394
|
-
.option(
|
|
395
|
-
type:
|
|
381
|
+
.option('attrs', {
|
|
382
|
+
type: 'array',
|
|
396
383
|
choices: [
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
384
|
+
'name',
|
|
385
|
+
'version',
|
|
386
|
+
'root',
|
|
387
|
+
'slug'
|
|
401
388
|
],
|
|
402
|
-
group:
|
|
403
|
-
desc:
|
|
404
|
-
}).option(
|
|
405
|
-
type:
|
|
406
|
-
group:
|
|
407
|
-
desc:
|
|
408
|
-
}).option(
|
|
409
|
-
alias:
|
|
410
|
-
type:
|
|
411
|
-
group:
|
|
412
|
-
desc:
|
|
413
|
-
}).option(
|
|
414
|
-
type:
|
|
415
|
-
group:
|
|
416
|
-
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'
|
|
417
404
|
})// Sort
|
|
418
|
-
.option(
|
|
419
|
-
alias:
|
|
420
|
-
type:
|
|
405
|
+
.option('sort-by', {
|
|
406
|
+
alias: 's',
|
|
407
|
+
type: 'array',
|
|
421
408
|
choices: [
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
409
|
+
'name',
|
|
410
|
+
'version',
|
|
411
|
+
'root',
|
|
412
|
+
'slug'
|
|
426
413
|
],
|
|
427
|
-
group:
|
|
428
|
-
desc:
|
|
429
|
-
}).option(
|
|
430
|
-
alias:
|
|
431
|
-
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',
|
|
432
419
|
choices: [
|
|
433
|
-
|
|
434
|
-
|
|
420
|
+
'asc',
|
|
421
|
+
'desc'
|
|
435
422
|
],
|
|
436
|
-
default:
|
|
437
|
-
group:
|
|
438
|
-
desc:
|
|
423
|
+
default: 'asc',
|
|
424
|
+
group: 'Sort:',
|
|
425
|
+
desc: 'Sort order'
|
|
439
426
|
});
|
|
440
427
|
}
|
|
441
428
|
async *render(args) {
|
|
@@ -457,7 +444,7 @@ class ListCommand extends InkCommand {
|
|
|
457
444
|
} else {
|
|
458
445
|
for (const d of data){
|
|
459
446
|
if (d.root) {
|
|
460
|
-
d.root = path.relative(process.cwd(), d.root) ||
|
|
447
|
+
d.root = path.relative(process.cwd(), d.root) || '.';
|
|
461
448
|
}
|
|
462
449
|
}
|
|
463
450
|
yield /*#__PURE__*/ jsx(List, {
|
|
@@ -483,13 +470,13 @@ class ListCommand extends InkCommand {
|
|
|
483
470
|
if (attrs.length > 0 && sortBy.length > 0) {
|
|
484
471
|
const miss = sortBy.filter((attr)=>!attrs.includes(attr));
|
|
485
472
|
if (miss.length > 0) {
|
|
486
|
-
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(', ')}.`);
|
|
487
474
|
throw new ExitException(1);
|
|
488
475
|
}
|
|
489
476
|
}
|
|
490
|
-
if (sortBy.length === 0 && attrs.includes(
|
|
477
|
+
if (sortBy.length === 0 && attrs.includes('name')) {
|
|
491
478
|
sortBy = [
|
|
492
|
-
|
|
479
|
+
'name'
|
|
493
480
|
];
|
|
494
481
|
}
|
|
495
482
|
return {
|
|
@@ -511,7 +498,7 @@ class ListCommand extends InkCommand {
|
|
|
511
498
|
return pipeline;
|
|
512
499
|
}
|
|
513
500
|
_dataComparator(sortBy, order) {
|
|
514
|
-
const factor = order ===
|
|
501
|
+
const factor = order === 'asc' ? 1 : -1;
|
|
515
502
|
return (a, b)=>{
|
|
516
503
|
for (const attr of sortBy){
|
|
517
504
|
const diff = COMPARATORS[attr](a[attr], b[attr]);
|
|
@@ -528,11 +515,11 @@ _([
|
|
|
528
515
|
], ListCommand.prototype, "project", void 0);
|
|
529
516
|
ListCommand = _([
|
|
530
517
|
Command({
|
|
531
|
-
command:
|
|
518
|
+
command: 'list',
|
|
532
519
|
aliases: [
|
|
533
|
-
|
|
520
|
+
'ls'
|
|
534
521
|
],
|
|
535
|
-
describe:
|
|
522
|
+
describe: 'List workspace',
|
|
536
523
|
middlewares: [
|
|
537
524
|
LoadProject
|
|
538
525
|
]
|
|
@@ -549,37 +536,37 @@ class RunCommand extends TaskCommand {
|
|
|
549
536
|
}
|
|
550
537
|
// Methods
|
|
551
538
|
builder(parser) {
|
|
552
|
-
return this.addTaskOptions(parser).positional(
|
|
553
|
-
type:
|
|
539
|
+
return this.addTaskOptions(parser).positional('expr', {
|
|
540
|
+
type: 'string',
|
|
554
541
|
demandOption: true,
|
|
555
|
-
desc:
|
|
556
|
-
}).option(
|
|
557
|
-
default:
|
|
558
|
-
desc:
|
|
559
|
-
}).option(
|
|
560
|
-
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',
|
|
561
548
|
choice: [
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
549
|
+
'all',
|
|
550
|
+
'prod',
|
|
551
|
+
'none'
|
|
565
552
|
],
|
|
566
|
-
default:
|
|
567
|
-
desc:
|
|
553
|
+
default: 'all',
|
|
554
|
+
desc: 'Dependency selection mode:\n' + ' - all = dependencies AND devDependencies\n' + ' - prod = dependencies\n' + ' - none = nothing'
|
|
568
555
|
})// Config
|
|
569
556
|
.strict(false).parserConfiguration({
|
|
570
|
-
|
|
557
|
+
'unknown-options-as-args': true
|
|
571
558
|
});
|
|
572
559
|
}
|
|
573
560
|
async *prepare(args) {
|
|
574
561
|
// Extract expression
|
|
575
562
|
const expr = args._.map((arg)=>arg.toString());
|
|
576
|
-
if (expr[0] ===
|
|
563
|
+
if (expr[0] === 'run') {
|
|
577
564
|
expr.splice(0, 1);
|
|
578
565
|
}
|
|
579
566
|
expr.unshift(args.expr);
|
|
580
567
|
// Parse task expression
|
|
581
568
|
try {
|
|
582
|
-
const tree = this.taskExpression.parse(expr.join(
|
|
569
|
+
const tree = this.taskExpression.parse(expr.join(' '));
|
|
583
570
|
yield await this.taskExpression.buildTask(tree.roots[0], this.workspace, {
|
|
584
571
|
buildScript: args.buildScript,
|
|
585
572
|
buildDeps: args.depsMode
|
|
@@ -602,8 +589,8 @@ _([
|
|
|
602
589
|
], RunCommand.prototype, "workspace", void 0);
|
|
603
590
|
RunCommand = _([
|
|
604
591
|
Command({
|
|
605
|
-
command:
|
|
606
|
-
describe:
|
|
592
|
+
command: 'run <expr>',
|
|
593
|
+
describe: 'Run a task expression in a workspace, after having built all its dependencies.',
|
|
607
594
|
middlewares: [
|
|
608
595
|
LoadProject,
|
|
609
596
|
LoadWorkspace
|
|
@@ -626,8 +613,8 @@ _([
|
|
|
626
613
|
], TreeCommand.prototype, "workspace", void 0);
|
|
627
614
|
TreeCommand = _([
|
|
628
615
|
Command({
|
|
629
|
-
command:
|
|
630
|
-
describe:
|
|
616
|
+
command: 'tree',
|
|
617
|
+
describe: 'Print workspace dependency tree',
|
|
631
618
|
middlewares: [
|
|
632
619
|
LoadProject,
|
|
633
620
|
LoadWorkspace
|
|
@@ -639,7 +626,7 @@ class CorePlugin {
|
|
|
639
626
|
}
|
|
640
627
|
CorePlugin = _([
|
|
641
628
|
Plugin({
|
|
642
|
-
name:
|
|
629
|
+
name: 'core',
|
|
643
630
|
commands: [
|
|
644
631
|
EachCommand,
|
|
645
632
|
ExecCommand,
|
|
@@ -652,4 +639,4 @@ CorePlugin = _([
|
|
|
652
639
|
], CorePlugin);
|
|
653
640
|
|
|
654
641
|
export { CorePlugin };
|
|
655
|
-
//# sourceMappingURL=core.plugin-
|
|
642
|
+
//# sourceMappingURL=core.plugin-CxgfxFUI.js.map
|