@jujulego/jill 3.0.0-alpha.1 → 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 +33 -0
- package/dist/TaskName.js.map +1 -0
- package/dist/inked.js +66 -0
- package/dist/inked.js.map +1 -0
- package/dist/instrument.js +8 -0
- package/dist/instrument.js.map +1 -0
- package/dist/list.ink.js +50 -0
- package/dist/list.ink.js.map +1 -0
- package/dist/main.js +44 -35
- package/dist/main.js.map +1 -1
- package/dist/parser.js +2104 -0
- package/dist/parser.js.map +1 -0
- package/dist/planner.service.js +58 -0
- package/dist/planner.service.js.map +1 -0
- package/dist/task-exec.ink.js +539 -0
- package/dist/task-exec.ink.js.map +1 -0
- package/dist/task-plan.ink.js +114 -0
- package/dist/task-plan.ink.js.map +1 -0
- package/dist/tree.ink.js +185 -0
- package/dist/tree.ink.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +46 -45
- package/dist/ajv.config.d.ts +0 -3
- package/dist/commands/each.d.ts +0 -25
- package/dist/commands/exec.d.ts +0 -26
- package/dist/commands/group.d.ts +0 -16
- package/dist/commands/list.d.ts +0 -30
- package/dist/commands/run.d.ts +0 -24
- package/dist/commands/tree.d.ts +0 -6
- package/dist/commons/context.service.d.ts +0 -23
- package/dist/commons/git.service.d.ts +0 -62
- package/dist/commons/logger/log.gateway.d.ts +0 -18
- package/dist/commons/logger/parameters.d.ts +0 -2
- package/dist/commons/logger/thread.gateway.d.ts +0 -12
- package/dist/commons/logger/types.d.ts +0 -2
- package/dist/commons/logger.service.d.ts +0 -1
- package/dist/config/config-loader.d.ts +0 -4
- package/dist/config/config-options.d.ts +0 -5
- package/dist/config/types.d.ts +0 -8
- package/dist/config/utils.d.ts +0 -5
- package/dist/constants.d.ts +0 -1
- package/dist/core.plugin-CxgfxFUI.js +0 -642
- package/dist/core.plugin-CxgfxFUI.js.map +0 -1
- package/dist/core.plugin.d.ts +0 -2
- package/dist/filters/affected.filter.d.ts +0 -12
- package/dist/filters/pipeline.d.ts +0 -11
- package/dist/filters/private.filter.d.ts +0 -7
- package/dist/filters/scripts.filter.d.ts +0 -8
- package/dist/index.d.ts +0 -45
- package/dist/index.js +0 -35
- package/dist/index.js.map +0 -1
- package/dist/ink-command-CsbkuRbm.js +0 -2071
- package/dist/ink-command-CsbkuRbm.js.map +0 -1
- package/dist/ink.config.d.ts +0 -3
- package/dist/inversify.config.d.ts +0 -4
- package/dist/jill.application-DNJpmnCF.js +0 -637
- package/dist/jill.application-DNJpmnCF.js.map +0 -1
- package/dist/jill.application.d.ts +0 -19
- package/dist/main.d.ts +0 -1
- package/dist/middlewares/load-project.d.ts +0 -21
- package/dist/middlewares/load-workspace.d.ts +0 -20
- package/dist/modules/command.d.ts +0 -20
- package/dist/modules/ink-command.d.ts +0 -11
- package/dist/modules/middleware.d.ts +0 -8
- package/dist/modules/module.d.ts +0 -7
- package/dist/modules/plugin-loader.service.d.ts +0 -10
- package/dist/modules/plugin.d.ts +0 -14
- package/dist/modules/service.d.ts +0 -8
- package/dist/modules/task-command.d.ts +0 -14
- package/dist/project/project.d.ts +0 -27
- package/dist/project/project.repository.d.ts +0 -15
- package/dist/project/types.d.ts +0 -1
- package/dist/project/workspace.d.ts +0 -41
- package/dist/tasks/command-task.d.ts +0 -15
- package/dist/tasks/errors.d.ts +0 -4
- package/dist/tasks/script-task.d.ts +0 -27
- package/dist/tasks/task-expression.service.d.ts +0 -25
- package/dist/tasks/task-manager.config.d.ts +0 -3
- package/dist/types.d.ts +0 -11
- package/dist/ui/hooks/useFlatTaskTree.d.ts +0 -14
- package/dist/ui/hooks/useIsVerbose.d.ts +0 -1
- package/dist/ui/hooks/useStdoutDimensions.d.ts +0 -4
- package/dist/ui/layout.d.ts +0 -5
- package/dist/ui/list.d.ts +0 -5
- package/dist/ui/static-logs.d.ts +0 -1
- package/dist/ui/task-name.d.ts +0 -5
- package/dist/ui/task-spinner.d.ts +0 -5
- package/dist/ui/task-tree-completed.d.ts +0 -5
- package/dist/ui/task-tree-full-spinner.d.ts +0 -5
- package/dist/ui/task-tree-scrollable-spinner.d.ts +0 -5
- package/dist/ui/task-tree-spinner.d.ts +0 -5
- package/dist/ui/task-tree-stats.d.ts +0 -5
- package/dist/ui/workspace-tree.d.ts +0 -8
- package/dist/utils/events.d.ts +0 -3
- package/dist/utils/exit.d.ts +0 -4
- package/dist/utils/import.d.ts +0 -4
- package/dist/utils/json.d.ts +0 -1
- package/dist/utils/streams.d.ts +0 -3
- package/dist/utils/string.d.ts +0 -2
- package/dist/utils/worker-cache.d.ts +0 -3
- package/dist/workspace-tree-VWKE0B6b.js +0 -1120
- package/dist/workspace-tree-VWKE0B6b.js.map +0 -1
|
@@ -1,637 +0,0 @@
|
|
|
1
|
-
import { _ } from '@swc/helpers/_/_ts_decorate';
|
|
2
|
-
import { _ as _$1 } from '@swc/helpers/_/_ts_param';
|
|
3
|
-
import { Logger, withLabel } from '@jujulego/logger';
|
|
4
|
-
import { injectable, inject } from 'inversify';
|
|
5
|
-
import yargs from 'yargs';
|
|
6
|
-
import { m as container, C as CONFIG, p as isCommandCtx, t as ScriptTask, q as CommandTask, b as TaskSpinner, n as lazyInject, u as TASK_MANAGER, I as InkCommand, y as printJson, r as isScriptCtx, a as List, E as ExitException, D as ContextService, P as PluginLoaderService, l as CURRENT, F as applyConfigOptions, j as getModule, d as COMMAND_MODULE, c as COMMAND, g as getCommandOpts, e as buildCommandModule } from './ink-command-CsbkuRbm.js';
|
|
7
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
|
-
import { waitFor$ } from '@jujulego/event-tree';
|
|
9
|
-
import { GroupTask, TaskSet, plan } from '@jujulego/tasks';
|
|
10
|
-
import { Text, Static, Box, useStdout, useInput, useStdin } from 'ink';
|
|
11
|
-
import { useMemo, useState, useLayoutEffect, useEffect } from 'react';
|
|
12
|
-
import Spinner from 'ink-spinner';
|
|
13
|
-
import symbols from 'log-symbols';
|
|
14
|
-
|
|
15
|
-
function useIsVerbose() {
|
|
16
|
-
return useMemo(()=>{
|
|
17
|
-
const config = container.get(CONFIG);
|
|
18
|
-
if (config.verbose) {
|
|
19
|
-
return [
|
|
20
|
-
'verbose',
|
|
21
|
-
'debug'
|
|
22
|
-
].includes(config.verbose);
|
|
23
|
-
} else {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}, []);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Utils
|
|
30
|
-
/**
|
|
31
|
-
* Sorts tasks according to workspace and script, keeping command at the end
|
|
32
|
-
*/ function taskComparator(a, b) {
|
|
33
|
-
// 1 - compare kind
|
|
34
|
-
const kindA = a instanceof CommandTask ? 0 : 1;
|
|
35
|
-
const kindB = b instanceof CommandTask ? 0 : 1;
|
|
36
|
-
if (kindA !== kindB) {
|
|
37
|
-
return kindB - kindA;
|
|
38
|
-
}
|
|
39
|
-
// 2 - compare workspaces
|
|
40
|
-
const wksA = 'workspace' in a.context ? a.context.workspace.name : '\uffff';
|
|
41
|
-
const wksB = 'workspace' in b.context ? b.context.workspace.name : '\uffff';
|
|
42
|
-
const wksDiff = wksA.localeCompare(wksB);
|
|
43
|
-
if (wksDiff !== 0) {
|
|
44
|
-
return wksDiff;
|
|
45
|
-
}
|
|
46
|
-
// 1 - compare scripts
|
|
47
|
-
const scriptA = 'script' in a.context ? a.context.script : '\uffff';
|
|
48
|
-
const scriptB = 'script' in b.context ? b.context.script : '\uffff';
|
|
49
|
-
return scriptA.localeCompare(scriptB);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Extract tasks to be printed, with their level in the tree
|
|
53
|
-
*/ function* flatTasks(tasks, isVerbose, groupId, level = 0) {
|
|
54
|
-
for (const task of tasks){
|
|
55
|
-
if (task.group?.id !== groupId) {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
yield {
|
|
59
|
-
task,
|
|
60
|
-
level
|
|
61
|
-
};
|
|
62
|
-
if (task instanceof GroupTask) {
|
|
63
|
-
const isCommandGroup = task.tasks.some((t)=>!isCommandCtx(t.context));
|
|
64
|
-
const hasFailed = task.tasks.some((t)=>t.status === 'failed');
|
|
65
|
-
const isStarted = task.status === 'running';
|
|
66
|
-
if (isVerbose || isCommandGroup || hasFailed || isStarted) {
|
|
67
|
-
let tasks = task.tasks;
|
|
68
|
-
if (task instanceof ScriptTask) {
|
|
69
|
-
tasks = [
|
|
70
|
-
...tasks
|
|
71
|
-
].sort(taskComparator);
|
|
72
|
-
}
|
|
73
|
-
yield* flatTasks(tasks, isVerbose, task.id, level + 1);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// Hook
|
|
79
|
-
function useFlatTaskTree(manager) {
|
|
80
|
-
const isVerbose = useIsVerbose();
|
|
81
|
-
const [tasks, setTasks] = useState([
|
|
82
|
-
...manager.tasks
|
|
83
|
-
].sort(taskComparator));
|
|
84
|
-
const [version, setVersion] = useState(0);
|
|
85
|
-
useLayoutEffect(()=>{
|
|
86
|
-
let dirty = false;
|
|
87
|
-
return manager.on('added', ()=>{
|
|
88
|
-
if (!dirty) {
|
|
89
|
-
dirty = true;
|
|
90
|
-
queueMicrotask(()=>{
|
|
91
|
-
setTasks([
|
|
92
|
-
...manager.tasks
|
|
93
|
-
].sort(taskComparator));
|
|
94
|
-
dirty = false;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}, [
|
|
99
|
-
manager
|
|
100
|
-
]);
|
|
101
|
-
useLayoutEffect(()=>{
|
|
102
|
-
let dirty = false;
|
|
103
|
-
return manager.on('started', ()=>{
|
|
104
|
-
if (!dirty) {
|
|
105
|
-
dirty = true;
|
|
106
|
-
setTimeout(()=>{
|
|
107
|
-
setVersion((old)=>++old);
|
|
108
|
-
dirty = false;
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}, [
|
|
113
|
-
manager
|
|
114
|
-
]);
|
|
115
|
-
useLayoutEffect(()=>{
|
|
116
|
-
let dirty = false;
|
|
117
|
-
return manager.on('completed', ()=>{
|
|
118
|
-
if (!dirty) {
|
|
119
|
-
dirty = true;
|
|
120
|
-
setTimeout(()=>{
|
|
121
|
-
setVersion((old)=>++old);
|
|
122
|
-
dirty = false;
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}, [
|
|
127
|
-
manager
|
|
128
|
-
]);
|
|
129
|
-
return useMemo(()=>{
|
|
130
|
-
return Array.from(flatTasks(tasks, isVerbose));
|
|
131
|
-
}, [
|
|
132
|
-
tasks,
|
|
133
|
-
isVerbose,
|
|
134
|
-
version
|
|
135
|
-
]);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Component
|
|
139
|
-
function TaskTreeStats({ manager }) {
|
|
140
|
-
// Follow stats
|
|
141
|
-
const [stats, setStats] = useState(()=>{
|
|
142
|
-
const base = {
|
|
143
|
-
running: 0,
|
|
144
|
-
done: 0,
|
|
145
|
-
failed: 0
|
|
146
|
-
};
|
|
147
|
-
for (const task of manager.tasks){
|
|
148
|
-
switch(task.status){
|
|
149
|
-
case 'starting':
|
|
150
|
-
case 'running':
|
|
151
|
-
base.running += task.weight;
|
|
152
|
-
break;
|
|
153
|
-
case 'done':
|
|
154
|
-
base.done += task.weight;
|
|
155
|
-
break;
|
|
156
|
-
case 'failed':
|
|
157
|
-
base.failed += task.weight;
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return base;
|
|
162
|
-
});
|
|
163
|
-
useLayoutEffect(()=>manager.on('started', (task)=>{
|
|
164
|
-
setStats((old)=>({
|
|
165
|
-
...old,
|
|
166
|
-
running: old.running + task.weight
|
|
167
|
-
}));
|
|
168
|
-
}), [
|
|
169
|
-
manager
|
|
170
|
-
]);
|
|
171
|
-
useLayoutEffect(()=>manager.on('completed', (task)=>{
|
|
172
|
-
setStats((old)=>({
|
|
173
|
-
running: old.running - task.weight,
|
|
174
|
-
done: task.status === 'done' ? old.done + task.weight : old.done,
|
|
175
|
-
failed: task.status === 'failed' ? old.failed + task.weight : old.failed
|
|
176
|
-
}));
|
|
177
|
-
}), [
|
|
178
|
-
manager
|
|
179
|
-
]);
|
|
180
|
-
// Render
|
|
181
|
-
return /*#__PURE__*/ jsxs(Text, {
|
|
182
|
-
children: [
|
|
183
|
-
stats.running !== 0 && /*#__PURE__*/ jsxs(Fragment, {
|
|
184
|
-
children: [
|
|
185
|
-
/*#__PURE__*/ jsx(Spinner, {
|
|
186
|
-
type: "sand"
|
|
187
|
-
}),
|
|
188
|
-
" ",
|
|
189
|
-
/*#__PURE__*/ jsx(Text, {
|
|
190
|
-
bold: true,
|
|
191
|
-
children: stats.running
|
|
192
|
-
}),
|
|
193
|
-
" running"
|
|
194
|
-
]
|
|
195
|
-
}),
|
|
196
|
-
stats.running !== 0 && stats.done !== 0 && /*#__PURE__*/ jsx(Fragment, {
|
|
197
|
-
children: ", "
|
|
198
|
-
}),
|
|
199
|
-
stats.done !== 0 && /*#__PURE__*/ jsxs(Text, {
|
|
200
|
-
color: "green",
|
|
201
|
-
children: [
|
|
202
|
-
symbols.success,
|
|
203
|
-
" ",
|
|
204
|
-
stats.done,
|
|
205
|
-
" done"
|
|
206
|
-
]
|
|
207
|
-
}),
|
|
208
|
-
stats.running + stats.done !== 0 && stats.failed !== 0 && /*#__PURE__*/ jsx(Fragment, {
|
|
209
|
-
children: ", "
|
|
210
|
-
}),
|
|
211
|
-
stats.failed !== 0 && /*#__PURE__*/ jsxs(Text, {
|
|
212
|
-
color: "red",
|
|
213
|
-
children: [
|
|
214
|
-
symbols.error,
|
|
215
|
-
" ",
|
|
216
|
-
stats.failed,
|
|
217
|
-
" failed"
|
|
218
|
-
]
|
|
219
|
-
})
|
|
220
|
-
]
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Component
|
|
225
|
-
function TaskTreeCompleted({ manager }) {
|
|
226
|
-
// Config
|
|
227
|
-
const isVerbose = useIsVerbose();
|
|
228
|
-
// Extract all tasks
|
|
229
|
-
const flat = useMemo(()=>{
|
|
230
|
-
return Array.from(flatTasks([
|
|
231
|
-
...manager.tasks
|
|
232
|
-
].sort(taskComparator), isVerbose));
|
|
233
|
-
}, [
|
|
234
|
-
manager,
|
|
235
|
-
isVerbose
|
|
236
|
-
]);
|
|
237
|
-
// Render
|
|
238
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
239
|
-
children: [
|
|
240
|
-
/*#__PURE__*/ jsx(Static, {
|
|
241
|
-
items: flat,
|
|
242
|
-
children: ({ task, level })=>/*#__PURE__*/ jsx(Box, {
|
|
243
|
-
marginLeft: level * 2,
|
|
244
|
-
flexShrink: 0,
|
|
245
|
-
children: /*#__PURE__*/ jsx(TaskSpinner, {
|
|
246
|
-
task: task
|
|
247
|
-
})
|
|
248
|
-
}, task.id)
|
|
249
|
-
}),
|
|
250
|
-
/*#__PURE__*/ jsx(TaskTreeStats, {
|
|
251
|
-
manager: manager
|
|
252
|
-
})
|
|
253
|
-
]
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function useStdoutDimensions() {
|
|
258
|
-
const { stdout } = useStdout();
|
|
259
|
-
const [dimensions, setDimensions] = useState({
|
|
260
|
-
columns: stdout.columns ?? Infinity,
|
|
261
|
-
rows: stdout.rows ?? Infinity
|
|
262
|
-
});
|
|
263
|
-
useEffect(()=>{
|
|
264
|
-
const handler = ()=>setDimensions({
|
|
265
|
-
columns: stdout.columns ?? Infinity,
|
|
266
|
-
rows: stdout.rows ?? Infinity
|
|
267
|
-
});
|
|
268
|
-
stdout.on('resize', handler);
|
|
269
|
-
return ()=>{
|
|
270
|
-
stdout.off('resize', handler);
|
|
271
|
-
};
|
|
272
|
-
}, [
|
|
273
|
-
stdout
|
|
274
|
-
]);
|
|
275
|
-
return dimensions;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// Component
|
|
279
|
-
function TaskTreeScrollableSpinner({ manager }) {
|
|
280
|
-
const { rows: termHeight } = useStdoutDimensions();
|
|
281
|
-
// Extract all tasks
|
|
282
|
-
const flat = useFlatTaskTree(manager);
|
|
283
|
-
const maxHeight = useMemo(()=>Math.min(termHeight - 4, flat.length), [
|
|
284
|
-
termHeight,
|
|
285
|
-
flat
|
|
286
|
-
]);
|
|
287
|
-
// Manage scroll
|
|
288
|
-
const [start, setStart] = useState(0);
|
|
289
|
-
const slice = useMemo(()=>flat.slice(start, start + maxHeight), [
|
|
290
|
-
flat,
|
|
291
|
-
start,
|
|
292
|
-
maxHeight
|
|
293
|
-
]);
|
|
294
|
-
useEffect(()=>{
|
|
295
|
-
if (start + maxHeight > flat.length) {
|
|
296
|
-
setStart(Math.max(flat.length - maxHeight, 0));
|
|
297
|
-
}
|
|
298
|
-
}, [
|
|
299
|
-
start,
|
|
300
|
-
flat,
|
|
301
|
-
maxHeight
|
|
302
|
-
]);
|
|
303
|
-
useInput((_, key)=>{
|
|
304
|
-
if (key.upArrow) {
|
|
305
|
-
setStart((old)=>Math.max(0, old - 1));
|
|
306
|
-
} else if (key.downArrow) {
|
|
307
|
-
setStart((old)=>Math.min(flat.length - maxHeight, old + 1));
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
// Render
|
|
311
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
312
|
-
children: [
|
|
313
|
-
/*#__PURE__*/ jsx(Box, {
|
|
314
|
-
flexDirection: "column",
|
|
315
|
-
children: slice.map(({ task, level })=>/*#__PURE__*/ jsx(Box, {
|
|
316
|
-
marginLeft: level * 2,
|
|
317
|
-
flexShrink: 0,
|
|
318
|
-
children: /*#__PURE__*/ jsx(TaskSpinner, {
|
|
319
|
-
task: task
|
|
320
|
-
})
|
|
321
|
-
}, task.id))
|
|
322
|
-
}),
|
|
323
|
-
/*#__PURE__*/ jsxs(Text, {
|
|
324
|
-
children: [
|
|
325
|
-
/*#__PURE__*/ jsx(TaskTreeStats, {
|
|
326
|
-
manager: manager
|
|
327
|
-
}),
|
|
328
|
-
maxHeight < flat.length && /*#__PURE__*/ jsx(Text, {
|
|
329
|
-
color: "grey",
|
|
330
|
-
children: " - use keyboard arrows to scroll"
|
|
331
|
-
})
|
|
332
|
-
]
|
|
333
|
-
})
|
|
334
|
-
]
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// Component
|
|
339
|
-
function TaskTreeFullSpinner({ manager }) {
|
|
340
|
-
const flat = useFlatTaskTree(manager);
|
|
341
|
-
// Render
|
|
342
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
343
|
-
children: [
|
|
344
|
-
/*#__PURE__*/ jsx(Box, {
|
|
345
|
-
flexDirection: "column",
|
|
346
|
-
children: flat.map(({ task, level })=>/*#__PURE__*/ jsx(Box, {
|
|
347
|
-
marginLeft: level * 2,
|
|
348
|
-
flexShrink: 0,
|
|
349
|
-
children: /*#__PURE__*/ jsx(TaskSpinner, {
|
|
350
|
-
task: task
|
|
351
|
-
})
|
|
352
|
-
}, task.id))
|
|
353
|
-
}),
|
|
354
|
-
/*#__PURE__*/ jsx(Text, {
|
|
355
|
-
children: /*#__PURE__*/ jsx(TaskTreeStats, {
|
|
356
|
-
manager: manager
|
|
357
|
-
})
|
|
358
|
-
})
|
|
359
|
-
]
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// Component
|
|
364
|
-
function TaskTreeSpinner({ manager }) {
|
|
365
|
-
const stdin = useStdin();
|
|
366
|
-
if (stdin.isRawModeSupported) {
|
|
367
|
-
return /*#__PURE__*/ jsx(TaskTreeScrollableSpinner, {
|
|
368
|
-
manager: manager
|
|
369
|
-
});
|
|
370
|
-
} else {
|
|
371
|
-
return /*#__PURE__*/ jsx(TaskTreeFullSpinner, {
|
|
372
|
-
manager: manager
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
class TaskCommand extends InkCommand {
|
|
378
|
-
addTaskOptions(parser) {
|
|
379
|
-
return parser.option('plan', {
|
|
380
|
-
type: 'boolean',
|
|
381
|
-
desc: 'Only prints tasks to be run',
|
|
382
|
-
default: false
|
|
383
|
-
}).option('plan-mode', {
|
|
384
|
-
type: 'string',
|
|
385
|
-
desc: 'Plan output mode',
|
|
386
|
-
choices: [
|
|
387
|
-
'json',
|
|
388
|
-
'list'
|
|
389
|
-
],
|
|
390
|
-
default: 'list'
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
async *render(args) {
|
|
394
|
-
// Prepare tasks
|
|
395
|
-
const tasks = new TaskSet();
|
|
396
|
-
for await (const tsk of this.prepare(args)){
|
|
397
|
-
tasks.add(tsk);
|
|
398
|
-
}
|
|
399
|
-
if (args.plan) {
|
|
400
|
-
const plan$1 = Array.from(plan(tasks));
|
|
401
|
-
if (args.planMode === 'json') {
|
|
402
|
-
printJson(plan$1);
|
|
403
|
-
} else {
|
|
404
|
-
const data = plan$1.map((tsk)=>({
|
|
405
|
-
id: tsk.id.substring(0, 6),
|
|
406
|
-
name: tsk.name,
|
|
407
|
-
workspace: isCommandCtx(tsk.context) || isScriptCtx(tsk.context) ? tsk.context.workspace.name : '',
|
|
408
|
-
group: tsk.groupId?.substring(0, 6),
|
|
409
|
-
'depends on': tsk.dependenciesIds.map((id)=>id.substring(0, 6)).join(', ')
|
|
410
|
-
}));
|
|
411
|
-
yield /*#__PURE__*/ jsx(List, {
|
|
412
|
-
items: data,
|
|
413
|
-
headers: true
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
} else if (tasks.tasks.length > 0) {
|
|
417
|
-
// Render
|
|
418
|
-
yield /*#__PURE__*/ jsx(TaskTreeSpinner, {
|
|
419
|
-
manager: this.manager
|
|
420
|
-
});
|
|
421
|
-
// Start tasks
|
|
422
|
-
tasks.start(this.manager);
|
|
423
|
-
const result = await waitFor$(tasks, 'finished');
|
|
424
|
-
this.app.clear();
|
|
425
|
-
yield /*#__PURE__*/ jsx(TaskTreeCompleted, {
|
|
426
|
-
manager: this.manager
|
|
427
|
-
});
|
|
428
|
-
if (result.failed > 0) {
|
|
429
|
-
throw new ExitException(1);
|
|
430
|
-
}
|
|
431
|
-
} else {
|
|
432
|
-
const logger = container.get(Logger);
|
|
433
|
-
logger.warning('No task found');
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
_([
|
|
438
|
-
lazyInject(TASK_MANAGER)
|
|
439
|
-
], TaskCommand.prototype, "manager", void 0);
|
|
440
|
-
TaskCommand = _([
|
|
441
|
-
injectable()
|
|
442
|
-
], TaskCommand);
|
|
443
|
-
|
|
444
|
-
var name = "@jujulego/jill";
|
|
445
|
-
var version = "3.0.0-alpha.1";
|
|
446
|
-
var license = "MIT";
|
|
447
|
-
var repository = {
|
|
448
|
-
type: "git",
|
|
449
|
-
url: "https://github.com/Jujulego/jill"
|
|
450
|
-
};
|
|
451
|
-
var files = [
|
|
452
|
-
"./bin",
|
|
453
|
-
"./dist"
|
|
454
|
-
];
|
|
455
|
-
var type = "module";
|
|
456
|
-
var bin = "./bin/jill.js";
|
|
457
|
-
var exports = "./dist/index.js";
|
|
458
|
-
var scripts = {
|
|
459
|
-
lint: "eslint .",
|
|
460
|
-
clean: "shx rm -rf dist",
|
|
461
|
-
build: "yarn run build:bundle && yarn run build:types",
|
|
462
|
-
"build:bundle": "rollup -c",
|
|
463
|
-
"build:types": "tsc -p tsconfig.build.json",
|
|
464
|
-
watch: "rollup -c --watch",
|
|
465
|
-
test: "vitest run tests tools",
|
|
466
|
-
e2e: "vitest run e2e",
|
|
467
|
-
"e2e:npm": "yarn run e2e -t npm",
|
|
468
|
-
"e2e:yarn": "yarn run e2e -t yarn"
|
|
469
|
-
};
|
|
470
|
-
var engines = {
|
|
471
|
-
node: "18.x || 20.x || 22.x"
|
|
472
|
-
};
|
|
473
|
-
var dependencies = {
|
|
474
|
-
"@jujulego/aegis": "^2.1.0",
|
|
475
|
-
"@jujulego/event-tree": "^4.3.0",
|
|
476
|
-
"@jujulego/logger": "^0.2.4",
|
|
477
|
-
"@jujulego/quick-tag": "^0.3.3",
|
|
478
|
-
"@jujulego/tasks": "^2.2.0",
|
|
479
|
-
"@jujulego/utils": "^3.0.0",
|
|
480
|
-
"@swc/helpers": "^0.5.3",
|
|
481
|
-
ajv: "^8.12.0",
|
|
482
|
-
chalk: "^5.3.0",
|
|
483
|
-
"chalk-template": "^1.1.0",
|
|
484
|
-
cosmiconfig: "^9.0.0",
|
|
485
|
-
glob: "^10.3.10",
|
|
486
|
-
ink: "^4.3.0",
|
|
487
|
-
"ink-spinner": "^5.0.0",
|
|
488
|
-
inversify: "^6.0.1",
|
|
489
|
-
"inversify-inject-decorators": "^3.1.0",
|
|
490
|
-
"log-symbols": "^6.0.0",
|
|
491
|
-
moo: "^0.5.2",
|
|
492
|
-
"normalize-package-data": "^6.0.0",
|
|
493
|
-
"path-scurry": "^1.10.1",
|
|
494
|
-
"pretty-ms": "^9.0.0",
|
|
495
|
-
react: "^18.2.0",
|
|
496
|
-
"reflect-metadata": "^0.2.0",
|
|
497
|
-
semver: "^7.5.4",
|
|
498
|
-
slugify: "^1.6.6",
|
|
499
|
-
yargs: "^17.7.2"
|
|
500
|
-
};
|
|
501
|
-
var devDependencies = {
|
|
502
|
-
"@jujulego/2d-maths": "1.6.0",
|
|
503
|
-
"@jujulego/vite-plugin-swc": "1.2.0",
|
|
504
|
-
"@microsoft/eslint-formatter-sarif": "3.1.0",
|
|
505
|
-
"@rollup/plugin-json": "6.1.0",
|
|
506
|
-
"@rollup/plugin-node-resolve": "15.3.0",
|
|
507
|
-
"@swc/core": "1.6.5",
|
|
508
|
-
"@types/moo": "0.5.9",
|
|
509
|
-
"@types/node": "22.13.14",
|
|
510
|
-
"@types/normalize-package-data": "2.4.4",
|
|
511
|
-
"@types/react": "18.3.14",
|
|
512
|
-
"@types/semver": "7.5.8",
|
|
513
|
-
"@types/yargs": "17.0.33",
|
|
514
|
-
"@typescript-eslint/eslint-plugin": "7.18.0",
|
|
515
|
-
"@typescript-eslint/parser": "7.18.0",
|
|
516
|
-
"@vitest/coverage-v8": "3.2.4",
|
|
517
|
-
browserslist: "4.24.2",
|
|
518
|
-
eslint: "8.57.1",
|
|
519
|
-
"eslint-plugin-react": "7.37.2",
|
|
520
|
-
"eslint-plugin-react-hooks": "4.6.2",
|
|
521
|
-
"eslint-plugin-vitest": "0.4.1",
|
|
522
|
-
"eslint-plugin-workspaces": "0.10.1",
|
|
523
|
-
"ink-testing-library": "3.0.0",
|
|
524
|
-
memfs: "4.15.0",
|
|
525
|
-
rollup: "4.28.1",
|
|
526
|
-
shx: "0.3.4",
|
|
527
|
-
"ts-node": "10.9.2",
|
|
528
|
-
typescript: "5.7.2",
|
|
529
|
-
vite: "5.4.11",
|
|
530
|
-
"vite-tsconfig-paths": "5.1.4",
|
|
531
|
-
vitest: "3.2.4"
|
|
532
|
-
};
|
|
533
|
-
var packageManager = "yarn@4.9.2";
|
|
534
|
-
var pkg = {
|
|
535
|
-
name: name,
|
|
536
|
-
version: version,
|
|
537
|
-
license: license,
|
|
538
|
-
repository: repository,
|
|
539
|
-
files: files,
|
|
540
|
-
type: type,
|
|
541
|
-
bin: bin,
|
|
542
|
-
exports: exports,
|
|
543
|
-
scripts: scripts,
|
|
544
|
-
engines: engines,
|
|
545
|
-
dependencies: dependencies,
|
|
546
|
-
devDependencies: devDependencies,
|
|
547
|
-
packageManager: packageManager
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
class JillApplication {
|
|
551
|
-
// Constructor
|
|
552
|
-
constructor(context, plugins, logger){
|
|
553
|
-
this.context = context;
|
|
554
|
-
this.plugins = plugins;
|
|
555
|
-
this.logger = logger;
|
|
556
|
-
// Create container
|
|
557
|
-
this.container = container.createChild();
|
|
558
|
-
// Create parser
|
|
559
|
-
this.parser = yargs().scriptName('jill').completion('completion', 'Generate bash completion script').help('help', 'Show help for a command').version('version', 'Show version', pkg.version).wrap(process.stdout.columns).exitProcess(false);
|
|
560
|
-
}
|
|
561
|
-
// Methods
|
|
562
|
-
_prepareParser(commands) {
|
|
563
|
-
applyConfigOptions(this.parser);
|
|
564
|
-
return this.parser.command(commands).recommendCommands().strict().fail(false);
|
|
565
|
-
}
|
|
566
|
-
async _loadPlugins() {
|
|
567
|
-
this.logger.child(withLabel('plugin')).verbose('Loading plugin <core>');
|
|
568
|
-
const { CorePlugin } = await import('./core.plugin-CxgfxFUI.js');
|
|
569
|
-
this.container.load(getModule(CorePlugin, true));
|
|
570
|
-
await this.plugins.loadPlugins(this.container);
|
|
571
|
-
}
|
|
572
|
-
async run(argv) {
|
|
573
|
-
this.context.reset({
|
|
574
|
-
application: this
|
|
575
|
-
});
|
|
576
|
-
await this._loadPlugins();
|
|
577
|
-
// Parse command
|
|
578
|
-
const commands = await this.container.getAllAsync(COMMAND_MODULE);
|
|
579
|
-
await this._prepareParser(commands).parseAsync(argv);
|
|
580
|
-
}
|
|
581
|
-
async tasksOf(argv, ctx = {}) {
|
|
582
|
-
this.context.reset({
|
|
583
|
-
...ctx,
|
|
584
|
-
application: this
|
|
585
|
-
});
|
|
586
|
-
await this._loadPlugins();
|
|
587
|
-
// Prepare commands
|
|
588
|
-
const commands = await this.container.getAllAsync(COMMAND);
|
|
589
|
-
return new Promise((resolve, reject)=>{
|
|
590
|
-
const modules = [];
|
|
591
|
-
for (const cmd of commands){
|
|
592
|
-
const opts = getCommandOpts(cmd.constructor);
|
|
593
|
-
const mod = buildCommandModule(cmd, opts);
|
|
594
|
-
mod.handler = async (args)=>{
|
|
595
|
-
if (cmd instanceof TaskCommand) {
|
|
596
|
-
const tasks = [];
|
|
597
|
-
for await (const tsk of cmd.prepare({
|
|
598
|
-
...args,
|
|
599
|
-
plan: true
|
|
600
|
-
})){
|
|
601
|
-
tasks.push(tsk);
|
|
602
|
-
}
|
|
603
|
-
resolve(tasks);
|
|
604
|
-
} else {
|
|
605
|
-
resolve([]);
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
modules.push(mod);
|
|
609
|
-
}
|
|
610
|
-
// Parse command
|
|
611
|
-
this._prepareParser(modules).parseAsync(argv).catch(reject);
|
|
612
|
-
});
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
JillApplication = _([
|
|
616
|
-
injectable(),
|
|
617
|
-
_$1(0, inject(ContextService)),
|
|
618
|
-
_$1(1, inject(PluginLoaderService)),
|
|
619
|
-
_$1(2, inject(Logger))
|
|
620
|
-
], JillApplication);
|
|
621
|
-
container.bind(JillApplication).toSelf().inTransientScope().whenTargetIsDefault();
|
|
622
|
-
container.bind(JillApplication).toDynamicValue(({ container })=>{
|
|
623
|
-
const ctx = container.get(ContextService);
|
|
624
|
-
const app = ctx.application;
|
|
625
|
-
if (!app) {
|
|
626
|
-
throw new Error('Cannot inject current application, it not yet defined');
|
|
627
|
-
}
|
|
628
|
-
return app;
|
|
629
|
-
}).whenTargetNamed(CURRENT);
|
|
630
|
-
|
|
631
|
-
var jill_application = /*#__PURE__*/Object.freeze({
|
|
632
|
-
__proto__: null,
|
|
633
|
-
get JillApplication () { return JillApplication; }
|
|
634
|
-
});
|
|
635
|
-
|
|
636
|
-
export { JillApplication as J, TaskCommand as T, jill_application as j };
|
|
637
|
-
//# sourceMappingURL=jill.application-DNJpmnCF.js.map
|