@enspirit/emb 0.1.2 → 0.2.0

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 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.1.2 darwin-x64 node-v22.12.0
17
+ @enspirit/emb/0.2.0 darwin-x64 node-v22.12.0
18
18
  $ emb --help [COMMAND]
19
19
  USAGE
20
20
  $ emb COMMAND
@@ -26,6 +26,8 @@ USAGE
26
26
  * [`emb autocomplete [SHELL]`](#emb-autocomplete-shell)
27
27
  * [`emb clean`](#emb-clean)
28
28
  * [`emb components`](#emb-components)
29
+ * [`emb components logs COMPONENT`](#emb-components-logs-component)
30
+ * [`emb components shell COMPONENT`](#emb-components-shell-component)
29
31
  * [`emb config print`](#emb-config-print)
30
32
  * [`emb containers`](#emb-containers)
31
33
  * [`emb containers prune`](#emb-containers-prune)
@@ -34,9 +36,11 @@ USAGE
34
36
  * [`emb images`](#emb-images)
35
37
  * [`emb images delete`](#emb-images-delete)
36
38
  * [`emb images prune`](#emb-images-prune)
39
+ * [`emb logs COMPONENT`](#emb-logs-component)
37
40
  * [`emb ps`](#emb-ps)
38
41
  * [`emb resources`](#emb-resources)
39
42
  * [`emb resources build [COMPONENT]`](#emb-resources-build-component)
43
+ * [`emb shell COMPONENT`](#emb-shell-component)
40
44
  * [`emb tasks`](#emb-tasks)
41
45
  * [`emb tasks run TASK`](#emb-tasks-run-task)
42
46
  * [`emb up`](#emb-up)
@@ -115,6 +119,56 @@ EXAMPLES
115
119
  $ emb components
116
120
  ```
117
121
 
122
+ ## `emb components logs COMPONENT`
123
+
124
+ Get components logs.
125
+
126
+ ```
127
+ USAGE
128
+ $ emb components logs COMPONENT [--flavor <value>] [-f]
129
+
130
+ ARGUMENTS
131
+ COMPONENT The component you want to see the logs of
132
+
133
+ FLAGS
134
+ -f, --follow Follow log output
135
+ --flavor=<value> Specify the flavor to use.
136
+
137
+ DESCRIPTION
138
+ Get components logs.
139
+
140
+ ALIASES
141
+ $ emb logs
142
+
143
+ EXAMPLES
144
+ $ emb components logs
145
+ ```
146
+
147
+ ## `emb components shell COMPONENT`
148
+
149
+ Get a shell on a running component.
150
+
151
+ ```
152
+ USAGE
153
+ $ emb components shell COMPONENT [--flavor <value>] [-s <value>]
154
+
155
+ ARGUMENTS
156
+ COMPONENT The component you want to get a shell on
157
+
158
+ FLAGS
159
+ -s, --shell=<value> [default: bash] The shell to run
160
+ --flavor=<value> Specify the flavor to use.
161
+
162
+ DESCRIPTION
163
+ Get a shell on a running component.
164
+
165
+ ALIASES
166
+ $ emb shell
167
+
168
+ EXAMPLES
169
+ $ emb components shell
170
+ ```
171
+
118
172
  ## `emb config print`
119
173
 
120
174
  Print the current config.
@@ -283,6 +337,31 @@ EXAMPLES
283
337
  $ emb images prune
284
338
  ```
285
339
 
340
+ ## `emb logs COMPONENT`
341
+
342
+ Get components logs.
343
+
344
+ ```
345
+ USAGE
346
+ $ emb logs COMPONENT [--flavor <value>] [-f]
347
+
348
+ ARGUMENTS
349
+ COMPONENT The component you want to see the logs of
350
+
351
+ FLAGS
352
+ -f, --follow Follow log output
353
+ --flavor=<value> Specify the flavor to use.
354
+
355
+ DESCRIPTION
356
+ Get components logs.
357
+
358
+ ALIASES
359
+ $ emb logs
360
+
361
+ EXAMPLES
362
+ $ emb logs
363
+ ```
364
+
286
365
  ## `emb ps`
287
366
 
288
367
  List docker containers.
@@ -354,6 +433,31 @@ EXAMPLES
354
433
  $ emb resources build build --flavor development
355
434
  ```
356
435
 
436
+ ## `emb shell COMPONENT`
437
+
438
+ Get a shell on a running component.
439
+
440
+ ```
441
+ USAGE
442
+ $ emb shell COMPONENT [--flavor <value>] [-s <value>]
443
+
444
+ ARGUMENTS
445
+ COMPONENT The component you want to get a shell on
446
+
447
+ FLAGS
448
+ -s, --shell=<value> [default: bash] The shell to run
449
+ --flavor=<value> Specify the flavor to use.
450
+
451
+ DESCRIPTION
452
+ Get a shell on a running component.
453
+
454
+ ALIASES
455
+ $ emb shell
456
+
457
+ EXAMPLES
458
+ $ emb shell
459
+ ```
460
+
357
461
  ## `emb tasks`
358
462
 
359
463
  List tasks.
@@ -0,0 +1,14 @@
1
+ import { FlavoredCommand } from '../../index.js';
2
+ export default class ComponentsLogs extends FlavoredCommand<typeof ComponentsLogs> {
3
+ static aliases: string[];
4
+ static description: string;
5
+ static enableJsonFlag: boolean;
6
+ static examples: string[];
7
+ static flags: {
8
+ follow: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ static args: {
11
+ component: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,60 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { FlavoredCommand, getContext } from '../../index.js';
3
+ import { ListContainersOperation } from '../../../docker/index.js';
4
+ export default class ComponentsLogs extends FlavoredCommand {
5
+ static aliases = ['logs'];
6
+ static description = 'Get components logs.';
7
+ static enableJsonFlag = false;
8
+ static examples = ['<%= config.bin %> <%= command.id %>'];
9
+ static flags = {
10
+ follow: Flags.boolean({
11
+ name: 'follow',
12
+ char: 'f',
13
+ description: 'Follow log output',
14
+ default: false,
15
+ }),
16
+ };
17
+ static args = {
18
+ component: Args.string({
19
+ name: 'component',
20
+ description: 'The component you want to see the logs of',
21
+ required: true,
22
+ }),
23
+ };
24
+ async run() {
25
+ const { flags, args } = await this.parse(ComponentsLogs);
26
+ const { monorepo, docker } = await getContext();
27
+ const component = monorepo.component(args.component);
28
+ const containers = await monorepo.run(new ListContainersOperation(), {
29
+ filters: {
30
+ label: [
31
+ `emb/project=${monorepo.name}`,
32
+ `emb/component=${component.name}`,
33
+ `emb/flavor=${monorepo.currentFlavor}`,
34
+ ],
35
+ },
36
+ });
37
+ if (containers.length === 0) {
38
+ return this.error(`No container found for component \`${component.name}\``);
39
+ }
40
+ if (containers.length > 1) {
41
+ return this.error(`More than one container found for component \`${component.name}\``);
42
+ }
43
+ const container = await docker.getContainer(containers[0].Id);
44
+ if (flags.follow) {
45
+ const stream = await container.logs({
46
+ follow: true,
47
+ stderr: true,
48
+ stdout: true,
49
+ });
50
+ stream.pipe(process.stdout);
51
+ }
52
+ else {
53
+ const res = await container.logs({
54
+ stderr: true,
55
+ stdout: true,
56
+ });
57
+ this.log(res.toString());
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,14 @@
1
+ import { FlavoredCommand } from '../../index.js';
2
+ export default class ComponentsLogs extends FlavoredCommand<typeof ComponentsLogs> {
3
+ static aliases: string[];
4
+ static description: string;
5
+ static enableJsonFlag: boolean;
6
+ static examples: string[];
7
+ static flags: {
8
+ shell: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ };
10
+ static args: {
11
+ component: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,41 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { FlavoredCommand, getContext } from '../../index.js';
3
+ import { ExecShellOperation } from '../../../docker/index.js';
4
+ import { ShellExitError } from '../../../errors.js';
5
+ export default class ComponentsLogs extends FlavoredCommand {
6
+ static aliases = ['shell'];
7
+ static description = 'Get a shell on a running component.';
8
+ static enableJsonFlag = false;
9
+ static examples = ['<%= config.bin %> <%= command.id %>'];
10
+ static flags = {
11
+ shell: Flags.string({
12
+ name: 'shell',
13
+ char: 's',
14
+ description: 'The shell to run',
15
+ default: 'bash',
16
+ }),
17
+ };
18
+ static args = {
19
+ component: Args.string({
20
+ name: 'component',
21
+ description: 'The component you want to get a shell on',
22
+ required: true,
23
+ }),
24
+ };
25
+ async run() {
26
+ const { flags, args } = await this.parse(ComponentsLogs);
27
+ const { monorepo } = await getContext();
28
+ try {
29
+ await monorepo.run(new ExecShellOperation(), {
30
+ component: args.component,
31
+ shell: flags.shell,
32
+ });
33
+ }
34
+ catch (error) {
35
+ if (error instanceof ShellExitError) {
36
+ this.error(error);
37
+ }
38
+ throw error;
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,11 @@
1
+ import * as z from 'zod';
2
+ import { AbstractOperation } from '../../../operations/index.js';
3
+ declare const schema: z.ZodObject<{
4
+ shell: z.ZodOptional<z.ZodDefault<z.ZodString>>;
5
+ component: z.ZodString;
6
+ }, z.core.$strip>;
7
+ export declare class ExecShellOperation extends AbstractOperation<typeof schema, void> {
8
+ constructor();
9
+ protected _run(input: z.input<typeof schema>): Promise<void>;
10
+ }
11
+ export {};
@@ -0,0 +1,70 @@
1
+ import { getContext, ListContainersOperation, MultipleContainersFoundError, NoContainerFoundError, ShellExitError, } from '../../../index.js';
2
+ import { spawn } from 'node:child_process';
3
+ import * as z from 'zod';
4
+ import { AbstractOperation } from '../../../operations/index.js';
5
+ const schema = z.object({
6
+ shell: z.string().default('bash').optional(),
7
+ component: z
8
+ .string()
9
+ .describe('The name of the component on which to run a shell'),
10
+ });
11
+ export class ExecShellOperation extends AbstractOperation {
12
+ constructor() {
13
+ super(schema);
14
+ }
15
+ async _run(input) {
16
+ const { monorepo } = getContext();
17
+ const containers = await monorepo.run(new ListContainersOperation(), {
18
+ filters: {
19
+ label: [
20
+ `emb/project=${monorepo.name}`,
21
+ `emb/component=${input.component}`,
22
+ `emb/flavor=${monorepo.currentFlavor}`,
23
+ ],
24
+ },
25
+ });
26
+ if (containers.length === 0) {
27
+ throw new NoContainerFoundError(`No container found for component \`${input.component}\``, input.component);
28
+ }
29
+ if (containers.length > 1) {
30
+ throw new MultipleContainersFoundError(`More than one container found for component \`${input.component}\``, input.component);
31
+ }
32
+ const cmd = 'docker';
33
+ const args = ['exec', '-it', containers[0].Id, input?.shell || 'bash'];
34
+ const child = spawn(cmd, args, {
35
+ stdio: 'inherit',
36
+ env: {
37
+ ...process.env,
38
+ DOCKER_CLI_HINTS: 'false',
39
+ },
40
+ });
41
+ const forward = (sig) => {
42
+ try {
43
+ child.kill(sig);
44
+ }
45
+ catch { }
46
+ };
47
+ const signals = [
48
+ 'SIGINT',
49
+ 'SIGTERM',
50
+ 'SIGHUP',
51
+ 'SIGQUIT',
52
+ ];
53
+ signals.forEach((sig) => {
54
+ process.on(sig, () => forward(sig));
55
+ });
56
+ return new Promise((resolve, reject) => {
57
+ child.on('error', (err) => {
58
+ reject(new Error(`Failed to exeucte docker: ${err.message}`));
59
+ });
60
+ child.on('exit', (code, signal) => {
61
+ if (code !== null && code !== 0) {
62
+ reject(new ShellExitError(`The shell exited unexpectedly. ${code}`, input.component, code, signal));
63
+ }
64
+ else {
65
+ resolve();
66
+ }
67
+ });
68
+ });
69
+ }
70
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './ExecContainerOperation.js';
2
+ export * from './ExecShellOperation.js';
2
3
  export * from './ListContainersOperation.js';
3
4
  export * from './PruneContainersOperation.js';
@@ -1,3 +1,4 @@
1
1
  export * from './ExecContainerOperation.js';
2
+ export * from './ExecShellOperation.js';
2
3
  export * from './ListContainersOperation.js';
3
4
  export * from './PruneContainersOperation.js';
@@ -21,14 +21,17 @@ const DockerImageOpFactory = async ({ config, component, monorepo }) => {
21
21
  context,
22
22
  dockerfile: fromConfig.dockerfile || 'Dockerfile',
23
23
  src: sources.map((s) => s.path),
24
- buildArgs: fromConfig.buildArgs || {},
25
- tag: `${imageName}:${tagName}`,
26
- labels: {
24
+ buildArgs: await monorepo.expand({
25
+ ...monorepo.defaults.docker?.buildArgs,
26
+ ...fromConfig.buildArgs,
27
+ }),
28
+ tag: await monorepo.expand(`${imageName}:${tagName}`),
29
+ labels: await monorepo.expand({
27
30
  ...fromConfig.labels,
28
31
  'emb/project': monorepo.name,
29
32
  'emb/component': component.name,
30
33
  'emb/flavor': monorepo.currentFlavor,
31
- },
34
+ }),
32
35
  target: fromConfig.target,
33
36
  };
34
37
  const lastUpdatedInfo = async (sources) => {
@@ -56,7 +59,7 @@ const DockerImageOpFactory = async ({ config, component, monorepo }) => {
56
59
  ? lastUpdated
57
60
  : undefined;
58
61
  },
59
- input: await monorepo.expand(buildParams),
62
+ input: buildParams,
60
63
  operation: new BuildImageOperation(),
61
64
  };
62
65
  };
@@ -58,3 +58,17 @@ export declare class CircularDependencyError extends EMBError {
58
58
  readonly deps: Array<Array<string>>;
59
59
  constructor(msg: string, deps: Array<Array<string>>);
60
60
  }
61
+ export declare class ShellExitError extends EMBError {
62
+ component: string;
63
+ exitCode: number;
64
+ signal?: (NodeJS.Signals | null) | undefined;
65
+ constructor(msg: string, component: string, exitCode: number, signal?: (NodeJS.Signals | null) | undefined);
66
+ }
67
+ export declare class NoContainerFoundError extends EMBError {
68
+ component: string;
69
+ constructor(msg: string, component: string);
70
+ }
71
+ export declare class MultipleContainersFoundError extends EMBError {
72
+ component: string;
73
+ constructor(msg: string, component: string);
74
+ }
@@ -44,7 +44,7 @@ export class AmbiguousReferenceError extends EMBError {
44
44
  ref;
45
45
  matches;
46
46
  constructor(msg, ref, matches) {
47
- super('AMBIGUOUS_TASK', msg);
47
+ super('AMBIGUOUS_REF', msg);
48
48
  this.ref = ref;
49
49
  this.matches = matches;
50
50
  }
@@ -70,3 +70,28 @@ export class CircularDependencyError extends EMBError {
70
70
  this.deps = deps;
71
71
  }
72
72
  }
73
+ export class ShellExitError extends EMBError {
74
+ component;
75
+ exitCode;
76
+ signal;
77
+ constructor(msg, component, exitCode, signal) {
78
+ super('SHELL_EXIT_ERR', msg);
79
+ this.component = component;
80
+ this.exitCode = exitCode;
81
+ this.signal = signal;
82
+ }
83
+ }
84
+ export class NoContainerFoundError extends EMBError {
85
+ component;
86
+ constructor(msg, component) {
87
+ super('CMP_NO_CONTAINER', msg);
88
+ this.component = component;
89
+ }
90
+ }
91
+ export class MultipleContainersFoundError extends EMBError {
92
+ component;
93
+ constructor(msg, component) {
94
+ super('CMP_NO_CONTAINER', msg);
95
+ this.component = component;
96
+ }
97
+ }
@@ -168,82 +168,104 @@
168
168
  "index.js"
169
169
  ]
170
170
  },
171
- "containers": {
171
+ "components:logs": {
172
172
  "aliases": [
173
- "ps"
173
+ "logs"
174
174
  ],
175
- "args": {},
176
- "description": "List docker containers.",
175
+ "args": {
176
+ "component": {
177
+ "description": "The component you want to see the logs of",
178
+ "name": "component",
179
+ "required": true
180
+ }
181
+ },
182
+ "description": "Get components logs.",
177
183
  "examples": [
178
184
  "<%= config.bin %> <%= command.id %>"
179
185
  ],
180
186
  "flags": {
181
- "json": {
182
- "description": "Format output as json.",
183
- "helpGroup": "GLOBAL",
184
- "name": "json",
185
- "allowNo": false,
186
- "type": "boolean"
187
- },
188
- "all": {
189
- "char": "a",
190
- "description": "Retun all containers. By default, only running containers are shown",
191
- "name": "all",
187
+ "flavor": {
188
+ "description": "Specify the flavor to use.",
189
+ "name": "flavor",
192
190
  "required": false,
191
+ "hasDynamicHelp": false,
192
+ "multiple": false,
193
+ "type": "option"
194
+ },
195
+ "follow": {
196
+ "char": "f",
197
+ "description": "Follow log output",
198
+ "name": "follow",
193
199
  "allowNo": false,
194
200
  "type": "boolean"
195
201
  }
196
202
  },
197
203
  "hasDynamicHelp": false,
198
204
  "hiddenAliases": [],
199
- "id": "containers",
205
+ "id": "components:logs",
200
206
  "pluginAlias": "@enspirit/emb",
201
207
  "pluginName": "@enspirit/emb",
202
208
  "pluginType": "core",
203
- "strict": true,
204
- "enableJsonFlag": true,
209
+ "enableJsonFlag": false,
205
210
  "isESM": true,
206
211
  "relativePath": [
207
212
  "dist",
208
213
  "src",
209
214
  "cli",
210
215
  "commands",
211
- "containers",
212
- "index.js"
216
+ "components",
217
+ "logs.js"
213
218
  ]
214
219
  },
215
- "containers:prune": {
216
- "aliases": [],
217
- "args": {},
218
- "description": "Prune containers.",
220
+ "components:shell": {
221
+ "aliases": [
222
+ "shell"
223
+ ],
224
+ "args": {
225
+ "component": {
226
+ "description": "The component you want to get a shell on",
227
+ "name": "component",
228
+ "required": true
229
+ }
230
+ },
231
+ "description": "Get a shell on a running component.",
219
232
  "examples": [
220
233
  "<%= config.bin %> <%= command.id %>"
221
234
  ],
222
235
  "flags": {
223
- "json": {
224
- "description": "Format output as json.",
225
- "helpGroup": "GLOBAL",
226
- "name": "json",
227
- "allowNo": false,
228
- "type": "boolean"
236
+ "flavor": {
237
+ "description": "Specify the flavor to use.",
238
+ "name": "flavor",
239
+ "required": false,
240
+ "hasDynamicHelp": false,
241
+ "multiple": false,
242
+ "type": "option"
243
+ },
244
+ "shell": {
245
+ "char": "s",
246
+ "description": "The shell to run",
247
+ "name": "shell",
248
+ "default": "bash",
249
+ "hasDynamicHelp": false,
250
+ "multiple": false,
251
+ "type": "option"
229
252
  }
230
253
  },
231
254
  "hasDynamicHelp": false,
232
255
  "hiddenAliases": [],
233
- "id": "containers:prune",
256
+ "id": "components:shell",
234
257
  "pluginAlias": "@enspirit/emb",
235
258
  "pluginName": "@enspirit/emb",
236
259
  "pluginType": "core",
237
- "strict": true,
238
- "enableJsonFlag": true,
260
+ "enableJsonFlag": false,
239
261
  "isESM": true,
240
262
  "relativePath": [
241
263
  "dist",
242
264
  "src",
243
265
  "cli",
244
266
  "commands",
245
- "containers",
246
- "prune.js"
267
+ "components",
268
+ "shell.js"
247
269
  ]
248
270
  },
249
271
  "config:print": {
@@ -287,10 +309,12 @@
287
309
  "print.js"
288
310
  ]
289
311
  },
290
- "images:delete": {
291
- "aliases": [],
312
+ "containers": {
313
+ "aliases": [
314
+ "ps"
315
+ ],
292
316
  "args": {},
293
- "description": "Delete project images.",
317
+ "description": "List docker containers.",
294
318
  "examples": [
295
319
  "<%= config.bin %> <%= command.id %>"
296
320
  ],
@@ -302,10 +326,10 @@
302
326
  "allowNo": false,
303
327
  "type": "boolean"
304
328
  },
305
- "force": {
306
- "char": "f",
307
- "description": "Remove the image even if it is being used by stopped containers or has other tags",
308
- "name": "force",
329
+ "all": {
330
+ "char": "a",
331
+ "description": "Retun all containers. By default, only running containers are shown",
332
+ "name": "all",
309
333
  "required": false,
310
334
  "allowNo": false,
311
335
  "type": "boolean"
@@ -313,7 +337,7 @@
313
337
  },
314
338
  "hasDynamicHelp": false,
315
339
  "hiddenAliases": [],
316
- "id": "images:delete",
340
+ "id": "containers",
317
341
  "pluginAlias": "@enspirit/emb",
318
342
  "pluginName": "@enspirit/emb",
319
343
  "pluginType": "core",
@@ -325,14 +349,14 @@
325
349
  "src",
326
350
  "cli",
327
351
  "commands",
328
- "images",
329
- "delete.js"
352
+ "containers",
353
+ "index.js"
330
354
  ]
331
355
  },
332
- "images": {
356
+ "containers:prune": {
333
357
  "aliases": [],
334
358
  "args": {},
335
- "description": "List docker images.",
359
+ "description": "Prune containers.",
336
360
  "examples": [
337
361
  "<%= config.bin %> <%= command.id %>"
338
362
  ],
@@ -343,30 +367,15 @@
343
367
  "name": "json",
344
368
  "allowNo": false,
345
369
  "type": "boolean"
346
- },
347
- "flavor": {
348
- "description": "Specify the flavor to use.",
349
- "name": "flavor",
350
- "required": false,
351
- "hasDynamicHelp": false,
352
- "multiple": false,
353
- "type": "option"
354
- },
355
- "all": {
356
- "char": "a",
357
- "description": "Show all images. Only images from a final layer (no children) are shown by default.",
358
- "name": "all",
359
- "required": false,
360
- "allowNo": false,
361
- "type": "boolean"
362
370
  }
363
371
  },
364
372
  "hasDynamicHelp": false,
365
373
  "hiddenAliases": [],
366
- "id": "images",
374
+ "id": "containers:prune",
367
375
  "pluginAlias": "@enspirit/emb",
368
376
  "pluginName": "@enspirit/emb",
369
377
  "pluginType": "core",
378
+ "strict": true,
370
379
  "enableJsonFlag": true,
371
380
  "isESM": true,
372
381
  "relativePath": [
@@ -374,14 +383,14 @@
374
383
  "src",
375
384
  "cli",
376
385
  "commands",
377
- "images",
378
- "index.js"
386
+ "containers",
387
+ "prune.js"
379
388
  ]
380
389
  },
381
- "images:prune": {
390
+ "images:delete": {
382
391
  "aliases": [],
383
392
  "args": {},
384
- "description": "Prune project images.",
393
+ "description": "Delete project images.",
385
394
  "examples": [
386
395
  "<%= config.bin %> <%= command.id %>"
387
396
  ],
@@ -393,10 +402,10 @@
393
402
  "allowNo": false,
394
403
  "type": "boolean"
395
404
  },
396
- "all": {
397
- "char": "a",
398
- "description": "Prune all images. When set to true all images will be pruned, not only dangling ones",
399
- "name": "all",
405
+ "force": {
406
+ "char": "f",
407
+ "description": "Remove the image even if it is being used by stopped containers or has other tags",
408
+ "name": "force",
400
409
  "required": false,
401
410
  "allowNo": false,
402
411
  "type": "boolean"
@@ -404,7 +413,7 @@
404
413
  },
405
414
  "hasDynamicHelp": false,
406
415
  "hiddenAliases": [],
407
- "id": "images:prune",
416
+ "id": "images:delete",
408
417
  "pluginAlias": "@enspirit/emb",
409
418
  "pluginName": "@enspirit/emb",
410
419
  "pluginType": "core",
@@ -417,21 +426,15 @@
417
426
  "cli",
418
427
  "commands",
419
428
  "images",
420
- "prune.js"
429
+ "delete.js"
421
430
  ]
422
431
  },
423
- "resources:build": {
432
+ "images": {
424
433
  "aliases": [],
425
- "args": {
426
- "component": {
427
- "description": "List of resources to build (defaults to all)",
428
- "name": "component",
429
- "required": false
430
- }
431
- },
432
- "description": "Build the resources of the monorepo",
434
+ "args": {},
435
+ "description": "List docker images.",
433
436
  "examples": [
434
- "<%= config.bin %> <%= command.id %> build --flavor development"
437
+ "<%= config.bin %> <%= command.id %>"
435
438
  ],
436
439
  "flags": {
437
440
  "json": {
@@ -449,17 +452,10 @@
449
452
  "multiple": false,
450
453
  "type": "option"
451
454
  },
452
- "dry-run": {
453
- "description": "Do not build the resources but only produce build meta information",
454
- "name": "dry-run",
455
- "required": false,
456
- "allowNo": false,
457
- "type": "boolean"
458
- },
459
- "force": {
460
- "char": "f",
461
- "description": "Bypass the cache and force the build",
462
- "name": "force",
455
+ "all": {
456
+ "char": "a",
457
+ "description": "Show all images. Only images from a final layer (no children) are shown by default.",
458
+ "name": "all",
463
459
  "required": false,
464
460
  "allowNo": false,
465
461
  "type": "boolean"
@@ -467,11 +463,10 @@
467
463
  },
468
464
  "hasDynamicHelp": false,
469
465
  "hiddenAliases": [],
470
- "id": "resources:build",
466
+ "id": "images",
471
467
  "pluginAlias": "@enspirit/emb",
472
468
  "pluginName": "@enspirit/emb",
473
469
  "pluginType": "core",
474
- "strict": false,
475
470
  "enableJsonFlag": true,
476
471
  "isESM": true,
477
472
  "relativePath": [
@@ -479,14 +474,14 @@
479
474
  "src",
480
475
  "cli",
481
476
  "commands",
482
- "resources",
483
- "build.js"
477
+ "images",
478
+ "index.js"
484
479
  ]
485
480
  },
486
- "resources": {
481
+ "images:prune": {
487
482
  "aliases": [],
488
483
  "args": {},
489
- "description": "List resources.",
484
+ "description": "Prune project images.",
490
485
  "examples": [
491
486
  "<%= config.bin %> <%= command.id %>"
492
487
  ],
@@ -498,21 +493,22 @@
498
493
  "allowNo": false,
499
494
  "type": "boolean"
500
495
  },
501
- "flavor": {
502
- "description": "Specify the flavor to use.",
503
- "name": "flavor",
496
+ "all": {
497
+ "char": "a",
498
+ "description": "Prune all images. When set to true all images will be pruned, not only dangling ones",
499
+ "name": "all",
504
500
  "required": false,
505
- "hasDynamicHelp": false,
506
- "multiple": false,
507
- "type": "option"
501
+ "allowNo": false,
502
+ "type": "boolean"
508
503
  }
509
504
  },
510
505
  "hasDynamicHelp": false,
511
506
  "hiddenAliases": [],
512
- "id": "resources",
507
+ "id": "images:prune",
513
508
  "pluginAlias": "@enspirit/emb",
514
509
  "pluginName": "@enspirit/emb",
515
510
  "pluginType": "core",
511
+ "strict": true,
516
512
  "enableJsonFlag": true,
517
513
  "isESM": true,
518
514
  "relativePath": [
@@ -520,8 +516,8 @@
520
516
  "src",
521
517
  "cli",
522
518
  "commands",
523
- "resources",
524
- "index.js"
519
+ "images",
520
+ "prune.js"
525
521
  ]
526
522
  },
527
523
  "tasks": {
@@ -616,7 +612,111 @@
616
612
  "tasks",
617
613
  "run.js"
618
614
  ]
615
+ },
616
+ "resources:build": {
617
+ "aliases": [],
618
+ "args": {
619
+ "component": {
620
+ "description": "List of resources to build (defaults to all)",
621
+ "name": "component",
622
+ "required": false
623
+ }
624
+ },
625
+ "description": "Build the resources of the monorepo",
626
+ "examples": [
627
+ "<%= config.bin %> <%= command.id %> build --flavor development"
628
+ ],
629
+ "flags": {
630
+ "json": {
631
+ "description": "Format output as json.",
632
+ "helpGroup": "GLOBAL",
633
+ "name": "json",
634
+ "allowNo": false,
635
+ "type": "boolean"
636
+ },
637
+ "flavor": {
638
+ "description": "Specify the flavor to use.",
639
+ "name": "flavor",
640
+ "required": false,
641
+ "hasDynamicHelp": false,
642
+ "multiple": false,
643
+ "type": "option"
644
+ },
645
+ "dry-run": {
646
+ "description": "Do not build the resources but only produce build meta information",
647
+ "name": "dry-run",
648
+ "required": false,
649
+ "allowNo": false,
650
+ "type": "boolean"
651
+ },
652
+ "force": {
653
+ "char": "f",
654
+ "description": "Bypass the cache and force the build",
655
+ "name": "force",
656
+ "required": false,
657
+ "allowNo": false,
658
+ "type": "boolean"
659
+ }
660
+ },
661
+ "hasDynamicHelp": false,
662
+ "hiddenAliases": [],
663
+ "id": "resources:build",
664
+ "pluginAlias": "@enspirit/emb",
665
+ "pluginName": "@enspirit/emb",
666
+ "pluginType": "core",
667
+ "strict": false,
668
+ "enableJsonFlag": true,
669
+ "isESM": true,
670
+ "relativePath": [
671
+ "dist",
672
+ "src",
673
+ "cli",
674
+ "commands",
675
+ "resources",
676
+ "build.js"
677
+ ]
678
+ },
679
+ "resources": {
680
+ "aliases": [],
681
+ "args": {},
682
+ "description": "List resources.",
683
+ "examples": [
684
+ "<%= config.bin %> <%= command.id %>"
685
+ ],
686
+ "flags": {
687
+ "json": {
688
+ "description": "Format output as json.",
689
+ "helpGroup": "GLOBAL",
690
+ "name": "json",
691
+ "allowNo": false,
692
+ "type": "boolean"
693
+ },
694
+ "flavor": {
695
+ "description": "Specify the flavor to use.",
696
+ "name": "flavor",
697
+ "required": false,
698
+ "hasDynamicHelp": false,
699
+ "multiple": false,
700
+ "type": "option"
701
+ }
702
+ },
703
+ "hasDynamicHelp": false,
704
+ "hiddenAliases": [],
705
+ "id": "resources",
706
+ "pluginAlias": "@enspirit/emb",
707
+ "pluginName": "@enspirit/emb",
708
+ "pluginType": "core",
709
+ "enableJsonFlag": true,
710
+ "isESM": true,
711
+ "relativePath": [
712
+ "dist",
713
+ "src",
714
+ "cli",
715
+ "commands",
716
+ "resources",
717
+ "index.js"
718
+ ]
619
719
  }
620
720
  },
621
- "version": "0.1.2"
721
+ "version": "0.2.0"
622
722
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@enspirit/emb",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.2.0",
5
5
  "keywords": ["monorepo", "docker", "taskrunner", "ci", "docker compose", "sentinel", "makefile"],
6
6
  "author": "Louis Lambeau <louis.lambeau@enspirit.be>",
7
7
  "license": "ISC",