@enspirit/emb 0.1.0 → 0.1.2

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.0 darwin-x64 node-v22.12.0
17
+ @enspirit/emb/0.1.2 darwin-x64 node-v22.12.0
18
18
  $ emb --help [COMMAND]
19
19
  USAGE
20
20
  $ emb COMMAND
@@ -225,10 +225,11 @@ List docker images.
225
225
 
226
226
  ```
227
227
  USAGE
228
- $ emb images [--json] [-a]
228
+ $ emb images [--json] [--flavor <value>] [-a]
229
229
 
230
230
  FLAGS
231
- -a, --all Show all images. Only images from a final layer (no children) are shown by default.
231
+ -a, --all Show all images. Only images from a final layer (no children) are shown by default.
232
+ --flavor=<value> Specify the flavor to use.
232
233
 
233
234
  GLOBAL FLAGS
234
235
  --json Format output as json.
@@ -9,5 +9,8 @@ export declare abstract class FlavoredCommand<T extends typeof Command> extends
9
9
  static enableJsonFlag: boolean;
10
10
  protected args: Args<T>;
11
11
  protected flags: Flags<T>;
12
+ protected catch(err: Error & {
13
+ exitCode?: number;
14
+ }): Promise<void>;
12
15
  init(): Promise<void>;
13
16
  }
@@ -1,5 +1,6 @@
1
1
  import { getContext, setContext } from '../../index.js';
2
2
  import { Flags } from '@oclif/core';
3
+ import { JsonPatchError } from 'fast-json-patch';
3
4
  import { BaseCommand } from './BaseCommand.js';
4
5
  export class FlavoredCommand extends BaseCommand {
5
6
  // define flags that can be inherited by any command that extends FlavoredCommand
@@ -14,6 +15,19 @@ export class FlavoredCommand extends BaseCommand {
14
15
  static enableJsonFlag = true;
15
16
  args;
16
17
  flags;
18
+ async catch(err) {
19
+ if (err instanceof JsonPatchError) {
20
+ this.log('INVALID', err.operation);
21
+ this.error('Invalid patch detected while applying flavor', {
22
+ code: err.name,
23
+ message: `Path \`${err.operation?.path}\``,
24
+ });
25
+ return;
26
+ }
27
+ // add any custom logic to handle errors from the command
28
+ // or simply return the parent class error handling
29
+ return super.catch(err);
30
+ }
17
31
  async init() {
18
32
  await super.init();
19
33
  const { args, flags } = await this.parse({
@@ -1,4 +1,4 @@
1
- import { BaseCommand } from '../../index.js';
1
+ import { FlavoredCommand } from '../../index.js';
2
2
  export type ImageInfo = {
3
3
  created: Date;
4
4
  imageId: string;
@@ -6,7 +6,7 @@ export type ImageInfo = {
6
6
  size: number;
7
7
  tag: string;
8
8
  };
9
- export default class ImagesIndex extends BaseCommand {
9
+ export default class ImagesIndex extends FlavoredCommand<typeof ImagesIndex> {
10
10
  static description: string;
11
11
  static enableJsonFlag: boolean;
12
12
  static examples: string[];
@@ -1,10 +1,10 @@
1
1
  import { getContext } from '../../../index.js';
2
2
  import { Flags } from '@oclif/core';
3
3
  import { printTable } from '@oclif/table';
4
- import { BaseCommand, TABLE_DEFAULTS } from '../../index.js';
4
+ import { FlavoredCommand, TABLE_DEFAULTS } from '../../index.js';
5
5
  import { listImages, shortId } from '../../../docker/index.js';
6
6
  import { timeAgo } from '../../../utils/index.js';
7
- export default class ImagesIndex extends BaseCommand {
7
+ export default class ImagesIndex extends FlavoredCommand {
8
8
  static description = 'List docker images.';
9
9
  static enableJsonFlag = true;
10
10
  static examples = ['<%= config.bin %> <%= command.id %>'];
@@ -20,6 +20,9 @@ export default class UpCommand extends FlavoredCommand {
20
20
  if (flags.force) {
21
21
  buildFlags.push('--force');
22
22
  }
23
+ if (flags.flavor) {
24
+ buildFlags.push('--flavor', flags.flavor);
25
+ }
23
26
  await this.config.runCommand('resources:build', buildFlags);
24
27
  await monorepo.run(new ComposeUpOperation(), {
25
28
  forceRecreate: flags.force,
@@ -83,6 +83,10 @@ export interface DefaultsConfig {
83
83
  };
84
84
  }
85
85
  export interface ComponentConfig {
86
+ /**
87
+ * Path to the component's root folder (relative to root of monorepo)
88
+ */
89
+ rootDir?: string;
86
90
  /**
87
91
  * A description of the component.
88
92
  */
@@ -125,6 +129,5 @@ export interface JsonPatchCopyOperation {
125
129
  from: string;
126
130
  }
127
131
  export interface ProjectFlavorConfig {
128
- defaults?: DefaultsConfig;
129
132
  patches?: JsonPatchOperation[];
130
133
  }
@@ -144,6 +144,10 @@
144
144
  "type": "object",
145
145
  "required": [],
146
146
  "properties": {
147
+ "rootDir": {
148
+ "type": "string",
149
+ "description": "Path to the component's root folder (relative to root of monorepo)"
150
+ },
147
151
  "description": {
148
152
  "type": "string",
149
153
  "minLength": 1,
@@ -196,9 +200,6 @@
196
200
  "additionalProperties": false,
197
201
  "required": [],
198
202
  "properties": {
199
- "defaults": {
200
- "$ref": "#/$defs/DefaultsConfig"
201
- },
202
203
  "patches": {
203
204
  "type": "array",
204
205
  "items": {
@@ -43,6 +43,9 @@ export const validateEmbfile = async (pathOrObject) => {
43
43
  if (!validate) {
44
44
  throw new Error('Could not find the JSON schema validator for Embfile');
45
45
  }
46
+ if (!component) {
47
+ return {};
48
+ }
46
49
  if (!validate(component)) {
47
50
  ajv.errors?.forEach((err) => console.error(err));
48
51
  throw new Error(`Your .emb.yml is incorrect`);
@@ -1,20 +1,28 @@
1
- import { stat } from 'node:fs/promises';
1
+ import { stat, statfs } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import pMap from 'p-map';
2
4
  import { GitPrerequisitePlugin } from '../../prerequisites/index.js';
3
5
  import { ResourceFactory, } from '../../monorepo/resources/ResourceFactory.js';
4
6
  import { BuildImageOperation } from '../operations/index.js';
5
7
  const DockerImageOpFactory = async ({ config, component, monorepo }) => {
6
8
  const fromConfig = (config.params || {});
7
- const plugin = new GitPrerequisitePlugin();
8
- const sources = await plugin.collect(component);
9
9
  const context = fromConfig.context
10
- ? component.join(fromConfig.context)
11
- : component.rootDir;
10
+ ? fromConfig.context[0] === '/'
11
+ ? monorepo.join(fromConfig.context)
12
+ : component.join(fromConfig.context)
13
+ : monorepo.join(component.rootDir);
14
+ // Ensure the folder exists
15
+ await statfs(context);
16
+ const plugin = new GitPrerequisitePlugin();
17
+ const sources = await plugin.collect(context);
18
+ const imageName = [monorepo.name, fromConfig.tag || component.name].join('/');
19
+ const tagName = fromConfig.tag || monorepo.defaults.docker?.tag || 'latest';
12
20
  const buildParams = {
13
21
  context,
14
22
  dockerfile: fromConfig.dockerfile || 'Dockerfile',
15
23
  src: sources.map((s) => s.path),
16
24
  buildArgs: fromConfig.buildArgs || {},
17
- tag: [monorepo.name, fromConfig.tag || component.name].join('/'),
25
+ tag: `${imageName}:${tagName}`,
18
26
  labels: {
19
27
  ...fromConfig.labels,
20
28
  'emb/project': monorepo.name,
@@ -24,13 +32,13 @@ const DockerImageOpFactory = async ({ config, component, monorepo }) => {
24
32
  target: fromConfig.target,
25
33
  };
26
34
  const lastUpdatedInfo = async (sources) => {
27
- const stats = await Promise.all(sources.map(async (s) => {
28
- const stats = await stat(component.join(s.path));
35
+ const stats = await pMap(sources, async (s) => {
36
+ const stats = await stat(join(context, s.path));
29
37
  return {
30
38
  time: stats.mtime,
31
39
  path: s.path,
32
40
  };
33
- }));
41
+ }, { concurrency: 30 });
34
42
  if (stats.length === 0) {
35
43
  return 0;
36
44
  }
@@ -1,19 +1,17 @@
1
1
  import { ComponentConfig, ComponentFlavorConfig } from '../config/schema.js';
2
2
  import { ComponentFlavors, Monorepo, Resources, Tasks } from './index.js';
3
- import { FilePrerequisite } from '../prerequisites/index.js';
4
3
  export declare class Component implements ComponentConfig {
5
4
  readonly name: string;
6
5
  readonly config: ComponentConfig;
7
6
  protected monorepo: Monorepo;
7
+ readonly rootDir: string;
8
8
  readonly tasks: Tasks;
9
9
  readonly resources: Resources;
10
10
  readonly flavors: ComponentFlavors;
11
11
  constructor(name: string, config: ComponentConfig, monorepo: Monorepo);
12
- get rootDir(): string;
13
12
  flavor(name: string, mustExist?: boolean): ComponentFlavorConfig;
14
13
  cloneWith(config: Partial<ComponentConfig>): ComponentConfig;
15
14
  toJSON(): ComponentConfig;
16
15
  withFlavor(name: string): Component;
17
- getPrerequisites(): Promise<Array<FilePrerequisite>>;
18
16
  join(path: string): string;
19
17
  }
@@ -1,11 +1,11 @@
1
1
  import jsonpatch from 'fast-json-patch';
2
2
  import { join } from 'node:path';
3
3
  import { toIdentifedHash, } from './index.js';
4
- import { GitPrerequisitePlugin } from '../prerequisites/index.js';
5
4
  export class Component {
6
5
  name;
7
6
  config;
8
7
  monorepo;
8
+ rootDir;
9
9
  tasks;
10
10
  resources;
11
11
  flavors;
@@ -13,15 +13,13 @@ export class Component {
13
13
  this.name = name;
14
14
  this.config = config;
15
15
  this.monorepo = monorepo;
16
+ this.rootDir = config.rootDir || name;
16
17
  this.tasks = toIdentifedHash(config.tasks || {}, this.name);
17
18
  this.resources = toIdentifedHash(
18
19
  // Due to the schema.json -> typescript conversion weirdness
19
20
  config.resources || {}, this.name);
20
21
  this.flavors = toIdentifedHash(config.flavors || {}, this.name);
21
22
  }
22
- get rootDir() {
23
- return this.monorepo.join(this.name);
24
- }
25
23
  flavor(name, mustExist = true) {
26
24
  const flavor = this.flavors[name];
27
25
  if (!flavor && mustExist) {
@@ -43,19 +41,14 @@ export class Component {
43
41
  const patches = this.flavor(name).patches || [];
44
42
  const errors = jsonpatch.validate(patches, original);
45
43
  if (errors) {
46
- throw new Error('Invalid patch(es) detected');
44
+ throw errors;
47
45
  }
48
46
  const patched = patches.reduce((doc, patch, index) => {
49
47
  return jsonpatch.applyReducer(doc, patch, index);
50
48
  }, original);
51
49
  return new Component(this.name, patched, this.monorepo);
52
50
  }
53
- async getPrerequisites() {
54
- // TODO: move this to config with potential overridzs
55
- const plugin = new GitPrerequisitePlugin();
56
- return plugin.collect(this);
57
- }
58
51
  join(path) {
59
- return join(this.rootDir, path);
52
+ return this.monorepo.join(join(this.rootDir, path));
60
53
  }
61
54
  }
@@ -12,7 +12,6 @@ export class Monorepo {
12
12
  initialized = false;
13
13
  constructor(config, defaultFlavor = 'default') {
14
14
  this.defaultFlavor = defaultFlavor;
15
- console.log('WEIRD BECAUSE, adnsod', defaultFlavor);
16
15
  this._config = new MonorepoConfig(config);
17
16
  }
18
17
  get config() {
@@ -168,13 +167,13 @@ export class Monorepo {
168
167
  const original = this._config.toJSON();
169
168
  const errors = jsonpatch.validate(patches || [], original);
170
169
  if (errors) {
171
- throw new Error('Invalid patch(es) detected');
170
+ throw errors;
172
171
  }
173
172
  const withComponentPatches = this.components.reduce((config, cmp) => {
174
173
  const componentPatches = cmp.flavor(flavorName, false)?.patches || [];
175
174
  const errors = jsonpatch.validate(componentPatches || [], config.components[cmp.name]);
176
175
  if (errors) {
177
- throw new Error('Invalid patch(es) detected');
176
+ throw errors;
178
177
  }
179
178
  config.components[cmp.name] = componentPatches.reduce((doc, patch, index) => {
180
179
  return jsonpatch.applyReducer(doc, patch, index);
@@ -32,7 +32,10 @@ export class EmbfileLoaderPlugin extends AbstractPlugin {
32
32
  const embfile = await join(config.project.rootDir, path);
33
33
  const component = await validateEmbfile(embfile);
34
34
  const original = config.components[name];
35
- const newComponent = deepmerge()(original || {}, component);
35
+ const newComponent = deepmerge()(original || {}, {
36
+ ...component,
37
+ rootDir,
38
+ });
36
39
  return config.with({
37
40
  components: {
38
41
  [name]: newComponent,
@@ -1,5 +1,4 @@
1
- import { Component } from '../monorepo/index.js';
2
1
  import { FilePrerequisite, PrerequisitePlugin, PrerequisiteType } from './types.js';
3
2
  export declare class GitPrerequisitePlugin implements PrerequisitePlugin<PrerequisiteType.file, FilePrerequisite> {
4
- collect(component: Component): Promise<Array<FilePrerequisite>>;
3
+ collect(path: string): Promise<Array<FilePrerequisite>>;
5
4
  }
@@ -1,9 +1,9 @@
1
1
  import { simpleGit } from 'simple-git';
2
2
  import { PrerequisiteType, } from './types.js';
3
3
  export class GitPrerequisitePlugin {
4
- async collect(component) {
5
- const repo = simpleGit(component.rootDir);
6
- return (await repo.raw('ls-files', component.rootDir))
4
+ async collect(path) {
5
+ const repo = simpleGit(path);
6
+ return (await repo.raw('ls-files', path))
7
7
  .split('\n')
8
8
  .map((s) => s.trim())
9
9
  .filter(Boolean)
@@ -18,9 +18,9 @@ export interface FilePrerequisite extends Prerequisite<PrerequisiteType.file> {
18
18
  }
19
19
  export interface PrerequisitePlugin<T extends PrerequisiteType, P extends Prerequisite<T>, Output = unknown, Changes = unknown> {
20
20
  /**
21
- * Collect/discover prerequisistes for a specific component
21
+ * Collect/discover prerequisistes for a path (relative to the monorepo root)
22
22
  */
23
- collect?(component: Component): Promise<Array<P>>;
23
+ collect?(path: string): Promise<Array<P>>;
24
24
  /**
25
25
  * Returns the list of changes between the last collection and the new
26
26
  * collection.
@@ -168,10 +168,12 @@
168
168
  "index.js"
169
169
  ]
170
170
  },
171
- "config:print": {
172
- "aliases": [],
171
+ "containers": {
172
+ "aliases": [
173
+ "ps"
174
+ ],
173
175
  "args": {},
174
- "description": "Print the current config.",
176
+ "description": "List docker containers.",
175
177
  "examples": [
176
178
  "<%= config.bin %> <%= command.id %>"
177
179
  ],
@@ -183,21 +185,22 @@
183
185
  "allowNo": false,
184
186
  "type": "boolean"
185
187
  },
186
- "flavor": {
187
- "description": "Specify the flavor to use.",
188
- "name": "flavor",
188
+ "all": {
189
+ "char": "a",
190
+ "description": "Retun all containers. By default, only running containers are shown",
191
+ "name": "all",
189
192
  "required": false,
190
- "hasDynamicHelp": false,
191
- "multiple": false,
192
- "type": "option"
193
+ "allowNo": false,
194
+ "type": "boolean"
193
195
  }
194
196
  },
195
197
  "hasDynamicHelp": false,
196
198
  "hiddenAliases": [],
197
- "id": "config:print",
199
+ "id": "containers",
198
200
  "pluginAlias": "@enspirit/emb",
199
201
  "pluginName": "@enspirit/emb",
200
202
  "pluginType": "core",
203
+ "strict": true,
201
204
  "enableJsonFlag": true,
202
205
  "isESM": true,
203
206
  "relativePath": [
@@ -205,16 +208,14 @@
205
208
  "src",
206
209
  "cli",
207
210
  "commands",
208
- "config",
209
- "print.js"
211
+ "containers",
212
+ "index.js"
210
213
  ]
211
214
  },
212
- "containers": {
213
- "aliases": [
214
- "ps"
215
- ],
215
+ "containers:prune": {
216
+ "aliases": [],
216
217
  "args": {},
217
- "description": "List docker containers.",
218
+ "description": "Prune containers.",
218
219
  "examples": [
219
220
  "<%= config.bin %> <%= command.id %>"
220
221
  ],
@@ -225,19 +226,11 @@
225
226
  "name": "json",
226
227
  "allowNo": false,
227
228
  "type": "boolean"
228
- },
229
- "all": {
230
- "char": "a",
231
- "description": "Retun all containers. By default, only running containers are shown",
232
- "name": "all",
233
- "required": false,
234
- "allowNo": false,
235
- "type": "boolean"
236
229
  }
237
230
  },
238
231
  "hasDynamicHelp": false,
239
232
  "hiddenAliases": [],
240
- "id": "containers",
233
+ "id": "containers:prune",
241
234
  "pluginAlias": "@enspirit/emb",
242
235
  "pluginName": "@enspirit/emb",
243
236
  "pluginType": "core",
@@ -250,13 +243,13 @@
250
243
  "cli",
251
244
  "commands",
252
245
  "containers",
253
- "index.js"
246
+ "prune.js"
254
247
  ]
255
248
  },
256
- "containers:prune": {
249
+ "config:print": {
257
250
  "aliases": [],
258
251
  "args": {},
259
- "description": "Prune containers.",
252
+ "description": "Print the current config.",
260
253
  "examples": [
261
254
  "<%= config.bin %> <%= command.id %>"
262
255
  ],
@@ -267,15 +260,22 @@
267
260
  "name": "json",
268
261
  "allowNo": false,
269
262
  "type": "boolean"
263
+ },
264
+ "flavor": {
265
+ "description": "Specify the flavor to use.",
266
+ "name": "flavor",
267
+ "required": false,
268
+ "hasDynamicHelp": false,
269
+ "multiple": false,
270
+ "type": "option"
270
271
  }
271
272
  },
272
273
  "hasDynamicHelp": false,
273
274
  "hiddenAliases": [],
274
- "id": "containers:prune",
275
+ "id": "config:print",
275
276
  "pluginAlias": "@enspirit/emb",
276
277
  "pluginName": "@enspirit/emb",
277
278
  "pluginType": "core",
278
- "strict": true,
279
279
  "enableJsonFlag": true,
280
280
  "isESM": true,
281
281
  "relativePath": [
@@ -283,8 +283,8 @@
283
283
  "src",
284
284
  "cli",
285
285
  "commands",
286
- "containers",
287
- "prune.js"
286
+ "config",
287
+ "print.js"
288
288
  ]
289
289
  },
290
290
  "images:delete": {
@@ -344,6 +344,14 @@
344
344
  "allowNo": false,
345
345
  "type": "boolean"
346
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
+ },
347
355
  "all": {
348
356
  "char": "a",
349
357
  "description": "Show all images. Only images from a final layer (no children) are shown by default.",
@@ -359,7 +367,6 @@
359
367
  "pluginAlias": "@enspirit/emb",
360
368
  "pluginName": "@enspirit/emb",
361
369
  "pluginType": "core",
362
- "strict": true,
363
370
  "enableJsonFlag": true,
364
371
  "isESM": true,
365
372
  "relativePath": [
@@ -413,12 +420,18 @@
413
420
  "prune.js"
414
421
  ]
415
422
  },
416
- "tasks": {
423
+ "resources:build": {
417
424
  "aliases": [],
418
- "args": {},
419
- "description": "List tasks.",
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",
420
433
  "examples": [
421
- "<%= config.bin %> <%= command.id %>"
434
+ "<%= config.bin %> <%= command.id %> build --flavor development"
422
435
  ],
423
436
  "flags": {
424
437
  "json": {
@@ -427,15 +440,38 @@
427
440
  "name": "json",
428
441
  "allowNo": false,
429
442
  "type": "boolean"
443
+ },
444
+ "flavor": {
445
+ "description": "Specify the flavor to use.",
446
+ "name": "flavor",
447
+ "required": false,
448
+ "hasDynamicHelp": false,
449
+ "multiple": false,
450
+ "type": "option"
451
+ },
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",
463
+ "required": false,
464
+ "allowNo": false,
465
+ "type": "boolean"
430
466
  }
431
467
  },
432
468
  "hasDynamicHelp": false,
433
469
  "hiddenAliases": [],
434
- "id": "tasks",
470
+ "id": "resources:build",
435
471
  "pluginAlias": "@enspirit/emb",
436
472
  "pluginName": "@enspirit/emb",
437
473
  "pluginType": "core",
438
- "strict": true,
474
+ "strict": false,
439
475
  "enableJsonFlag": true,
440
476
  "isESM": true,
441
477
  "relativePath": [
@@ -443,20 +479,14 @@
443
479
  "src",
444
480
  "cli",
445
481
  "commands",
446
- "tasks",
447
- "index.js"
482
+ "resources",
483
+ "build.js"
448
484
  ]
449
485
  },
450
- "tasks:run": {
486
+ "resources": {
451
487
  "aliases": [],
452
- "args": {
453
- "task": {
454
- "description": "List of tasks to run. You can provide either ids or names (eg: component:task or task)",
455
- "name": "task",
456
- "required": true
457
- }
458
- },
459
- "description": "Run tasks.",
488
+ "args": {},
489
+ "description": "List resources.",
460
490
  "examples": [
461
491
  "<%= config.bin %> <%= command.id %>"
462
492
  ],
@@ -468,33 +498,21 @@
468
498
  "allowNo": false,
469
499
  "type": "boolean"
470
500
  },
471
- "executor": {
472
- "char": "x",
473
- "description": "Where to run the task. (experimental!)",
474
- "name": "executor",
501
+ "flavor": {
502
+ "description": "Specify the flavor to use.",
503
+ "name": "flavor",
504
+ "required": false,
475
505
  "hasDynamicHelp": false,
476
506
  "multiple": false,
477
- "options": [
478
- "container",
479
- "local"
480
- ],
481
507
  "type": "option"
482
- },
483
- "all-matching": {
484
- "char": "a",
485
- "description": "Run all tasks matching (when multiple matches)",
486
- "name": "all-matching",
487
- "allowNo": false,
488
- "type": "boolean"
489
508
  }
490
509
  },
491
510
  "hasDynamicHelp": false,
492
511
  "hiddenAliases": [],
493
- "id": "tasks:run",
512
+ "id": "resources",
494
513
  "pluginAlias": "@enspirit/emb",
495
514
  "pluginName": "@enspirit/emb",
496
515
  "pluginType": "core",
497
- "strict": false,
498
516
  "enableJsonFlag": true,
499
517
  "isESM": true,
500
518
  "relativePath": [
@@ -502,22 +520,16 @@
502
520
  "src",
503
521
  "cli",
504
522
  "commands",
505
- "tasks",
506
- "run.js"
523
+ "resources",
524
+ "index.js"
507
525
  ]
508
526
  },
509
- "resources:build": {
527
+ "tasks": {
510
528
  "aliases": [],
511
- "args": {
512
- "component": {
513
- "description": "List of resources to build (defaults to all)",
514
- "name": "component",
515
- "required": false
516
- }
517
- },
518
- "description": "Build the resources of the monorepo",
529
+ "args": {},
530
+ "description": "List tasks.",
519
531
  "examples": [
520
- "<%= config.bin %> <%= command.id %> build --flavor development"
532
+ "<%= config.bin %> <%= command.id %>"
521
533
  ],
522
534
  "flags": {
523
535
  "json": {
@@ -526,38 +538,15 @@
526
538
  "name": "json",
527
539
  "allowNo": false,
528
540
  "type": "boolean"
529
- },
530
- "flavor": {
531
- "description": "Specify the flavor to use.",
532
- "name": "flavor",
533
- "required": false,
534
- "hasDynamicHelp": false,
535
- "multiple": false,
536
- "type": "option"
537
- },
538
- "dry-run": {
539
- "description": "Do not build the resources but only produce build meta information",
540
- "name": "dry-run",
541
- "required": false,
542
- "allowNo": false,
543
- "type": "boolean"
544
- },
545
- "force": {
546
- "char": "f",
547
- "description": "Bypass the cache and force the build",
548
- "name": "force",
549
- "required": false,
550
- "allowNo": false,
551
- "type": "boolean"
552
541
  }
553
542
  },
554
543
  "hasDynamicHelp": false,
555
544
  "hiddenAliases": [],
556
- "id": "resources:build",
545
+ "id": "tasks",
557
546
  "pluginAlias": "@enspirit/emb",
558
547
  "pluginName": "@enspirit/emb",
559
548
  "pluginType": "core",
560
- "strict": false,
549
+ "strict": true,
561
550
  "enableJsonFlag": true,
562
551
  "isESM": true,
563
552
  "relativePath": [
@@ -565,14 +554,20 @@
565
554
  "src",
566
555
  "cli",
567
556
  "commands",
568
- "resources",
569
- "build.js"
557
+ "tasks",
558
+ "index.js"
570
559
  ]
571
560
  },
572
- "resources": {
561
+ "tasks:run": {
573
562
  "aliases": [],
574
- "args": {},
575
- "description": "List resources.",
563
+ "args": {
564
+ "task": {
565
+ "description": "List of tasks to run. You can provide either ids or names (eg: component:task or task)",
566
+ "name": "task",
567
+ "required": true
568
+ }
569
+ },
570
+ "description": "Run tasks.",
576
571
  "examples": [
577
572
  "<%= config.bin %> <%= command.id %>"
578
573
  ],
@@ -584,21 +579,33 @@
584
579
  "allowNo": false,
585
580
  "type": "boolean"
586
581
  },
587
- "flavor": {
588
- "description": "Specify the flavor to use.",
589
- "name": "flavor",
590
- "required": false,
582
+ "executor": {
583
+ "char": "x",
584
+ "description": "Where to run the task. (experimental!)",
585
+ "name": "executor",
591
586
  "hasDynamicHelp": false,
592
587
  "multiple": false,
588
+ "options": [
589
+ "container",
590
+ "local"
591
+ ],
593
592
  "type": "option"
593
+ },
594
+ "all-matching": {
595
+ "char": "a",
596
+ "description": "Run all tasks matching (when multiple matches)",
597
+ "name": "all-matching",
598
+ "allowNo": false,
599
+ "type": "boolean"
594
600
  }
595
601
  },
596
602
  "hasDynamicHelp": false,
597
603
  "hiddenAliases": [],
598
- "id": "resources",
604
+ "id": "tasks:run",
599
605
  "pluginAlias": "@enspirit/emb",
600
606
  "pluginName": "@enspirit/emb",
601
607
  "pluginType": "core",
608
+ "strict": false,
602
609
  "enableJsonFlag": true,
603
610
  "isESM": true,
604
611
  "relativePath": [
@@ -606,10 +613,10 @@
606
613
  "src",
607
614
  "cli",
608
615
  "commands",
609
- "resources",
610
- "index.js"
616
+ "tasks",
617
+ "run.js"
611
618
  ]
612
619
  }
613
620
  },
614
- "version": "0.1.0"
621
+ "version": "0.1.2"
615
622
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@enspirit/emb",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "keywords": ["monorepo", "docker", "taskrunner", "ci", "docker compose", "sentinel", "makefile"],
6
6
  "author": "Louis Lambeau <louis.lambeau@enspirit.be>",
7
7
  "license": "ISC",