@enspirit/emb 0.13.2 → 0.14.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/README.md +20 -28
- package/dist/src/cli/commands/containers/index.d.ts +0 -1
- package/dist/src/cli/commands/containers/index.js +0 -1
- package/dist/src/cli/commands/ps.d.ts +10 -0
- package/dist/src/cli/commands/ps.js +23 -0
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/config/schema.json +5 -0
- package/dist/src/docker/compose/operations/ComposePsOperation.d.ts +13 -0
- package/dist/src/docker/compose/operations/ComposePsOperation.js +38 -0
- package/dist/src/docker/compose/operations/index.d.ts +1 -0
- package/dist/src/docker/compose/operations/index.js +1 -0
- package/dist/src/docker/operations/containers/ContainerExecOperation.d.ts +1 -0
- package/dist/src/docker/operations/containers/ContainerExecOperation.js +22 -3
- package/dist/src/monorepo/operations/shell/ExecuteLocalCommandOperation.d.ts +1 -0
- package/dist/src/monorepo/operations/shell/ExecuteLocalCommandOperation.js +20 -10
- package/dist/src/monorepo/operations/tasks/RunTasksOperation.js +9 -3
- package/dist/src/monorepo/taskManagerFactory.js +2 -2
- package/oclif.manifest.json +163 -119
- package/package.json +6 -6
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.
|
|
17
|
+
@enspirit/emb/0.14.1 darwin-x64 node-v22.18.0
|
|
18
18
|
$ emb --help [COMMAND]
|
|
19
19
|
USAGE
|
|
20
20
|
$ emb COMMAND
|
|
@@ -64,7 +64,7 @@ USAGE
|
|
|
64
64
|
$ emb autocomplete [SHELL] [-r]
|
|
65
65
|
|
|
66
66
|
ARGUMENTS
|
|
67
|
-
SHELL (zsh|bash|powershell) Shell type
|
|
67
|
+
[SHELL] (zsh|bash|powershell) Shell type
|
|
68
68
|
|
|
69
69
|
FLAGS
|
|
70
70
|
-r, --refresh-cache Refresh cache (ignores displaying instructions)
|
|
@@ -84,7 +84,7 @@ EXAMPLES
|
|
|
84
84
|
$ emb autocomplete --refresh-cache
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.
|
|
87
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.39/src/commands/autocomplete/index.ts)_
|
|
88
88
|
|
|
89
89
|
## `emb clean`
|
|
90
90
|
|
|
@@ -220,9 +220,6 @@ GLOBAL FLAGS
|
|
|
220
220
|
DESCRIPTION
|
|
221
221
|
List docker containers.
|
|
222
222
|
|
|
223
|
-
ALIASES
|
|
224
|
-
$ emb ps
|
|
225
|
-
|
|
226
223
|
EXAMPLES
|
|
227
224
|
$ emb containers
|
|
228
225
|
```
|
|
@@ -279,7 +276,7 @@ USAGE
|
|
|
279
276
|
$ emb help [COMMAND...] [-n]
|
|
280
277
|
|
|
281
278
|
ARGUMENTS
|
|
282
|
-
COMMAND... Command to show help for.
|
|
279
|
+
[COMMAND...] Command to show help for.
|
|
283
280
|
|
|
284
281
|
FLAGS
|
|
285
282
|
-n, --nested-commands Include all nested commands in the output.
|
|
@@ -288,7 +285,7 @@ DESCRIPTION
|
|
|
288
285
|
Display help for emb.
|
|
289
286
|
```
|
|
290
287
|
|
|
291
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.
|
|
288
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.36/src/commands/help.ts)_
|
|
292
289
|
|
|
293
290
|
## `emb images`
|
|
294
291
|
|
|
@@ -396,7 +393,7 @@ ARGUMENTS
|
|
|
396
393
|
|
|
397
394
|
FLAGS
|
|
398
395
|
-f, --[no-]follow Follow log output
|
|
399
|
-
-n, --namespace=<value> (required) The Kubernetes namespace to target
|
|
396
|
+
-n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
|
|
400
397
|
--[no-]verbose
|
|
401
398
|
|
|
402
399
|
DESCRIPTION
|
|
@@ -418,7 +415,7 @@ USAGE
|
|
|
418
415
|
$ emb kubernetes ps -n <value> [--verbose] [--watch]
|
|
419
416
|
|
|
420
417
|
FLAGS
|
|
421
|
-
-n, --namespace=<value> (required) The Kubernetes namespace to target
|
|
418
|
+
-n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
|
|
422
419
|
--[no-]verbose
|
|
423
420
|
--[no-]watch
|
|
424
421
|
|
|
@@ -438,10 +435,10 @@ USAGE
|
|
|
438
435
|
$ emb kubernetes restart [DEPLOYMENT...] -n <value> [--verbose]
|
|
439
436
|
|
|
440
437
|
ARGUMENTS
|
|
441
|
-
DEPLOYMENT... The deployment(s) to restart
|
|
438
|
+
[DEPLOYMENT...] The deployment(s) to restart
|
|
442
439
|
|
|
443
440
|
FLAGS
|
|
444
|
-
-n, --namespace=<value> (required) The Kubernetes namespace to target
|
|
441
|
+
-n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
|
|
445
442
|
--[no-]verbose
|
|
446
443
|
|
|
447
444
|
DESCRIPTION
|
|
@@ -463,7 +460,7 @@ ARGUMENTS
|
|
|
463
460
|
COMPONENT The component you want to get a shell on
|
|
464
461
|
|
|
465
462
|
FLAGS
|
|
466
|
-
-n, --namespace=<value> (required) The Kubernetes namespace to target
|
|
463
|
+
-n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
|
|
467
464
|
-s, --shell=<value> [default: bash] The shell to run
|
|
468
465
|
--[no-]verbose
|
|
469
466
|
|
|
@@ -504,24 +501,19 @@ EXAMPLES
|
|
|
504
501
|
|
|
505
502
|
## `emb ps`
|
|
506
503
|
|
|
507
|
-
|
|
504
|
+
Lists the containers running in the project.
|
|
508
505
|
|
|
509
506
|
```
|
|
510
507
|
USAGE
|
|
511
|
-
$ emb ps [--
|
|
508
|
+
$ emb ps [--verbose] [--flavor <value>] [-a]
|
|
512
509
|
|
|
513
510
|
FLAGS
|
|
514
|
-
-a, --all
|
|
511
|
+
-a, --all Show all stopped containers
|
|
512
|
+
--flavor=<value> Specify the flavor to use.
|
|
515
513
|
--[no-]verbose
|
|
516
514
|
|
|
517
|
-
GLOBAL FLAGS
|
|
518
|
-
--json Format output as json.
|
|
519
|
-
|
|
520
515
|
DESCRIPTION
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
ALIASES
|
|
524
|
-
$ emb ps
|
|
516
|
+
Lists the containers running in the project.
|
|
525
517
|
|
|
526
518
|
EXAMPLES
|
|
527
519
|
$ emb ps
|
|
@@ -558,7 +550,7 @@ USAGE
|
|
|
558
550
|
$ emb resources build [COMPONENT...] [--json] [--verbose] [--flavor <value>] [--dry-run] [-f]
|
|
559
551
|
|
|
560
552
|
ARGUMENTS
|
|
561
|
-
COMPONENT... List of resources to build (defaults to all)
|
|
553
|
+
[COMPONENT...] List of resources to build (defaults to all)
|
|
562
554
|
|
|
563
555
|
FLAGS
|
|
564
556
|
-f, --force Bypass the cache and force the build
|
|
@@ -585,7 +577,7 @@ USAGE
|
|
|
585
577
|
$ emb restart [COMPONENT...] [--json] [--verbose] [-f]
|
|
586
578
|
|
|
587
579
|
ARGUMENTS
|
|
588
|
-
COMPONENT... The component(s) to restart
|
|
580
|
+
[COMPONENT...] The component(s) to restart
|
|
589
581
|
|
|
590
582
|
FLAGS
|
|
591
583
|
-f, --no-deps Don't restart depdendent components
|
|
@@ -665,7 +657,7 @@ USAGE
|
|
|
665
657
|
$ emb start [COMPONENT...] [--json] [--verbose]
|
|
666
658
|
|
|
667
659
|
ARGUMENTS
|
|
668
|
-
COMPONENT... The component(s) to start
|
|
660
|
+
[COMPONENT...] The component(s) to start
|
|
669
661
|
|
|
670
662
|
FLAGS
|
|
671
663
|
--[no-]verbose
|
|
@@ -762,7 +754,7 @@ USAGE
|
|
|
762
754
|
$ emb up [COMPONENT...] [--json] [--verbose] [--flavor <value>] [-f]
|
|
763
755
|
|
|
764
756
|
ARGUMENTS
|
|
765
|
-
COMPONENT... The component(s) to build and start
|
|
757
|
+
[COMPONENT...] The component(s) to build and start
|
|
766
758
|
|
|
767
759
|
FLAGS
|
|
768
760
|
-f, --force Bypass caches, force the recreation of containers, etc
|
|
@@ -815,5 +807,5 @@ EXAMPLES
|
|
|
815
807
|
$ emb update --available
|
|
816
808
|
```
|
|
817
809
|
|
|
818
|
-
_See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v4.7.
|
|
810
|
+
_See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v4.7.16/src/commands/update.ts)_
|
|
819
811
|
<!-- commandsstop -->
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ContainerInfo } from 'dockerode';
|
|
2
2
|
import { BaseCommand } from '../../index.js';
|
|
3
3
|
export default class ContainersIndex extends BaseCommand {
|
|
4
|
-
static aliases: string[];
|
|
5
4
|
static description: string;
|
|
6
5
|
static enableJsonFlag: boolean;
|
|
7
6
|
static examples: string[];
|
|
@@ -5,7 +5,6 @@ import { BaseCommand, TABLE_DEFAULTS } from '../../index.js';
|
|
|
5
5
|
import { ListContainersOperation, shortId } from '../../../docker/index.js';
|
|
6
6
|
import { timeAgo } from '../../../utils/index.js';
|
|
7
7
|
export default class ContainersIndex extends BaseCommand {
|
|
8
|
-
static aliases = ['ps'];
|
|
9
8
|
static description = 'List docker containers.';
|
|
10
9
|
static enableJsonFlag = true;
|
|
11
10
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FlavoredCommand } from '../index.js';
|
|
2
|
+
export default class PsCommand extends FlavoredCommand<typeof PsCommand> {
|
|
3
|
+
static description: string;
|
|
4
|
+
static enableJsonFlag: boolean;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { FlavoredCommand, getContext } from '../index.js';
|
|
3
|
+
import { ComposePsOperation } from '../../docker/index.js';
|
|
4
|
+
export default class PsCommand extends FlavoredCommand {
|
|
5
|
+
static description = 'Lists the containers running in the project.';
|
|
6
|
+
static enableJsonFlag = false;
|
|
7
|
+
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
8
|
+
static flags = {
|
|
9
|
+
all: Flags.boolean({
|
|
10
|
+
char: 'a',
|
|
11
|
+
default: false,
|
|
12
|
+
description: 'Show all stopped containers',
|
|
13
|
+
name: 'all',
|
|
14
|
+
}),
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
const { flags } = await this.parse(PsCommand);
|
|
18
|
+
const { monorepo } = getContext();
|
|
19
|
+
await monorepo.run(new ComposePsOperation(), {
|
|
20
|
+
all: flags.all,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -13,6 +13,10 @@ export type TaskConfig = TaskConfig1 & {
|
|
|
13
13
|
};
|
|
14
14
|
pre?: QualifiedIdentifier[];
|
|
15
15
|
executors?: ("local" | "container")[];
|
|
16
|
+
/**
|
|
17
|
+
* Whether the task is interactive (requires TTY)
|
|
18
|
+
*/
|
|
19
|
+
interactive?: boolean;
|
|
16
20
|
/**
|
|
17
21
|
* Variables to pass onto the task
|
|
18
22
|
*/
|
|
@@ -146,6 +146,11 @@
|
|
|
146
146
|
]
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
|
+
"interactive": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"description": "Whether the task is interactive (requires TTY)",
|
|
152
|
+
"default": false
|
|
153
|
+
},
|
|
149
154
|
"vars": {
|
|
150
155
|
"type": "object",
|
|
151
156
|
"description": "Variables to pass onto the task",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { AbstractOperation } from '../../../operations/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* https://docs.docker.com/reference/cli/docker/compose/ps/
|
|
5
|
+
*/
|
|
6
|
+
declare const schema: z.ZodOptional<z.ZodObject<{
|
|
7
|
+
all: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
}, z.core.$strip>>;
|
|
9
|
+
export declare class ComposePsOperation extends AbstractOperation<typeof schema, void> {
|
|
10
|
+
constructor();
|
|
11
|
+
protected _run(input: z.input<typeof schema>): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getContext } from '../../../index.js';
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
import { ExecuteLocalCommandOperation } from '../../../monorepo/index.js';
|
|
4
|
+
import { AbstractOperation } from '../../../operations/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* https://docs.docker.com/reference/cli/docker/compose/ps/
|
|
7
|
+
*/
|
|
8
|
+
const schema = z
|
|
9
|
+
.object({
|
|
10
|
+
all: z.boolean().optional().describe('Sow all stopped containers'),
|
|
11
|
+
})
|
|
12
|
+
.optional();
|
|
13
|
+
export class ComposePsOperation extends AbstractOperation {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(schema);
|
|
16
|
+
}
|
|
17
|
+
async _run(input) {
|
|
18
|
+
const { monorepo } = getContext();
|
|
19
|
+
const command = ['docker', 'compose', 'ps'];
|
|
20
|
+
if (input?.all) {
|
|
21
|
+
command.push('--all');
|
|
22
|
+
}
|
|
23
|
+
monorepo.setTaskRenderer('silent');
|
|
24
|
+
const manager = monorepo.taskManager();
|
|
25
|
+
manager.add([
|
|
26
|
+
{
|
|
27
|
+
async task() {
|
|
28
|
+
return monorepo.run(new ExecuteLocalCommandOperation(), {
|
|
29
|
+
script: command.join(' '),
|
|
30
|
+
workingDir: monorepo.rootDir,
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
title: 'Listing running containers',
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
await manager.runAll();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './ComposeDownOperation.js';
|
|
2
2
|
export * from './ComposeExecOperation.js';
|
|
3
3
|
export * from './ComposeExecShellOperation.js';
|
|
4
|
+
export * from './ComposePsOperation.js';
|
|
4
5
|
export * from './ComposeRestartOperation.js';
|
|
5
6
|
export * from './ComposeStartOperation.js';
|
|
6
7
|
export * from './ComposeStopOperation.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './ComposeDownOperation.js';
|
|
2
2
|
export * from './ComposeExecOperation.js';
|
|
3
3
|
export * from './ComposeExecShellOperation.js';
|
|
4
|
+
export * from './ComposePsOperation.js';
|
|
4
5
|
export * from './ComposeRestartOperation.js';
|
|
5
6
|
export * from './ComposeStartOperation.js';
|
|
6
7
|
export * from './ComposeStopOperation.js';
|
|
@@ -8,6 +8,7 @@ declare const schema: z.ZodObject<{
|
|
|
8
8
|
container: z.ZodString;
|
|
9
9
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
10
10
|
script: z.ZodString;
|
|
11
|
+
interactive: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
11
12
|
tty: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
12
13
|
workingDir: z.ZodOptional<z.ZodString>;
|
|
13
14
|
}, z.core.$strip>;
|
|
@@ -10,6 +10,11 @@ const schema = z.object({
|
|
|
10
10
|
.optional()
|
|
11
11
|
.describe('A list of environment variables in the form'),
|
|
12
12
|
script: z.string().describe('Command to run, as a string'),
|
|
13
|
+
interactive: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.default(false)
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('Whether the command is interactive'),
|
|
13
18
|
tty: z.boolean().default(false).optional().describe('Allocate a pseudo-TTY'),
|
|
14
19
|
workingDir: z
|
|
15
20
|
.string()
|
|
@@ -27,20 +32,34 @@ export class ContainerExecOperation extends AbstractOperation {
|
|
|
27
32
|
const envVars = Object.entries(input.env || {}).reduce((arr, [key, value]) => {
|
|
28
33
|
return [...arr, `${key}=${value}`];
|
|
29
34
|
}, []);
|
|
35
|
+
const isInteractive = input.interactive || input.tty;
|
|
30
36
|
const options = {
|
|
31
37
|
AttachStderr: true,
|
|
32
38
|
AttachStdout: true,
|
|
39
|
+
AttachStdin: true,
|
|
33
40
|
Cmd: ['bash', '-eu', '-o', 'pipefail', '-c', input.script],
|
|
34
41
|
Env: envVars,
|
|
35
|
-
Tty:
|
|
42
|
+
Tty: isInteractive,
|
|
36
43
|
WorkingDir: input.workingDir,
|
|
37
44
|
};
|
|
38
45
|
const exec = await container.exec(options);
|
|
39
|
-
const stream = await exec.start({});
|
|
40
|
-
|
|
46
|
+
const stream = await exec.start({ hijack: true, stdin: true });
|
|
47
|
+
// Handle stdin for interactive commands
|
|
48
|
+
if (isInteractive && !this.out && process.stdin.isTTY) {
|
|
49
|
+
process.stdin.setRawMode?.(true);
|
|
50
|
+
process.stdin.pipe(stream);
|
|
51
|
+
}
|
|
52
|
+
const out = input.interactive ? process.stdout : this.out;
|
|
53
|
+
if (out) {
|
|
54
|
+
exec.modem.demuxStream(stream, out, out);
|
|
55
|
+
}
|
|
41
56
|
await new Promise((resolve, reject) => {
|
|
42
57
|
const onError = (err) => reject(err);
|
|
43
58
|
const onEnd = async () => {
|
|
59
|
+
// Restore stdin raw mode if it was set
|
|
60
|
+
if (isInteractive && !this.out && process.stdin.isTTY) {
|
|
61
|
+
process.stdin.setRawMode?.(false);
|
|
62
|
+
}
|
|
44
63
|
exec.inspect((error, res) => {
|
|
45
64
|
if (error) {
|
|
46
65
|
return reject(error);
|
|
@@ -7,6 +7,7 @@ import { AbstractOperation } from '../../../operations/index.js';
|
|
|
7
7
|
declare const schema: z.ZodObject<{
|
|
8
8
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
9
9
|
script: z.ZodString;
|
|
10
|
+
interactive: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
10
11
|
workingDir: z.ZodOptional<z.ZodString>;
|
|
11
12
|
}, z.core.$strip>;
|
|
12
13
|
export declare class ExecuteLocalCommandOperation extends AbstractOperation<typeof schema, Readable> {
|
|
@@ -10,6 +10,11 @@ const schema = z.object({
|
|
|
10
10
|
.optional()
|
|
11
11
|
.describe('A list of environment variables in the form'),
|
|
12
12
|
script: z.string().describe('Command to run, as a string'),
|
|
13
|
+
interactive: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.describe('Interactive command')
|
|
16
|
+
.default(false)
|
|
17
|
+
.optional(),
|
|
13
18
|
workingDir: z
|
|
14
19
|
.string()
|
|
15
20
|
.optional()
|
|
@@ -22,15 +27,20 @@ export class ExecuteLocalCommandOperation extends AbstractOperation {
|
|
|
22
27
|
this.out = out;
|
|
23
28
|
}
|
|
24
29
|
async _run(input) {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
const proc = input.interactive
|
|
31
|
+
? execa(input.script, {
|
|
32
|
+
cwd: input.workingDir,
|
|
33
|
+
shell: true,
|
|
34
|
+
env: input.env,
|
|
35
|
+
stdin: 'inherit',
|
|
36
|
+
})
|
|
37
|
+
: execa(input.script, {
|
|
38
|
+
all: true,
|
|
39
|
+
cwd: input.workingDir,
|
|
40
|
+
shell: true,
|
|
41
|
+
env: input.env,
|
|
42
|
+
});
|
|
43
|
+
proc.all?.pipe(this.out || process.stdout);
|
|
44
|
+
return proc.all || proc.stdout;
|
|
35
45
|
}
|
|
36
46
|
}
|
|
@@ -13,7 +13,6 @@ export var ExecutorType;
|
|
|
13
13
|
export class RunTasksOperation {
|
|
14
14
|
async run(params) {
|
|
15
15
|
const { monorepo } = getContext();
|
|
16
|
-
const manager = monorepo.taskManager();
|
|
17
16
|
// First ensure the selection is valid (user can use task IDs or names)
|
|
18
17
|
const collection = new EMBCollection(monorepo.tasks, {
|
|
19
18
|
idField: 'id',
|
|
@@ -22,6 +21,11 @@ export class RunTasksOperation {
|
|
|
22
21
|
const ordered = findRunOrder(params.tasks, collection, {
|
|
23
22
|
onAmbiguous: params.allMatching ? 'runAll' : 'error',
|
|
24
23
|
});
|
|
24
|
+
const hasInteractiveTasks = ordered.find((t) => t.interactive === true);
|
|
25
|
+
if (hasInteractiveTasks) {
|
|
26
|
+
monorepo.setTaskRenderer('silent');
|
|
27
|
+
}
|
|
28
|
+
const manager = monorepo.taskManager();
|
|
25
29
|
await manager.run(ordered.map((task) => {
|
|
26
30
|
return {
|
|
27
31
|
rendererOptions: {
|
|
@@ -71,9 +75,10 @@ export class RunTasksOperation {
|
|
|
71
75
|
async runDocker(task, out) {
|
|
72
76
|
const { monorepo, compose } = getContext();
|
|
73
77
|
const containerID = await compose.getContainer(task.component);
|
|
74
|
-
return monorepo.run(new ContainerExecOperation(out), {
|
|
78
|
+
return monorepo.run(new ContainerExecOperation(task.interactive ? undefined : out), {
|
|
75
79
|
container: containerID,
|
|
76
80
|
script: task.script,
|
|
81
|
+
interactive: task.interactive || false,
|
|
77
82
|
env: await monorepo.expand(task.vars || {}),
|
|
78
83
|
});
|
|
79
84
|
}
|
|
@@ -82,9 +87,10 @@ export class RunTasksOperation {
|
|
|
82
87
|
const cwd = task.component
|
|
83
88
|
? monorepo.join(monorepo.component(task.component).rootDir)
|
|
84
89
|
: monorepo.rootDir;
|
|
85
|
-
return monorepo.run(new ExecuteLocalCommandOperation(
|
|
90
|
+
return monorepo.run(new ExecuteLocalCommandOperation(), {
|
|
86
91
|
script: task.script,
|
|
87
92
|
workingDir: cwd,
|
|
93
|
+
interactive: task.interactive,
|
|
88
94
|
env: await monorepo.expand(task.vars || {}),
|
|
89
95
|
});
|
|
90
96
|
}
|
|
@@ -9,9 +9,9 @@ export class TaskManagerFactory {
|
|
|
9
9
|
this.renderer = renderer;
|
|
10
10
|
}
|
|
11
11
|
factor() {
|
|
12
|
-
if (this.renderer
|
|
12
|
+
if (this.renderer !== 'default') {
|
|
13
13
|
return new Manager({
|
|
14
|
-
renderer:
|
|
14
|
+
renderer: this.renderer,
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
return new Manager({
|
package/oclif.manifest.json
CHANGED
|
@@ -91,6 +91,52 @@
|
|
|
91
91
|
"down.js"
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
|
+
"ps": {
|
|
95
|
+
"aliases": [],
|
|
96
|
+
"args": {},
|
|
97
|
+
"description": "Lists the containers running in the project.",
|
|
98
|
+
"examples": [
|
|
99
|
+
"<%= config.bin %> <%= command.id %>"
|
|
100
|
+
],
|
|
101
|
+
"flags": {
|
|
102
|
+
"verbose": {
|
|
103
|
+
"name": "verbose",
|
|
104
|
+
"allowNo": true,
|
|
105
|
+
"type": "boolean"
|
|
106
|
+
},
|
|
107
|
+
"flavor": {
|
|
108
|
+
"description": "Specify the flavor to use.",
|
|
109
|
+
"name": "flavor",
|
|
110
|
+
"required": false,
|
|
111
|
+
"hasDynamicHelp": false,
|
|
112
|
+
"multiple": false,
|
|
113
|
+
"type": "option"
|
|
114
|
+
},
|
|
115
|
+
"all": {
|
|
116
|
+
"char": "a",
|
|
117
|
+
"description": "Show all stopped containers",
|
|
118
|
+
"name": "all",
|
|
119
|
+
"allowNo": false,
|
|
120
|
+
"type": "boolean"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"hasDynamicHelp": false,
|
|
124
|
+
"hiddenAliases": [],
|
|
125
|
+
"id": "ps",
|
|
126
|
+
"pluginAlias": "@enspirit/emb",
|
|
127
|
+
"pluginName": "@enspirit/emb",
|
|
128
|
+
"pluginType": "core",
|
|
129
|
+
"strict": true,
|
|
130
|
+
"enableJsonFlag": false,
|
|
131
|
+
"isESM": true,
|
|
132
|
+
"relativePath": [
|
|
133
|
+
"dist",
|
|
134
|
+
"src",
|
|
135
|
+
"cli",
|
|
136
|
+
"commands",
|
|
137
|
+
"ps.js"
|
|
138
|
+
]
|
|
139
|
+
},
|
|
94
140
|
"restart": {
|
|
95
141
|
"aliases": [],
|
|
96
142
|
"args": {
|
|
@@ -479,9 +525,7 @@
|
|
|
479
525
|
]
|
|
480
526
|
},
|
|
481
527
|
"containers": {
|
|
482
|
-
"aliases": [
|
|
483
|
-
"ps"
|
|
484
|
-
],
|
|
528
|
+
"aliases": [],
|
|
485
529
|
"args": {},
|
|
486
530
|
"description": "List docker containers.",
|
|
487
531
|
"examples": [
|
|
@@ -777,121 +821,6 @@
|
|
|
777
821
|
"push.js"
|
|
778
822
|
]
|
|
779
823
|
},
|
|
780
|
-
"resources:build": {
|
|
781
|
-
"aliases": [],
|
|
782
|
-
"args": {
|
|
783
|
-
"component": {
|
|
784
|
-
"description": "List of resources to build (defaults to all)",
|
|
785
|
-
"name": "component",
|
|
786
|
-
"required": false
|
|
787
|
-
}
|
|
788
|
-
},
|
|
789
|
-
"description": "Build the resources of the monorepo",
|
|
790
|
-
"examples": [
|
|
791
|
-
"<%= config.bin %> <%= command.id %> build --flavor development"
|
|
792
|
-
],
|
|
793
|
-
"flags": {
|
|
794
|
-
"json": {
|
|
795
|
-
"description": "Format output as json.",
|
|
796
|
-
"helpGroup": "GLOBAL",
|
|
797
|
-
"name": "json",
|
|
798
|
-
"allowNo": false,
|
|
799
|
-
"type": "boolean"
|
|
800
|
-
},
|
|
801
|
-
"verbose": {
|
|
802
|
-
"name": "verbose",
|
|
803
|
-
"allowNo": true,
|
|
804
|
-
"type": "boolean"
|
|
805
|
-
},
|
|
806
|
-
"flavor": {
|
|
807
|
-
"description": "Specify the flavor to use.",
|
|
808
|
-
"name": "flavor",
|
|
809
|
-
"required": false,
|
|
810
|
-
"hasDynamicHelp": false,
|
|
811
|
-
"multiple": false,
|
|
812
|
-
"type": "option"
|
|
813
|
-
},
|
|
814
|
-
"dry-run": {
|
|
815
|
-
"description": "Do not build the resources but only produce build meta information",
|
|
816
|
-
"name": "dry-run",
|
|
817
|
-
"required": false,
|
|
818
|
-
"allowNo": false,
|
|
819
|
-
"type": "boolean"
|
|
820
|
-
},
|
|
821
|
-
"force": {
|
|
822
|
-
"char": "f",
|
|
823
|
-
"description": "Bypass the cache and force the build",
|
|
824
|
-
"name": "force",
|
|
825
|
-
"required": false,
|
|
826
|
-
"allowNo": false,
|
|
827
|
-
"type": "boolean"
|
|
828
|
-
}
|
|
829
|
-
},
|
|
830
|
-
"hasDynamicHelp": false,
|
|
831
|
-
"hiddenAliases": [],
|
|
832
|
-
"id": "resources:build",
|
|
833
|
-
"pluginAlias": "@enspirit/emb",
|
|
834
|
-
"pluginName": "@enspirit/emb",
|
|
835
|
-
"pluginType": "core",
|
|
836
|
-
"strict": false,
|
|
837
|
-
"enableJsonFlag": true,
|
|
838
|
-
"isESM": true,
|
|
839
|
-
"relativePath": [
|
|
840
|
-
"dist",
|
|
841
|
-
"src",
|
|
842
|
-
"cli",
|
|
843
|
-
"commands",
|
|
844
|
-
"resources",
|
|
845
|
-
"build.js"
|
|
846
|
-
]
|
|
847
|
-
},
|
|
848
|
-
"resources": {
|
|
849
|
-
"aliases": [],
|
|
850
|
-
"args": {},
|
|
851
|
-
"description": "List resources.",
|
|
852
|
-
"examples": [
|
|
853
|
-
"<%= config.bin %> <%= command.id %>"
|
|
854
|
-
],
|
|
855
|
-
"flags": {
|
|
856
|
-
"json": {
|
|
857
|
-
"description": "Format output as json.",
|
|
858
|
-
"helpGroup": "GLOBAL",
|
|
859
|
-
"name": "json",
|
|
860
|
-
"allowNo": false,
|
|
861
|
-
"type": "boolean"
|
|
862
|
-
},
|
|
863
|
-
"verbose": {
|
|
864
|
-
"name": "verbose",
|
|
865
|
-
"allowNo": true,
|
|
866
|
-
"type": "boolean"
|
|
867
|
-
},
|
|
868
|
-
"flavor": {
|
|
869
|
-
"description": "Specify the flavor to use.",
|
|
870
|
-
"name": "flavor",
|
|
871
|
-
"required": false,
|
|
872
|
-
"hasDynamicHelp": false,
|
|
873
|
-
"multiple": false,
|
|
874
|
-
"type": "option"
|
|
875
|
-
}
|
|
876
|
-
},
|
|
877
|
-
"hasDynamicHelp": false,
|
|
878
|
-
"hiddenAliases": [],
|
|
879
|
-
"id": "resources",
|
|
880
|
-
"pluginAlias": "@enspirit/emb",
|
|
881
|
-
"pluginName": "@enspirit/emb",
|
|
882
|
-
"pluginType": "core",
|
|
883
|
-
"strict": true,
|
|
884
|
-
"enableJsonFlag": true,
|
|
885
|
-
"isESM": true,
|
|
886
|
-
"relativePath": [
|
|
887
|
-
"dist",
|
|
888
|
-
"src",
|
|
889
|
-
"cli",
|
|
890
|
-
"commands",
|
|
891
|
-
"resources",
|
|
892
|
-
"index.js"
|
|
893
|
-
]
|
|
894
|
-
},
|
|
895
824
|
"kubernetes:logs": {
|
|
896
825
|
"aliases": [
|
|
897
826
|
"logs"
|
|
@@ -1114,6 +1043,121 @@
|
|
|
1114
1043
|
"shell.js"
|
|
1115
1044
|
]
|
|
1116
1045
|
},
|
|
1046
|
+
"resources:build": {
|
|
1047
|
+
"aliases": [],
|
|
1048
|
+
"args": {
|
|
1049
|
+
"component": {
|
|
1050
|
+
"description": "List of resources to build (defaults to all)",
|
|
1051
|
+
"name": "component",
|
|
1052
|
+
"required": false
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
"description": "Build the resources of the monorepo",
|
|
1056
|
+
"examples": [
|
|
1057
|
+
"<%= config.bin %> <%= command.id %> build --flavor development"
|
|
1058
|
+
],
|
|
1059
|
+
"flags": {
|
|
1060
|
+
"json": {
|
|
1061
|
+
"description": "Format output as json.",
|
|
1062
|
+
"helpGroup": "GLOBAL",
|
|
1063
|
+
"name": "json",
|
|
1064
|
+
"allowNo": false,
|
|
1065
|
+
"type": "boolean"
|
|
1066
|
+
},
|
|
1067
|
+
"verbose": {
|
|
1068
|
+
"name": "verbose",
|
|
1069
|
+
"allowNo": true,
|
|
1070
|
+
"type": "boolean"
|
|
1071
|
+
},
|
|
1072
|
+
"flavor": {
|
|
1073
|
+
"description": "Specify the flavor to use.",
|
|
1074
|
+
"name": "flavor",
|
|
1075
|
+
"required": false,
|
|
1076
|
+
"hasDynamicHelp": false,
|
|
1077
|
+
"multiple": false,
|
|
1078
|
+
"type": "option"
|
|
1079
|
+
},
|
|
1080
|
+
"dry-run": {
|
|
1081
|
+
"description": "Do not build the resources but only produce build meta information",
|
|
1082
|
+
"name": "dry-run",
|
|
1083
|
+
"required": false,
|
|
1084
|
+
"allowNo": false,
|
|
1085
|
+
"type": "boolean"
|
|
1086
|
+
},
|
|
1087
|
+
"force": {
|
|
1088
|
+
"char": "f",
|
|
1089
|
+
"description": "Bypass the cache and force the build",
|
|
1090
|
+
"name": "force",
|
|
1091
|
+
"required": false,
|
|
1092
|
+
"allowNo": false,
|
|
1093
|
+
"type": "boolean"
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
"hasDynamicHelp": false,
|
|
1097
|
+
"hiddenAliases": [],
|
|
1098
|
+
"id": "resources:build",
|
|
1099
|
+
"pluginAlias": "@enspirit/emb",
|
|
1100
|
+
"pluginName": "@enspirit/emb",
|
|
1101
|
+
"pluginType": "core",
|
|
1102
|
+
"strict": false,
|
|
1103
|
+
"enableJsonFlag": true,
|
|
1104
|
+
"isESM": true,
|
|
1105
|
+
"relativePath": [
|
|
1106
|
+
"dist",
|
|
1107
|
+
"src",
|
|
1108
|
+
"cli",
|
|
1109
|
+
"commands",
|
|
1110
|
+
"resources",
|
|
1111
|
+
"build.js"
|
|
1112
|
+
]
|
|
1113
|
+
},
|
|
1114
|
+
"resources": {
|
|
1115
|
+
"aliases": [],
|
|
1116
|
+
"args": {},
|
|
1117
|
+
"description": "List resources.",
|
|
1118
|
+
"examples": [
|
|
1119
|
+
"<%= config.bin %> <%= command.id %>"
|
|
1120
|
+
],
|
|
1121
|
+
"flags": {
|
|
1122
|
+
"json": {
|
|
1123
|
+
"description": "Format output as json.",
|
|
1124
|
+
"helpGroup": "GLOBAL",
|
|
1125
|
+
"name": "json",
|
|
1126
|
+
"allowNo": false,
|
|
1127
|
+
"type": "boolean"
|
|
1128
|
+
},
|
|
1129
|
+
"verbose": {
|
|
1130
|
+
"name": "verbose",
|
|
1131
|
+
"allowNo": true,
|
|
1132
|
+
"type": "boolean"
|
|
1133
|
+
},
|
|
1134
|
+
"flavor": {
|
|
1135
|
+
"description": "Specify the flavor to use.",
|
|
1136
|
+
"name": "flavor",
|
|
1137
|
+
"required": false,
|
|
1138
|
+
"hasDynamicHelp": false,
|
|
1139
|
+
"multiple": false,
|
|
1140
|
+
"type": "option"
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
"hasDynamicHelp": false,
|
|
1144
|
+
"hiddenAliases": [],
|
|
1145
|
+
"id": "resources",
|
|
1146
|
+
"pluginAlias": "@enspirit/emb",
|
|
1147
|
+
"pluginName": "@enspirit/emb",
|
|
1148
|
+
"pluginType": "core",
|
|
1149
|
+
"strict": true,
|
|
1150
|
+
"enableJsonFlag": true,
|
|
1151
|
+
"isESM": true,
|
|
1152
|
+
"relativePath": [
|
|
1153
|
+
"dist",
|
|
1154
|
+
"src",
|
|
1155
|
+
"cli",
|
|
1156
|
+
"commands",
|
|
1157
|
+
"resources",
|
|
1158
|
+
"index.js"
|
|
1159
|
+
]
|
|
1160
|
+
},
|
|
1117
1161
|
"tasks": {
|
|
1118
1162
|
"aliases": [],
|
|
1119
1163
|
"args": {},
|
|
@@ -1220,5 +1264,5 @@
|
|
|
1220
1264
|
]
|
|
1221
1265
|
}
|
|
1222
1266
|
},
|
|
1223
|
-
"version": "0.
|
|
1267
|
+
"version": "0.14.1"
|
|
1224
1268
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enspirit/emb",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"monorepo",
|
|
7
7
|
"docker",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@fastify/deepmerge": "^3.1.0",
|
|
44
44
|
"@kubernetes/client-node": "1.3.0",
|
|
45
45
|
"@listr2/manager": "^3.0.3",
|
|
46
|
-
"@oclif/core": "^4.
|
|
47
|
-
"@oclif/plugin-autocomplete": "^3.2.
|
|
48
|
-
"@oclif/plugin-help": "^6.2.
|
|
49
|
-
"@oclif/plugin-update": "^4.7.
|
|
50
|
-
"@oclif/table": "^0.
|
|
46
|
+
"@oclif/core": "^4.8.0",
|
|
47
|
+
"@oclif/plugin-autocomplete": "^3.2.39",
|
|
48
|
+
"@oclif/plugin-help": "^6.2.36",
|
|
49
|
+
"@oclif/plugin-update": "^4.7.16",
|
|
50
|
+
"@oclif/table": "^0.5.1",
|
|
51
51
|
"ajv": "^8.17.1",
|
|
52
52
|
"ansi-escapes": "^7.0.0",
|
|
53
53
|
"colorette": "^2.0.20",
|