@enspirit/emb 0.0.6 → 0.0.7
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 +60 -13
- package/dist/src/cli/commands/clean.d.ts +3 -1
- package/dist/src/cli/commands/clean.js +13 -2
- package/dist/src/cli/commands/components/build.d.ts +6 -2
- package/dist/src/cli/commands/components/build.js +16 -7
- package/dist/src/cli/commands/config/print.js +2 -3
- package/dist/src/cli/commands/down.d.ts +2 -2
- package/dist/src/cli/commands/down.js +5 -25
- package/dist/src/cli/commands/tasks/index.js +11 -5
- package/dist/src/cli/commands/tasks/run.d.ts +1 -1
- package/dist/src/cli/commands/tasks/run.js +10 -43
- package/dist/src/cli/commands/up.d.ts +1 -1
- package/dist/src/cli/commands/up.js +12 -34
- package/dist/src/config/convert.js +2 -4
- package/dist/src/config/index.d.ts +1 -0
- package/dist/src/config/index.js +1 -0
- package/dist/src/config/schema.d.ts +32 -25
- package/dist/src/config/schema.json +48 -26
- package/dist/src/config/types.d.ts +10 -6
- package/dist/src/docker/compose/index.d.ts +1 -7
- package/dist/src/docker/compose/index.js +1 -13
- package/dist/src/docker/compose/operations/ComposeDownOperation.d.ts +12 -0
- package/dist/src/docker/compose/operations/ComposeDownOperation.js +21 -0
- package/dist/src/docker/compose/operations/ComposeUpOperation.d.ts +13 -0
- package/dist/src/docker/compose/operations/ComposeUpOperation.js +39 -0
- package/dist/src/docker/compose/operations/index.d.ts +2 -0
- package/dist/src/docker/compose/operations/index.js +2 -0
- package/dist/src/monorepo/component.d.ts +2 -2
- package/dist/src/monorepo/component.js +6 -6
- package/dist/src/monorepo/config.d.ts +4 -2
- package/dist/src/monorepo/config.js +14 -2
- package/dist/src/monorepo/index.d.ts +2 -0
- package/dist/src/monorepo/index.js +2 -0
- package/dist/src/monorepo/monorepo.d.ts +4 -2
- package/dist/src/monorepo/monorepo.js +30 -6
- package/dist/src/monorepo/operations/components/BuildComponentsOperation.d.ts +11 -2
- package/dist/src/monorepo/operations/components/BuildComponentsOperation.js +45 -59
- package/dist/src/monorepo/operations/components/GetComponentContainerOperation.d.ts +1 -1
- package/dist/src/monorepo/operations/components/GetComponentContainerOperation.js +1 -1
- package/dist/src/monorepo/operations/shell/ExecuteLocalCommandOperation.d.ts +4 -6
- package/dist/src/monorepo/operations/shell/ExecuteLocalCommandOperation.js +2 -7
- package/dist/src/monorepo/operations/tasks/RunTasksOperation.d.ts +21 -0
- package/dist/src/monorepo/operations/tasks/RunTasksOperation.js +84 -0
- package/dist/src/monorepo/operations/tasks/index.d.ts +1 -1
- package/dist/src/monorepo/operations/tasks/index.js +1 -1
- package/dist/src/monorepo/plugins/ComponentDiscoverPlugin.js +3 -1
- package/dist/src/monorepo/plugins/EmbfileLoaderPlugin.d.ts +3 -3
- package/dist/src/monorepo/plugins/EmbfileLoaderPlugin.js +9 -5
- package/dist/src/monorepo/store/index.js +5 -3
- package/dist/src/monorepo/taskManagerFactory.d.ts +3 -0
- package/dist/src/monorepo/taskManagerFactory.js +20 -0
- package/dist/src/monorepo/types.d.ts +2 -1
- package/dist/src/monorepo/utils/findRunOrder.d.ts +34 -0
- package/dist/src/monorepo/utils/findRunOrder.js +165 -0
- package/dist/src/monorepo/utils/index.d.ts +1 -1
- package/dist/src/monorepo/utils/index.js +1 -1
- package/oclif.manifest.json +63 -40
- package/package.json +4 -2
- package/dist/src/monorepo/operations/tasks/RunTaskOperation.d.ts +0 -18
- package/dist/src/monorepo/operations/tasks/RunTaskOperation.js +0 -50
- package/dist/src/monorepo/utils/findBuildOrder.d.ts +0 -2
- package/dist/src/monorepo/utils/findBuildOrder.js +0 -41
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ $ npm install -g @enspirit/emb
|
|
|
14
14
|
$ emb COMMAND
|
|
15
15
|
running command...
|
|
16
16
|
$ emb (--version)
|
|
17
|
-
@enspirit/emb/0.0.
|
|
17
|
+
@enspirit/emb/0.0.7 darwin-x64 node-v22.12.0
|
|
18
18
|
$ emb --help [COMMAND]
|
|
19
19
|
USAGE
|
|
20
20
|
$ emb COMMAND
|
|
@@ -37,8 +37,9 @@ USAGE
|
|
|
37
37
|
* [`emb images prune`](#emb-images-prune)
|
|
38
38
|
* [`emb ps`](#emb-ps)
|
|
39
39
|
* [`emb tasks`](#emb-tasks)
|
|
40
|
-
* [`emb tasks run
|
|
40
|
+
* [`emb tasks run TASK`](#emb-tasks-run-task)
|
|
41
41
|
* [`emb up`](#emb-up)
|
|
42
|
+
* [`emb update [CHANNEL]`](#emb-update-channel)
|
|
42
43
|
|
|
43
44
|
## `emb autocomplete [SHELL]`
|
|
44
45
|
|
|
@@ -77,7 +78,10 @@ Clean the project.
|
|
|
77
78
|
|
|
78
79
|
```
|
|
79
80
|
USAGE
|
|
80
|
-
$ emb clean [--json]
|
|
81
|
+
$ emb clean [--json] [-f]
|
|
82
|
+
|
|
83
|
+
FLAGS
|
|
84
|
+
-f, --force Force the deletion of containers & images
|
|
81
85
|
|
|
82
86
|
GLOBAL FLAGS
|
|
83
87
|
--json Format output as json.
|
|
@@ -116,12 +120,13 @@ Build the components of the monorepo
|
|
|
116
120
|
|
|
117
121
|
```
|
|
118
122
|
USAGE
|
|
119
|
-
$ emb components build [COMPONENT...] [--json] [--flavor <value>]
|
|
123
|
+
$ emb components build [COMPONENT...] [--json] [--flavor <value>] [--dry-run]
|
|
120
124
|
|
|
121
125
|
ARGUMENTS
|
|
122
|
-
COMPONENT... List of components to build
|
|
126
|
+
COMPONENT... List of components to build (defaults to all)
|
|
123
127
|
|
|
124
128
|
FLAGS
|
|
129
|
+
--dry-run Do not build the components but only produce build meta information
|
|
125
130
|
--flavor=<value> Specify the flavor to use.
|
|
126
131
|
|
|
127
132
|
GLOBAL FLAGS
|
|
@@ -203,7 +208,10 @@ Stop the whole project.
|
|
|
203
208
|
|
|
204
209
|
```
|
|
205
210
|
USAGE
|
|
206
|
-
$ emb down [--json]
|
|
211
|
+
$ emb down [--json] [--flavor <value>]
|
|
212
|
+
|
|
213
|
+
FLAGS
|
|
214
|
+
--flavor=<value> Specify the flavor to use.
|
|
207
215
|
|
|
208
216
|
GLOBAL FLAGS
|
|
209
217
|
--json Format output as json.
|
|
@@ -340,25 +348,26 @@ EXAMPLES
|
|
|
340
348
|
$ emb tasks
|
|
341
349
|
```
|
|
342
350
|
|
|
343
|
-
## `emb tasks run
|
|
351
|
+
## `emb tasks run TASK`
|
|
344
352
|
|
|
345
|
-
Run
|
|
353
|
+
Run tasks.
|
|
346
354
|
|
|
347
355
|
```
|
|
348
356
|
USAGE
|
|
349
|
-
$ emb tasks run
|
|
357
|
+
$ emb tasks run TASK... [--json] [-x container|local]
|
|
350
358
|
|
|
351
359
|
ARGUMENTS
|
|
352
|
-
TASK... List of tasks
|
|
360
|
+
TASK... List of tasks to run. You can provide either ids or names (eg: component:task or task)
|
|
353
361
|
|
|
354
362
|
FLAGS
|
|
355
|
-
-x, --executor=<option>
|
|
363
|
+
-x, --executor=<option> Where to run the task. (experimental!)
|
|
364
|
+
<options: container|local>
|
|
356
365
|
|
|
357
366
|
GLOBAL FLAGS
|
|
358
367
|
--json Format output as json.
|
|
359
368
|
|
|
360
369
|
DESCRIPTION
|
|
361
|
-
Run
|
|
370
|
+
Run tasks.
|
|
362
371
|
|
|
363
372
|
EXAMPLES
|
|
364
373
|
$ emb tasks run
|
|
@@ -373,7 +382,7 @@ USAGE
|
|
|
373
382
|
$ emb up [--json] [--flavor <value>] [-f]
|
|
374
383
|
|
|
375
384
|
FLAGS
|
|
376
|
-
-f, --force
|
|
385
|
+
-f, --force Bypass caches, force the recreation of containers, etc
|
|
377
386
|
--flavor=<value> Specify the flavor to use.
|
|
378
387
|
|
|
379
388
|
GLOBAL FLAGS
|
|
@@ -385,4 +394,42 @@ DESCRIPTION
|
|
|
385
394
|
EXAMPLES
|
|
386
395
|
$ emb up
|
|
387
396
|
```
|
|
397
|
+
|
|
398
|
+
## `emb update [CHANNEL]`
|
|
399
|
+
|
|
400
|
+
update the emb CLI
|
|
401
|
+
|
|
402
|
+
```
|
|
403
|
+
USAGE
|
|
404
|
+
$ emb update [CHANNEL] [--force | | [-a | -v <value> | -i]] [-b ]
|
|
405
|
+
|
|
406
|
+
FLAGS
|
|
407
|
+
-a, --available See available versions.
|
|
408
|
+
-b, --verbose Show more details about the available versions.
|
|
409
|
+
-i, --interactive Interactively select version to install. This is ignored if a channel is provided.
|
|
410
|
+
-v, --version=<value> Install a specific version.
|
|
411
|
+
--force Force a re-download of the requested version.
|
|
412
|
+
|
|
413
|
+
DESCRIPTION
|
|
414
|
+
update the emb CLI
|
|
415
|
+
|
|
416
|
+
EXAMPLES
|
|
417
|
+
Update to the stable channel:
|
|
418
|
+
|
|
419
|
+
$ emb update stable
|
|
420
|
+
|
|
421
|
+
Update to a specific version:
|
|
422
|
+
|
|
423
|
+
$ emb update --version 1.0.0
|
|
424
|
+
|
|
425
|
+
Interactively select version:
|
|
426
|
+
|
|
427
|
+
$ emb update --interactive
|
|
428
|
+
|
|
429
|
+
See available versions:
|
|
430
|
+
|
|
431
|
+
$ emb update --available
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
_See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v4.7.3/src/commands/update.ts)_
|
|
388
435
|
<!-- commandsstop -->
|
|
@@ -10,6 +10,8 @@ export default class CleanCommand extends Command {
|
|
|
10
10
|
static description: string;
|
|
11
11
|
static enableJsonFlag: boolean;
|
|
12
12
|
static examples: string[];
|
|
13
|
-
static flags: {
|
|
13
|
+
static flags: {
|
|
14
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
};
|
|
14
16
|
run(): Promise<void>;
|
|
15
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getContext } from '../../index.js';
|
|
2
|
-
import { Command } from '@oclif/core';
|
|
2
|
+
import { Command, Flags } from '@oclif/core';
|
|
3
3
|
import { Listr } from 'listr2';
|
|
4
4
|
/**
|
|
5
5
|
* For now, only cleans the stores (logs/sentinels)
|
|
@@ -12,9 +12,16 @@ export default class CleanCommand extends Command {
|
|
|
12
12
|
static description = 'Clean the project.';
|
|
13
13
|
static enableJsonFlag = true;
|
|
14
14
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
15
|
-
static flags = {
|
|
15
|
+
static flags = {
|
|
16
|
+
force: Flags.boolean({
|
|
17
|
+
name: 'force',
|
|
18
|
+
char: 'f',
|
|
19
|
+
description: 'Force the deletion of containers & images',
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
16
22
|
async run() {
|
|
17
23
|
const { monorepo } = getContext();
|
|
24
|
+
const { flags } = await this.parse(CleanCommand);
|
|
18
25
|
const runner = new Listr([
|
|
19
26
|
{
|
|
20
27
|
rendererOptions: { persistentOutput: true },
|
|
@@ -25,5 +32,9 @@ export default class CleanCommand extends Command {
|
|
|
25
32
|
},
|
|
26
33
|
]);
|
|
27
34
|
await runner.run();
|
|
35
|
+
await this.config.runCommand('down');
|
|
36
|
+
await this.config.runCommand('containers:prune');
|
|
37
|
+
await this.config.runCommand('images:delete', flags.force ? ['--force'] : undefined);
|
|
38
|
+
await this.config.runCommand('images:prune', flags.force ? ['-a'] : undefined);
|
|
28
39
|
}
|
|
29
40
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { FlavoredCommand } from '../../index.js';
|
|
2
|
+
import { BuildComponentMeta } from '../../../monorepo/index.js';
|
|
2
3
|
export default class BuildCommand extends FlavoredCommand<typeof BuildCommand> {
|
|
3
4
|
static args: {
|
|
4
5
|
component: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
5
6
|
};
|
|
6
7
|
static description: string;
|
|
7
8
|
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
+
static flags: {
|
|
10
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
static enableJsonFlag: boolean;
|
|
9
13
|
static strict: boolean;
|
|
10
|
-
run(): Promise<
|
|
14
|
+
run(): Promise<Record<string, BuildComponentMeta>>;
|
|
11
15
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Args } from '@oclif/core';
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import { FlavoredCommand, getContext } from '../../index.js';
|
|
3
|
-
import { BuildComponentsOperation } from '../../../monorepo/
|
|
3
|
+
import { BuildComponentsOperation } from '../../../monorepo/index.js';
|
|
4
4
|
export default class BuildCommand extends FlavoredCommand {
|
|
5
5
|
static args = {
|
|
6
6
|
component: Args.string({
|
|
7
|
-
description: 'List of components to build',
|
|
7
|
+
description: 'List of components to build (defaults to all)',
|
|
8
8
|
required: false,
|
|
9
9
|
}),
|
|
10
10
|
};
|
|
@@ -12,13 +12,22 @@ export default class BuildCommand extends FlavoredCommand {
|
|
|
12
12
|
static examples = [
|
|
13
13
|
`<%= config.bin %> <%= command.id %> build --flavor development`,
|
|
14
14
|
];
|
|
15
|
-
static flags = {
|
|
15
|
+
static flags = {
|
|
16
|
+
'dry-run': Flags.boolean({
|
|
17
|
+
required: false,
|
|
18
|
+
description: 'Do not build the components but only produce build meta information',
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
static enableJsonFlag = true;
|
|
16
22
|
static strict = false;
|
|
17
23
|
async run() {
|
|
18
|
-
const { argv } = await this.parse(BuildCommand);
|
|
24
|
+
const { argv, flags } = await this.parse(BuildCommand);
|
|
19
25
|
const { monorepo } = getContext();
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
return monorepo.run(new BuildComponentsOperation(), {
|
|
27
|
+
dryRun: flags['dry-run'],
|
|
28
|
+
components: argv.length > 0
|
|
29
|
+
? argv
|
|
30
|
+
: monorepo.components.map((c) => c.name),
|
|
22
31
|
});
|
|
23
32
|
}
|
|
24
33
|
}
|
|
@@ -7,10 +7,9 @@ export default class ConfigPrint extends FlavoredCommand {
|
|
|
7
7
|
async run() {
|
|
8
8
|
const { flags } = await this.parse(ConfigPrint);
|
|
9
9
|
const context = await getContext();
|
|
10
|
-
const { monorepo } = context;
|
|
11
10
|
if (!flags.json) {
|
|
12
|
-
this.log(YAML.stringify(monorepo.config));
|
|
11
|
+
this.log(YAML.stringify(context.monorepo.config));
|
|
13
12
|
}
|
|
14
|
-
return monorepo.config;
|
|
13
|
+
return context.monorepo.config;
|
|
15
14
|
}
|
|
16
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class DownCommand extends
|
|
1
|
+
import { FlavoredCommand } from '../index.js';
|
|
2
|
+
export default class DownCommand extends FlavoredCommand<typeof DownCommand> {
|
|
3
3
|
static description: string;
|
|
4
4
|
static enableJsonFlag: boolean;
|
|
5
5
|
static examples: string[];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { getContext } from '../../index.js';
|
|
2
|
-
import { Command } from '@oclif/core';
|
|
3
1
|
import { Listr } from 'listr2';
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { FlavoredCommand, getContext } from '../index.js';
|
|
3
|
+
import { ComposeDownOperation } from '../../docker/index.js';
|
|
4
|
+
export default class DownCommand extends FlavoredCommand {
|
|
6
5
|
static description = 'Stop the whole project.';
|
|
7
6
|
static enableJsonFlag = true;
|
|
8
7
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -12,27 +11,8 @@ export default class DownCommand extends Command {
|
|
|
12
11
|
const runner = new Listr([
|
|
13
12
|
{
|
|
14
13
|
rendererOptions: { persistentOutput: true },
|
|
15
|
-
async task(
|
|
16
|
-
|
|
17
|
-
const handleOutput = (chunk) => {
|
|
18
|
-
const line = chunk.toString();
|
|
19
|
-
task.output = line.trimEnd(); // This updates the live output in Listr
|
|
20
|
-
};
|
|
21
|
-
process.stdout?.on('data', handleOutput);
|
|
22
|
-
process.stderr?.on('data', handleOutput);
|
|
23
|
-
return new Promise((resolve, reject) => {
|
|
24
|
-
process.on('exit', (code) => {
|
|
25
|
-
if (code === 0) {
|
|
26
|
-
resolve(null);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
reject(new Error(`Command failed with code ${code}`));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
process.on('error', (err) => {
|
|
33
|
-
reject(err);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
14
|
+
async task() {
|
|
15
|
+
return monorepo.run(new ComposeDownOperation(), {});
|
|
36
16
|
},
|
|
37
17
|
title: 'Stopping project',
|
|
38
18
|
},
|
|
@@ -9,14 +9,20 @@ export default class TasksIndex extends Command {
|
|
|
9
9
|
static flags = {};
|
|
10
10
|
async run() {
|
|
11
11
|
const { flags } = await this.parse(TasksIndex);
|
|
12
|
-
const
|
|
13
|
-
const { monorepo } = context;
|
|
14
|
-
const { tasks } = monorepo;
|
|
12
|
+
const { monorepo: { tasks }, } = await getContext();
|
|
15
13
|
if (!flags.json)
|
|
16
14
|
printTable({
|
|
17
15
|
...TABLE_DEFAULTS,
|
|
18
|
-
columns: ['
|
|
19
|
-
data: tasks,
|
|
16
|
+
columns: ['name', 'component', 'description', 'id'],
|
|
17
|
+
data: tasks.toSorted((a, b) => {
|
|
18
|
+
if (a.component === b.component) {
|
|
19
|
+
return a.name < b.name ? -1 : 1;
|
|
20
|
+
}
|
|
21
|
+
if (!a.component && b.component) {
|
|
22
|
+
return -1;
|
|
23
|
+
}
|
|
24
|
+
return 0;
|
|
25
|
+
}),
|
|
20
26
|
});
|
|
21
27
|
return tasks;
|
|
22
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
export default class RunTask extends Command {
|
|
3
3
|
static args: {
|
|
4
|
-
task: import("@oclif/core/interfaces").Arg<string
|
|
4
|
+
task: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
6
|
static description: string;
|
|
7
7
|
static enableJsonFlag: boolean;
|
|
@@ -1,64 +1,31 @@
|
|
|
1
1
|
import { getContext } from '../../../index.js';
|
|
2
2
|
import { Args, Command, Flags } from '@oclif/core';
|
|
3
|
-
import {
|
|
4
|
-
import { ExecutorType, RunTaskOperation, } from '../../../monorepo/operations/tasks/RunTaskOperation.js';
|
|
3
|
+
import { ExecutorType, RunTasksOperation } from '../../../monorepo/index.js';
|
|
5
4
|
export default class RunTask extends Command {
|
|
6
5
|
static args = {
|
|
7
6
|
task: Args.string({
|
|
8
|
-
description: 'List of tasks
|
|
9
|
-
required:
|
|
7
|
+
description: 'List of tasks to run. You can provide either ids or names (eg: component:task or task)',
|
|
8
|
+
required: true,
|
|
10
9
|
}),
|
|
11
10
|
};
|
|
12
|
-
static description = 'Run
|
|
11
|
+
static description = 'Run tasks.';
|
|
13
12
|
static enableJsonFlag = true;
|
|
14
13
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
15
14
|
static flags = {
|
|
16
15
|
executor: Flags.string({
|
|
17
|
-
char: 'x',
|
|
18
16
|
name: 'executor',
|
|
17
|
+
char: 'x',
|
|
18
|
+
description: 'Where to run the task. (experimental!)',
|
|
19
19
|
options: Object.values(ExecutorType),
|
|
20
20
|
}),
|
|
21
21
|
};
|
|
22
22
|
static strict = false;
|
|
23
23
|
async run() {
|
|
24
24
|
const { argv, flags } = await this.parse(RunTask);
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const found = monorepo.tasks.filter((task) => task.id === t);
|
|
30
|
-
if (found.length === 0) {
|
|
31
|
-
throw new Error(`Task ${t} not found`);
|
|
32
|
-
}
|
|
33
|
-
return [...tasks, ...found];
|
|
34
|
-
}, [])
|
|
35
|
-
: monorepo.tasks;
|
|
36
|
-
const runTasks = toRun.map((task) => {
|
|
37
|
-
const executor = flags.executor ||
|
|
38
|
-
(task.component ? ExecutorType.container : ExecutorType.local);
|
|
39
|
-
return {
|
|
40
|
-
rendererOptions: { persistentOutput: true },
|
|
41
|
-
async task(_ctx, listrTask) {
|
|
42
|
-
await monorepo.run(new RunTaskOperation(listrTask.stdout()), {
|
|
43
|
-
executor,
|
|
44
|
-
task,
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
title: `Running ${task.id} (${executor})`,
|
|
48
|
-
};
|
|
25
|
+
const { monorepo } = await getContext();
|
|
26
|
+
await monorepo.run(new RunTasksOperation(), {
|
|
27
|
+
tasks: argv,
|
|
28
|
+
executor: flags.executor,
|
|
49
29
|
});
|
|
50
|
-
const runner = new Listr([
|
|
51
|
-
{
|
|
52
|
-
rendererOptions: { persistentOutput: true },
|
|
53
|
-
async task(ctx, task) {
|
|
54
|
-
return task.newListr(runTasks, {
|
|
55
|
-
exitOnError: true,
|
|
56
|
-
rendererOptions: { collapseSubtasks: false },
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
title: 'Running tasks',
|
|
60
|
-
},
|
|
61
|
-
]);
|
|
62
|
-
await runner.run();
|
|
63
30
|
}
|
|
64
31
|
}
|
|
@@ -4,7 +4,7 @@ export default class UpCommand extends FlavoredCommand<typeof UpCommand> {
|
|
|
4
4
|
static enableJsonFlag: boolean;
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
|
-
|
|
7
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
8
|
};
|
|
9
9
|
run(): Promise<void>;
|
|
10
10
|
}
|
|
@@ -1,49 +1,27 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import { Listr } from 'listr2';
|
|
3
2
|
import { FlavoredCommand, getContext } from '../index.js';
|
|
4
|
-
import {
|
|
3
|
+
import { ComposeUpOperation } from '../../docker/index.js';
|
|
4
|
+
import { BuildComponentsOperation } from '../../monorepo/index.js';
|
|
5
5
|
export default class UpCommand extends FlavoredCommand {
|
|
6
6
|
static description = 'Start the whole project.';
|
|
7
7
|
static enableJsonFlag = true;
|
|
8
8
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
9
9
|
static flags = {
|
|
10
|
-
|
|
10
|
+
force: Flags.boolean({
|
|
11
11
|
char: 'f',
|
|
12
12
|
default: false,
|
|
13
|
-
description:
|
|
14
|
-
name: 'force
|
|
13
|
+
description: 'Bypass caches, force the recreation of containers, etc',
|
|
14
|
+
name: 'force',
|
|
15
15
|
}),
|
|
16
16
|
};
|
|
17
17
|
async run() {
|
|
18
|
+
const { flags } = await this.parse(UpCommand);
|
|
18
19
|
const { monorepo } = getContext();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const line = chunk.toString();
|
|
26
|
-
task.output = line.trimEnd(); // This updates the live output in Listr
|
|
27
|
-
};
|
|
28
|
-
process.stdout?.on('data', handleOutput);
|
|
29
|
-
process.stderr?.on('data', handleOutput);
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
process.on('exit', (code) => {
|
|
32
|
-
if (code === 0) {
|
|
33
|
-
resolve(null);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
reject(new Error(`Command failed with code ${code}`));
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
process.on('error', (err) => {
|
|
40
|
-
reject(err);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
title: 'Starting project',
|
|
45
|
-
},
|
|
46
|
-
]);
|
|
47
|
-
await runner.run();
|
|
20
|
+
await monorepo.run(new BuildComponentsOperation(), {
|
|
21
|
+
components: monorepo.components.map((c) => c.name),
|
|
22
|
+
});
|
|
23
|
+
await monorepo.run(new ComposeUpOperation(), {
|
|
24
|
+
forceRecreate: flags.force,
|
|
25
|
+
});
|
|
48
26
|
}
|
|
49
27
|
}
|
|
@@ -19,8 +19,9 @@ export const toProjectConfig = (config, rootDir) => {
|
|
|
19
19
|
project.rootDir = rootDir || cwd();
|
|
20
20
|
}
|
|
21
21
|
const components = config.components || [];
|
|
22
|
-
const { defaults,
|
|
22
|
+
const { defaults, flavors, ...rest } = config;
|
|
23
23
|
return {
|
|
24
|
+
...rest,
|
|
24
25
|
components,
|
|
25
26
|
defaults: {
|
|
26
27
|
...defaults,
|
|
@@ -32,12 +33,9 @@ export const toProjectConfig = (config, rootDir) => {
|
|
|
32
33
|
},
|
|
33
34
|
},
|
|
34
35
|
},
|
|
35
|
-
env,
|
|
36
36
|
flavors: flavors?.map(toFlavor),
|
|
37
|
-
plugins,
|
|
38
37
|
project: {
|
|
39
38
|
...project,
|
|
40
39
|
},
|
|
41
|
-
vars,
|
|
42
40
|
};
|
|
43
41
|
};
|
package/dist/src/config/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { dirname } from 'node:path';
|
|
|
3
3
|
import { toProjectConfig } from './convert.js';
|
|
4
4
|
import { validateUserConfig } from './validation.js';
|
|
5
5
|
export * from './convert.js';
|
|
6
|
+
export * from './schema.js';
|
|
6
7
|
export * from './types.js';
|
|
7
8
|
export * from './validation.js';
|
|
8
9
|
let config;
|
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
4
|
* and run json-schema-to-typescript to regenerate this file.
|
|
5
5
|
*/
|
|
6
|
+
export type Task = Task1 & {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
script?: string;
|
|
10
|
+
executor?: string;
|
|
11
|
+
options?: {
|
|
12
|
+
[k: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
pre?: string[];
|
|
15
|
+
};
|
|
16
|
+
export type Task1 = {
|
|
17
|
+
[k: string]: unknown;
|
|
18
|
+
};
|
|
6
19
|
export interface EMBConfigSchema {
|
|
7
20
|
project: string | {
|
|
8
21
|
/**
|
|
@@ -33,6 +46,7 @@ export interface EMBConfigSchema {
|
|
|
33
46
|
defaults?: Defaults;
|
|
34
47
|
components?: Component[];
|
|
35
48
|
flavors?: Flavor[];
|
|
49
|
+
tasks?: Task[];
|
|
36
50
|
}
|
|
37
51
|
/**
|
|
38
52
|
* Default settings for build aspects
|
|
@@ -58,37 +72,30 @@ export interface Component {
|
|
|
58
72
|
* The name of the component.
|
|
59
73
|
*/
|
|
60
74
|
name: string;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
docker?: {
|
|
76
|
+
/**
|
|
77
|
+
* The directory of the component.
|
|
78
|
+
*/
|
|
79
|
+
context?: string;
|
|
80
|
+
buildArgs?: {
|
|
81
|
+
[k: string]: string;
|
|
82
|
+
};
|
|
83
|
+
dependencies?: string[];
|
|
84
|
+
/**
|
|
85
|
+
* The stage to target for the build
|
|
86
|
+
*/
|
|
87
|
+
target?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The Dockerfile to use
|
|
90
|
+
*/
|
|
91
|
+
dockerfile?: string;
|
|
92
|
+
};
|
|
65
93
|
/**
|
|
66
94
|
* A description of the component.
|
|
67
95
|
*/
|
|
68
96
|
description?: string;
|
|
69
|
-
buildArgs?: {
|
|
70
|
-
[k: string]: string;
|
|
71
|
-
};
|
|
72
|
-
dependencies?: string[];
|
|
73
|
-
/**
|
|
74
|
-
* The stage to target for the build
|
|
75
|
-
*/
|
|
76
|
-
target?: string;
|
|
77
|
-
/**
|
|
78
|
-
* The Dockerfile to use
|
|
79
|
-
*/
|
|
80
|
-
dockerfile?: string;
|
|
81
97
|
tasks?: Task[];
|
|
82
98
|
}
|
|
83
|
-
export interface Task {
|
|
84
|
-
name: string;
|
|
85
|
-
description?: string;
|
|
86
|
-
script: string;
|
|
87
|
-
executor?: string;
|
|
88
|
-
options?: {
|
|
89
|
-
[k: string]: unknown;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
99
|
export interface Flavor {
|
|
93
100
|
name: string;
|
|
94
101
|
/**
|