@jujulego/jill 3.0.0-alpha.2 → 3.0.0-alpha.3
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 +1 -2
- package/bin/jill.js +1 -0
- package/dist/TaskName.js +1 -1
- package/dist/TaskName.js.map +1 -1
- package/dist/inked.js +31 -27
- package/dist/inked.js.map +1 -1
- package/dist/instrument.js +8 -0
- package/dist/instrument.js.map +1 -0
- package/dist/list.ink.js +8 -7
- package/dist/list.ink.js.map +1 -1
- package/dist/main.js +37 -10
- package/dist/main.js.map +1 -1
- package/dist/parser.js +285 -60
- package/dist/parser.js.map +1 -1
- package/dist/planner.service.js +20 -8
- package/dist/planner.service.js.map +1 -1
- package/dist/task-exec.ink.js +9 -8
- package/dist/task-exec.ink.js.map +1 -1
- package/dist/task-plan.ink.js +8 -7
- package/dist/task-plan.ink.js.map +1 -1
- package/dist/tree.ink.js +8 -7
- package/dist/tree.ink.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -8
package/dist/parser.js
CHANGED
|
@@ -1,30 +1,88 @@
|
|
|
1
|
-
import { TaskManager, plan, SpawnTask, GroupTask, TaskSet, ParallelGroup, FallbackGroup, SequenceGroup } from '@jujulego/tasks';
|
|
1
|
+
;{try{(function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="870e33b2-51a5-4b3d-aff5-43027ce19814",e._sentryDebugIdIdentifier="sentry-dbid-870e33b2-51a5-4b3d-aff5-43027ce19814");})();}catch(e){}};!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"3.0.0-alpha.3"};}catch(e){}}();import { TaskManager, plan, SpawnTask, GroupTask, TaskSet, ParallelGroup, FallbackGroup, SequenceGroup } from '@jujulego/tasks';
|
|
2
2
|
import { token$, inject$, asyncScope$ } from '@kyrielle/injector';
|
|
3
|
-
import { waitFor$, filter$, observable$, off$, once$,
|
|
4
|
-
import { logger$, withTimestamp, withLabel,
|
|
3
|
+
import { pipe$, waitFor$, filter$, observable$, off$, once$, map$, collect$, asyncIterator$, var$, flow$ } from 'kyrielle';
|
|
4
|
+
import { logger$, withTimestamp, withLabel, qLogDelay, LogLevel, LogGateway, logDelay$, toStderr } from '@kyrielle/logger';
|
|
5
|
+
import { startSpan, getActiveSpan, updateSpanName, getRootSpan, startInactiveSpan } from '@sentry/node';
|
|
5
6
|
import path from 'node:path';
|
|
6
|
-
import { Glob } from 'glob';
|
|
7
|
-
import fs from 'node:fs';
|
|
8
|
-
import normalize from 'normalize-package-data';
|
|
9
|
-
import { satisfies, compare, parse } from 'semver';
|
|
10
|
-
import moo from 'moo';
|
|
11
7
|
import cp from 'node:child_process';
|
|
12
8
|
import process$1 from 'node:process';
|
|
13
9
|
import chalk from 'chalk';
|
|
10
|
+
import { satisfies, compare, parse } from 'semver';
|
|
14
11
|
import slugify from 'slugify';
|
|
15
12
|
import yargs from 'yargs';
|
|
16
|
-
import
|
|
13
|
+
import fs from 'node:fs';
|
|
17
14
|
import { PathScurry } from 'path-scurry';
|
|
18
|
-
import {
|
|
15
|
+
import { _ } from '@swc/helpers/_/_apply_decs_2203_r';
|
|
16
|
+
import { Glob } from 'glob';
|
|
17
|
+
import normalize from 'normalize-package-data';
|
|
18
|
+
import moo from 'moo';
|
|
19
|
+
import { qjson, qprop, q$, defineQuickFormat, qerror, qarg, qwrap } from '@jujulego/quick-tag';
|
|
19
20
|
import Ajv from 'ajv';
|
|
20
21
|
import os from 'node:os';
|
|
21
22
|
import { cosmiconfig, defaultLoaders } from 'cosmiconfig';
|
|
22
23
|
import { chalkTemplateStderr } from 'chalk-template';
|
|
23
24
|
|
|
24
|
-
var version = "3.0.0-alpha.
|
|
25
|
+
var version = "3.0.0-alpha.3";
|
|
26
|
+
|
|
27
|
+
function trace(fun, opts) {
|
|
28
|
+
const name = typeof opts === 'string' ? opts : opts.name;
|
|
29
|
+
const use = typeof opts === 'object' ? opts.use : (_, r)=>r;
|
|
30
|
+
return function(...args) {
|
|
31
|
+
return pipe$(startSpan({
|
|
32
|
+
name
|
|
33
|
+
}, ()=>fun.call(this, ...args)), (r)=>use(name, r));
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function instrument(opts) {
|
|
37
|
+
return (target, context)=>{
|
|
38
|
+
const name = typeof opts === 'string' ? opts : opts?.name ?? context.name.toString();
|
|
39
|
+
const use = typeof opts === 'object' ? opts.use : (_, r)=>r;
|
|
40
|
+
return trace(target, {
|
|
41
|
+
name,
|
|
42
|
+
use
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function traceAsyncGenerator(name, generator) {
|
|
47
|
+
const instrumented = {
|
|
48
|
+
...generator,
|
|
49
|
+
next: async ()=>startSpan({
|
|
50
|
+
name,
|
|
51
|
+
op: 'iterator.next'
|
|
52
|
+
}, ()=>generator.next()),
|
|
53
|
+
[Symbol.asyncIterator]: ()=>instrumented
|
|
54
|
+
};
|
|
55
|
+
return instrumented;
|
|
56
|
+
}
|
|
57
|
+
function traceLoad(name, loader) {
|
|
58
|
+
return startSpan({
|
|
59
|
+
name: `load ${name}`,
|
|
60
|
+
op: 'import'
|
|
61
|
+
}, loader);
|
|
62
|
+
}
|
|
25
63
|
|
|
26
64
|
function command$5(module) {
|
|
27
|
-
|
|
65
|
+
const name = getCommandName(module);
|
|
66
|
+
const handler = trace(module.handler, 'cli.handler');
|
|
67
|
+
return (parser)=>parser.command({
|
|
68
|
+
...module,
|
|
69
|
+
async handler (args) {
|
|
70
|
+
const activeSpan = getActiveSpan();
|
|
71
|
+
if (activeSpan) {
|
|
72
|
+
updateSpanName(getRootSpan(activeSpan), `jill ${name}`);
|
|
73
|
+
}
|
|
74
|
+
await handler(args);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function getCommandName(module) {
|
|
79
|
+
if (!module.command) {
|
|
80
|
+
return '[unknown]';
|
|
81
|
+
}
|
|
82
|
+
if (typeof module.command === 'string') {
|
|
83
|
+
return module.command;
|
|
84
|
+
}
|
|
85
|
+
return module.command[0];
|
|
28
86
|
}
|
|
29
87
|
|
|
30
88
|
// Tokens
|
|
@@ -38,10 +96,45 @@ const PATH_SCURRY = token$('PathScurry', ()=>new PathScurry('/', {
|
|
|
38
96
|
fs
|
|
39
97
|
}));
|
|
40
98
|
const TASK_MANAGER = token$('TaskManager', async ()=>{
|
|
41
|
-
|
|
99
|
+
const manager = new TaskManager({
|
|
42
100
|
jobs: (await inject$(CONFIG, asyncScope$())).jobs,
|
|
43
101
|
logger: inject$(LOGGER)
|
|
44
102
|
});
|
|
103
|
+
let rootSpan = getActiveSpan();
|
|
104
|
+
if (rootSpan) rootSpan = getRootSpan(rootSpan);
|
|
105
|
+
const spans = new Map();
|
|
106
|
+
manager.events$.on('added', (task)=>{
|
|
107
|
+
// Main span
|
|
108
|
+
const span = startInactiveSpan({
|
|
109
|
+
name: task.name,
|
|
110
|
+
parentSpan: (task.group && spans.get(task.group.id)) ?? rootSpan,
|
|
111
|
+
op: 'task'
|
|
112
|
+
});
|
|
113
|
+
task.events$.on('completed', ({ status })=>{
|
|
114
|
+
span.setStatus({
|
|
115
|
+
code: status === 'done' ? 1 : 2
|
|
116
|
+
});
|
|
117
|
+
span.end();
|
|
118
|
+
});
|
|
119
|
+
spans.set(task.id, span);
|
|
120
|
+
// Status spans
|
|
121
|
+
let statusSpan = startInactiveSpan({
|
|
122
|
+
name: task.status,
|
|
123
|
+
parentSpan: span,
|
|
124
|
+
op: 'task.status'
|
|
125
|
+
});
|
|
126
|
+
task.events$.on('status', ({ status })=>{
|
|
127
|
+
statusSpan.end();
|
|
128
|
+
if (!task.completed) {
|
|
129
|
+
statusSpan = startInactiveSpan({
|
|
130
|
+
name: status,
|
|
131
|
+
parentSpan: span,
|
|
132
|
+
op: 'task.status'
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
return manager;
|
|
45
138
|
});
|
|
46
139
|
|
|
47
140
|
// Utils
|
|
@@ -55,13 +148,14 @@ function printJson(data, stream = process.stdout) {
|
|
|
55
148
|
|
|
56
149
|
// Utils
|
|
57
150
|
function executeCommand(module) {
|
|
58
|
-
const
|
|
151
|
+
const prepare = trace(module.prepare, 'cli.prepare');
|
|
152
|
+
const execute = module.execute && trace(module.execute, 'cli.execute');
|
|
59
153
|
return command$5({
|
|
60
|
-
...
|
|
154
|
+
...module,
|
|
61
155
|
builder (base) {
|
|
62
156
|
const parser = withPlanMode(base);
|
|
63
|
-
if (
|
|
64
|
-
return
|
|
157
|
+
if (module.builder) {
|
|
158
|
+
return module.builder(parser);
|
|
65
159
|
} else {
|
|
66
160
|
return parser;
|
|
67
161
|
}
|
|
@@ -72,7 +166,7 @@ function executeCommand(module) {
|
|
|
72
166
|
if (args.planMode === 'json') {
|
|
73
167
|
printJson(Array.from(plan(tasks)));
|
|
74
168
|
} else {
|
|
75
|
-
const { default: TaskPlanInk } = await import('./task-plan.ink.js');
|
|
169
|
+
const { default: TaskPlanInk } = await traceLoad('TaskPlanInk', ()=>import('./task-plan.ink.js'));
|
|
76
170
|
await TaskPlanInk({
|
|
77
171
|
tasks
|
|
78
172
|
});
|
|
@@ -81,7 +175,7 @@ function executeCommand(module) {
|
|
|
81
175
|
if (execute) {
|
|
82
176
|
await execute(args, tasks);
|
|
83
177
|
} else if (tasks.tasks.length > 0) {
|
|
84
|
-
const { default: TaskExecInk } = await import('./task-exec.ink.js');
|
|
178
|
+
const { default: TaskExecInk } = await traceLoad('TaskExecInk', ()=>import('./task-exec.ink.js'));
|
|
85
179
|
await TaskExecInk({
|
|
86
180
|
tasks,
|
|
87
181
|
verbose: [
|
|
@@ -100,13 +194,13 @@ function executeCommand(module) {
|
|
|
100
194
|
}
|
|
101
195
|
function planCommand(module, tasks$) {
|
|
102
196
|
if ('prepare' in module) {
|
|
103
|
-
const
|
|
197
|
+
const prepare = trace(module.prepare, 'cli.prepare');
|
|
104
198
|
return command$5({
|
|
105
|
-
...
|
|
199
|
+
...module,
|
|
106
200
|
builder (base) {
|
|
107
201
|
const parser = withPlanMode(base);
|
|
108
|
-
if (
|
|
109
|
-
return
|
|
202
|
+
if (module.builder) {
|
|
203
|
+
return module.builder(parser);
|
|
110
204
|
} else {
|
|
111
205
|
return parser;
|
|
112
206
|
}
|
|
@@ -189,9 +283,30 @@ function streamLines$(task, stream = 'stdout') {
|
|
|
189
283
|
});
|
|
190
284
|
}
|
|
191
285
|
|
|
286
|
+
var _dec$4, _dec1$3, _dec2$1, _initProto$4;
|
|
287
|
+
_dec$4 = instrument('GitService.isAffected'), _dec1$3 = instrument('GitService.listBranches'), _dec2$1 = instrument('GitService.listTags');
|
|
192
288
|
class GitService {
|
|
289
|
+
static{
|
|
290
|
+
({ e: [_initProto$4] } = _(this, [
|
|
291
|
+
[
|
|
292
|
+
_dec$4,
|
|
293
|
+
2,
|
|
294
|
+
"isAffected"
|
|
295
|
+
],
|
|
296
|
+
[
|
|
297
|
+
_dec1$3,
|
|
298
|
+
2,
|
|
299
|
+
"listBranches"
|
|
300
|
+
],
|
|
301
|
+
[
|
|
302
|
+
_dec2$1,
|
|
303
|
+
2,
|
|
304
|
+
"listTags"
|
|
305
|
+
]
|
|
306
|
+
], []));
|
|
307
|
+
}
|
|
193
308
|
// Attributes
|
|
194
|
-
_manager = inject$(TASK_MANAGER);
|
|
309
|
+
_manager = (_initProto$4(this), inject$(TASK_MANAGER));
|
|
195
310
|
_logger = inject$(LOGGER);
|
|
196
311
|
// Methods
|
|
197
312
|
/**
|
|
@@ -431,6 +546,13 @@ function isCommandCtx(ctx) {
|
|
|
431
546
|
return 'workspace' in ctx && 'command' in ctx;
|
|
432
547
|
}
|
|
433
548
|
|
|
549
|
+
class ClientError extends Error {
|
|
550
|
+
name = 'ClientError';
|
|
551
|
+
constructor(message){
|
|
552
|
+
super(message);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
434
556
|
// Utils
|
|
435
557
|
function capitalize(txt) {
|
|
436
558
|
return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
|
|
@@ -518,7 +640,7 @@ class ScriptTask extends GroupTask {
|
|
|
518
640
|
// Prepare script run
|
|
519
641
|
this._scriptTasks = await this._runScript(this.script, this.args);
|
|
520
642
|
if (!this._scriptTasks) {
|
|
521
|
-
throw new
|
|
643
|
+
throw new ScriptNotFound(`No script ${this.script} in ${this.workspace.name}`);
|
|
522
644
|
}
|
|
523
645
|
// Prepare hooks run
|
|
524
646
|
if (this._runHooks) {
|
|
@@ -594,12 +716,37 @@ class ScriptTask extends GroupTask {
|
|
|
594
716
|
function isScriptCtx(ctx) {
|
|
595
717
|
return 'workspace' in ctx && 'script' in ctx;
|
|
596
718
|
}
|
|
719
|
+
class ScriptNotFound extends ClientError {
|
|
720
|
+
name = 'ScriptNotFound';
|
|
721
|
+
}
|
|
597
722
|
|
|
723
|
+
var _dec$3, _dec1$2, _initProto$3;
|
|
724
|
+
_dec$3 = instrument({
|
|
725
|
+
name: 'Workspace.dependencies',
|
|
726
|
+
use: traceAsyncGenerator
|
|
727
|
+
}), _dec1$2 = instrument({
|
|
728
|
+
name: 'Workspace.devDependencies',
|
|
729
|
+
use: traceAsyncGenerator
|
|
730
|
+
});
|
|
598
731
|
class Workspace {
|
|
599
732
|
manifest;
|
|
600
733
|
project;
|
|
734
|
+
static{
|
|
735
|
+
({ e: [_initProto$3] } = _(this, [
|
|
736
|
+
[
|
|
737
|
+
_dec$3,
|
|
738
|
+
2,
|
|
739
|
+
"dependencies"
|
|
740
|
+
],
|
|
741
|
+
[
|
|
742
|
+
_dec1$2,
|
|
743
|
+
2,
|
|
744
|
+
"devDependencies"
|
|
745
|
+
]
|
|
746
|
+
], []));
|
|
747
|
+
}
|
|
601
748
|
// Attributes
|
|
602
|
-
_affectedCache = new Map();
|
|
749
|
+
_affectedCache = (_initProto$3(this), new Map());
|
|
603
750
|
_logger;
|
|
604
751
|
_git = inject$(GitService);
|
|
605
752
|
_root;
|
|
@@ -755,9 +902,43 @@ class Workspace {
|
|
|
755
902
|
}
|
|
756
903
|
}
|
|
757
904
|
|
|
905
|
+
var _dec$2, _dec1$1, _dec2, _dec3, _dec4, _initProto$2;
|
|
906
|
+
_dec$2 = instrument('Project.currentWorkspace'), _dec1$1 = instrument('Project.mainWorkspace'), _dec2 = instrument('Project.packageManager'), _dec3 = instrument('Project.workspace'), _dec4 = instrument({
|
|
907
|
+
name: 'Project.workspaces',
|
|
908
|
+
use: traceAsyncGenerator
|
|
909
|
+
});
|
|
758
910
|
class Project {
|
|
911
|
+
static{
|
|
912
|
+
({ e: [_initProto$2] } = _(this, [
|
|
913
|
+
[
|
|
914
|
+
_dec$2,
|
|
915
|
+
2,
|
|
916
|
+
"currentWorkspace"
|
|
917
|
+
],
|
|
918
|
+
[
|
|
919
|
+
_dec1$1,
|
|
920
|
+
2,
|
|
921
|
+
"mainWorkspace"
|
|
922
|
+
],
|
|
923
|
+
[
|
|
924
|
+
_dec2,
|
|
925
|
+
2,
|
|
926
|
+
"packageManager"
|
|
927
|
+
],
|
|
928
|
+
[
|
|
929
|
+
_dec3,
|
|
930
|
+
2,
|
|
931
|
+
"workspace"
|
|
932
|
+
],
|
|
933
|
+
[
|
|
934
|
+
_dec4,
|
|
935
|
+
2,
|
|
936
|
+
"workspaces"
|
|
937
|
+
]
|
|
938
|
+
], []));
|
|
939
|
+
}
|
|
759
940
|
// Attributes
|
|
760
|
-
_isFullyLoaded = false;
|
|
941
|
+
_isFullyLoaded = (_initProto$2(this), false);
|
|
761
942
|
_lock = mutex$();
|
|
762
943
|
_mainWorkspace;
|
|
763
944
|
_packageManager;
|
|
@@ -895,11 +1076,22 @@ class Project {
|
|
|
895
1076
|
}
|
|
896
1077
|
}
|
|
897
1078
|
|
|
1079
|
+
var _dec$1, _initProto$1;
|
|
1080
|
+
_dec$1 = instrument();
|
|
898
1081
|
/**
|
|
899
1082
|
* Helps detecting projects folders
|
|
900
1083
|
*/ class ProjectsRepository {
|
|
1084
|
+
static{
|
|
1085
|
+
({ e: [_initProto$1] } = _(this, [
|
|
1086
|
+
[
|
|
1087
|
+
_dec$1,
|
|
1088
|
+
2,
|
|
1089
|
+
"searchProjectRoot"
|
|
1090
|
+
]
|
|
1091
|
+
], []));
|
|
1092
|
+
}
|
|
901
1093
|
// Attributes
|
|
902
|
-
_cache = new Map();
|
|
1094
|
+
_cache = (_initProto$1(this), new Map());
|
|
903
1095
|
_logger = inject$(LOGGER).child(withLabel('projects'));
|
|
904
1096
|
_scurry = inject$(PATH_SCURRY);
|
|
905
1097
|
// Methods
|
|
@@ -973,11 +1165,14 @@ const LOCK_FILES = [
|
|
|
973
1165
|
],
|
|
974
1166
|
type: 'string',
|
|
975
1167
|
description: 'Force package manager'
|
|
976
|
-
}).middleware(
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1168
|
+
}).middleware((args)=>startSpan({
|
|
1169
|
+
name: 'project',
|
|
1170
|
+
op: 'cli.middleware'
|
|
1171
|
+
}, async ()=>{
|
|
1172
|
+
const repository = inject$(ProjectsRepository);
|
|
1173
|
+
const directory = path.resolve(inject$(CWD, asyncScope$()), args.project);
|
|
1174
|
+
args.project = await repository.searchProjectRoot(directory);
|
|
1175
|
+
}));
|
|
981
1176
|
}
|
|
982
1177
|
/**
|
|
983
1178
|
* Loads a project, based on arguments.
|
|
@@ -988,15 +1183,33 @@ const LOCK_FILES = [
|
|
|
988
1183
|
});
|
|
989
1184
|
}
|
|
990
1185
|
|
|
991
|
-
class TaskExpressionError extends
|
|
1186
|
+
class TaskExpressionError extends ClientError {
|
|
1187
|
+
name = 'TaskExpressionError';
|
|
992
1188
|
}
|
|
993
|
-
class TaskSyntaxError extends
|
|
1189
|
+
class TaskSyntaxError extends ClientError {
|
|
1190
|
+
name = 'TaskSyntaxError';
|
|
994
1191
|
}
|
|
995
1192
|
|
|
1193
|
+
var _dec, _dec1, _initProto;
|
|
1194
|
+
_dec = instrument('TaskParserService.parse'), _dec1 = instrument('TaskParserService.buildTask');
|
|
996
1195
|
// Service
|
|
997
1196
|
class TaskParserService {
|
|
1197
|
+
static{
|
|
1198
|
+
({ e: [_initProto] } = _(this, [
|
|
1199
|
+
[
|
|
1200
|
+
_dec,
|
|
1201
|
+
2,
|
|
1202
|
+
"parse"
|
|
1203
|
+
],
|
|
1204
|
+
[
|
|
1205
|
+
_dec1,
|
|
1206
|
+
2,
|
|
1207
|
+
"buildTask"
|
|
1208
|
+
]
|
|
1209
|
+
], []));
|
|
1210
|
+
}
|
|
998
1211
|
// Attributes
|
|
999
|
-
_logger = inject$(LOGGER).child(withLabel('task-parser'));
|
|
1212
|
+
_logger = (_initProto(this), inject$(LOGGER).child(withLabel('task-parser')));
|
|
1000
1213
|
// Statics
|
|
1001
1214
|
static isTaskNode(node) {
|
|
1002
1215
|
return 'script' in node;
|
|
@@ -1342,10 +1555,16 @@ const command$4 = {
|
|
|
1342
1555
|
workspace = await project.mainWorkspace();
|
|
1343
1556
|
}
|
|
1344
1557
|
if (!workspace) {
|
|
1345
|
-
throw new
|
|
1558
|
+
throw new WorkspaceNotFound(args.workspace || '.');
|
|
1346
1559
|
}
|
|
1347
1560
|
return workspace;
|
|
1348
1561
|
}
|
|
1562
|
+
class WorkspaceNotFound extends ClientError {
|
|
1563
|
+
name = 'WorkspaceNotFound';
|
|
1564
|
+
constructor(workspace){
|
|
1565
|
+
super(`Workspace "${workspace}" not found`);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1349
1568
|
|
|
1350
1569
|
// Command
|
|
1351
1570
|
const command$3 = {
|
|
@@ -1397,7 +1616,7 @@ const command$3 = {
|
|
|
1397
1616
|
dependencies.add(dep);
|
|
1398
1617
|
}
|
|
1399
1618
|
// Run dependencies first with spinners
|
|
1400
|
-
const { default: TaskExecInk } = await import('./task-exec.ink.js');
|
|
1619
|
+
const { default: TaskExecInk } = await traceLoad('TaskExecInk', ()=>import('./task-exec.ink.js'));
|
|
1401
1620
|
await TaskExecInk({
|
|
1402
1621
|
tasks: dependencies,
|
|
1403
1622
|
verbose: [
|
|
@@ -1544,7 +1763,7 @@ const command$2 = {
|
|
|
1544
1763
|
if (argv.attribute.length > 0 && argv['sort-by']?.length) {
|
|
1545
1764
|
const miss = argv['sort-by'].filter((attr)=>!argv.attribute.includes(attr));
|
|
1546
1765
|
if (miss.length > 0) {
|
|
1547
|
-
throw new
|
|
1766
|
+
throw new ClientError(`Cannot sort by non printed attributes. Missing ${miss.join(', ')}.`);
|
|
1548
1767
|
}
|
|
1549
1768
|
}
|
|
1550
1769
|
if (!argv['sort-by']?.length && argv.attribute.length > 0) {
|
|
@@ -1584,7 +1803,7 @@ const command$2 = {
|
|
|
1584
1803
|
data.root = path.relative(process.cwd(), data.root) || '.';
|
|
1585
1804
|
}
|
|
1586
1805
|
}
|
|
1587
|
-
const { default: ListInk } = await import('./list.ink.js');
|
|
1806
|
+
const { default: ListInk } = await traceLoad('ListInk', ()=>import('./list.ink.js'));
|
|
1588
1807
|
await ListInk({
|
|
1589
1808
|
attributes: args.attribute,
|
|
1590
1809
|
headers: args.headers,
|
|
@@ -1678,7 +1897,7 @@ const command = {
|
|
|
1678
1897
|
builder: withWorkspace,
|
|
1679
1898
|
async handler (args) {
|
|
1680
1899
|
const workspace = await loadWorkspace(args);
|
|
1681
|
-
const { default: TreeInk } = await import('./tree.ink.js');
|
|
1900
|
+
const { default: TreeInk } = await traceLoad('TreeInk', ()=>import('./tree.ink.js'));
|
|
1682
1901
|
await TreeInk({
|
|
1683
1902
|
workspace
|
|
1684
1903
|
});
|
|
@@ -1686,7 +1905,7 @@ const command = {
|
|
|
1686
1905
|
};
|
|
1687
1906
|
|
|
1688
1907
|
// Utils
|
|
1689
|
-
|
|
1908
|
+
function dynamicImport(filepath) {
|
|
1690
1909
|
return import(/* webpackIgnore: true */ process.platform === 'win32' ? `file://${filepath}` : filepath);
|
|
1691
1910
|
}
|
|
1692
1911
|
|
|
@@ -1814,19 +2033,22 @@ var config_service = /*#__PURE__*/Object.freeze({
|
|
|
1814
2033
|
});
|
|
1815
2034
|
|
|
1816
2035
|
// Middleware
|
|
1817
|
-
function
|
|
2036
|
+
function withConfig(parser) {
|
|
1818
2037
|
return parser.option('config-file', {
|
|
1819
2038
|
alias: 'c',
|
|
1820
2039
|
type: 'string',
|
|
1821
2040
|
description: 'Configuration file'
|
|
1822
|
-
}).middleware(
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
2041
|
+
}).middleware((args)=>startSpan({
|
|
2042
|
+
name: 'config',
|
|
2043
|
+
op: 'cli.middleware'
|
|
2044
|
+
}, async ()=>{
|
|
2045
|
+
const configService = inject$(ConfigService, asyncScope$());
|
|
2046
|
+
if (args.configFile) {
|
|
2047
|
+
await configService.loadConfig(args.configFile);
|
|
2048
|
+
} else {
|
|
2049
|
+
await configService.searchConfig();
|
|
2050
|
+
}
|
|
2051
|
+
}));
|
|
1830
2052
|
}
|
|
1831
2053
|
|
|
1832
2054
|
const LEVEL_COLORS = {
|
|
@@ -1845,24 +2067,27 @@ const VERBOSITY_LEVEL = {
|
|
|
1845
2067
|
2: 'debug'
|
|
1846
2068
|
};
|
|
1847
2069
|
// Middleware
|
|
1848
|
-
function
|
|
2070
|
+
function withLogger(parser) {
|
|
1849
2071
|
return parser.option('verbose', {
|
|
1850
2072
|
alias: 'v',
|
|
1851
2073
|
default: 'info',
|
|
1852
2074
|
type: 'count',
|
|
1853
2075
|
description: 'Set verbosity level',
|
|
1854
2076
|
coerce: (cnt)=>VERBOSITY_LEVEL[Math.min(cnt, 2)]
|
|
1855
|
-
}).middleware((args)=>{
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
2077
|
+
}).middleware((args)=>startSpan({
|
|
2078
|
+
name: 'logger',
|
|
2079
|
+
op: 'cli.middleware'
|
|
2080
|
+
}, ()=>{
|
|
2081
|
+
const logLevel = args.verbose ? LogLevel[args.verbose] : LogLevel.info;
|
|
2082
|
+
const logGateway = inject$(LogGateway);
|
|
2083
|
+
flow$(inject$(LOGGER), filter$((log)=>log.level >= logLevel), logDelay$(), logGateway);
|
|
2084
|
+
logGateway.connect('console', toStderr(logFormat));
|
|
2085
|
+
}));
|
|
1861
2086
|
}
|
|
1862
2087
|
|
|
1863
2088
|
// Utils
|
|
1864
2089
|
function baseParser() {
|
|
1865
|
-
return pipe$(yargs(
|
|
2090
|
+
return pipe$(yargs().scriptName('jill').version(version).demandCommand().recommendCommands(), withLogger, withConfig);
|
|
1866
2091
|
}
|
|
1867
2092
|
/**
|
|
1868
2093
|
* Prepare parser executing commands
|
|
@@ -1875,5 +2100,5 @@ function baseParser() {
|
|
|
1875
2100
|
return pipe$(baseParser(), planCommand(command$4, tasks$), planCommand(command$3, tasks$), planCommand(command$2, tasks$), planCommand(command$1, tasks$), planCommand(command, tasks$));
|
|
1876
2101
|
}
|
|
1877
2102
|
|
|
1878
|
-
export {
|
|
2103
|
+
export { ClientError as C, LOGGER as L, ScriptTask as S, TASK_MANAGER as T, isScriptCtx as a, CommandTask as b, capitalize as c, CWD as d, executeParser as e, ConfigService as f, instrument as g, isCommandCtx as i, logFormat as l, planParser as p };
|
|
1879
2104
|
//# sourceMappingURL=parser.js.map
|