@enspirit/emb 0.10.0 → 0.11.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.10.0 darwin-arm64 node-v22.14.0
17
+ @enspirit/emb/0.11.0 darwin-x64 node-v22.18.0
18
18
  $ emb --help [COMMAND]
19
19
  USAGE
20
20
  $ emb COMMAND
@@ -24,10 +24,10 @@ export default class ResourcesIndex extends FlavoredCommand {
24
24
  if (!flags.json) {
25
25
  printTable({
26
26
  ...TABLE_DEFAULTS,
27
- columns: ['name', 'type', 'reference', 'id'],
27
+ columns: ['id', 'name', 'type', 'reference'],
28
28
  data: resources,
29
29
  sort: {
30
- name: 'asc',
30
+ id: 'asc',
31
31
  },
32
32
  });
33
33
  }
@@ -42,7 +42,7 @@ export default class RunTask extends BaseCommand {
42
42
  if (error instanceof AmbiguousReferenceError) {
43
43
  throw error.toCliError([
44
44
  `Specify just one. Eg: \`emb tasks run ${error.matches[0]}\``,
45
- 'Run the same command with --all-matches / -a',
45
+ 'Run the same command with --all-matching / -a',
46
46
  'Review the list of tasks by running `emb tasks`',
47
47
  ]);
48
48
  }
@@ -51,6 +51,10 @@ export class DockerComposeClient {
51
51
  const { stdout } = await execa({
52
52
  cwd: this.monorepo.rootDir,
53
53
  }) `docker compose ps -a --format json`;
54
+ if (!stdout.trim()) {
55
+ this.services = services;
56
+ return;
57
+ }
54
58
  this.services = stdout
55
59
  .split('\n')
56
60
  .map((l) => JSON.parse(l))
@@ -1,6 +1,6 @@
1
1
  import deepmerge from '@fastify/deepmerge';
2
2
  import { glob } from 'glob';
3
- import { dirname } from 'node:path';
3
+ import { basename, dirname } from 'node:path';
4
4
  import { MonorepoConfig } from '../index.js';
5
5
  import { AbstractPlugin } from './plugin.js';
6
6
  export const AutoDockerPluginDefaultOptions = {
@@ -22,9 +22,11 @@ export class AutoDockerPlugin extends AbstractPlugin {
22
22
  cwd: this.monorepo.rootDir,
23
23
  });
24
24
  const overrides = files.reduce((cmps, path) => {
25
- const name = dirname(path);
25
+ const rootDir = dirname(path);
26
+ const name = basename(rootDir);
26
27
  const component = config.components[name];
27
28
  const cfg = {
29
+ rootDir,
28
30
  resources: {
29
31
  image: {
30
32
  type: 'docker/image',
@@ -24,6 +24,7 @@ export class EmbfileLoaderPlugin extends AbstractPlugin {
24
24
  const files = await glob(this.config.glob, {
25
25
  ...this.config,
26
26
  cwd: this.monorepo.rootDir,
27
+ follow: true,
27
28
  });
28
29
  const newConfig = await files.reduce(async (pConfig, path) => {
29
30
  const config = await pConfig;
@@ -2,10 +2,12 @@ import { Writable } from 'node:stream';
2
2
  import { CreateFileOperation, IResourceBuilder, ResourceInfo } from '../index.js';
3
3
  import { OpInput, OpOutput } from '../../operations/index.js';
4
4
  import { ResourceBuildContext } from './ResourceFactory.js';
5
- export declare class FileResourceBuilder implements IResourceBuilder<OpInput<CreateFileOperation>, OpOutput<CreateFileOperation>, void> {
5
+ export declare class FileResourceBuilder implements IResourceBuilder<OpInput<CreateFileOperation>, OpOutput<CreateFileOperation>, boolean> {
6
6
  protected context: ResourceBuildContext<OpInput<CreateFileOperation>>;
7
7
  constructor(context: ResourceBuildContext<OpInput<CreateFileOperation>>);
8
8
  getReference(): Promise<string>;
9
+ getPath(): Promise<string>;
10
+ mustBuild(): Promise<true | undefined>;
9
11
  build(resource: ResourceInfo<OpInput<CreateFileOperation>>, out?: Writable): Promise<{
10
12
  input: {
11
13
  path: string;
@@ -1,3 +1,4 @@
1
+ import { statfs } from 'node:fs/promises';
1
2
  import { CreateFileOperation, } from '../index.js';
2
3
  import { ResourceFactory } from './ResourceFactory.js';
3
4
  export class FileResourceBuilder {
@@ -8,9 +9,20 @@ export class FileResourceBuilder {
8
9
  async getReference() {
9
10
  return this.context.component.relative(this.context.config.params?.path || this.context.config.name);
10
11
  }
12
+ async getPath() {
13
+ return this.context.component.join(this.context.config.params?.path || this.context.config.name);
14
+ }
15
+ async mustBuild() {
16
+ try {
17
+ await statfs(await this.getPath());
18
+ }
19
+ catch {
20
+ return true;
21
+ }
22
+ }
11
23
  async build(resource, out) {
12
24
  const input = {
13
- path: await this.context.component.join(this.context.config.params?.path || this.context.config.name),
25
+ path: await this.getPath(),
14
26
  script: resource.params?.script,
15
27
  cwd: this.context.component.join('./'),
16
28
  };
@@ -998,5 +998,5 @@
998
998
  ]
999
999
  }
1000
1000
  },
1001
- "version": "0.10.0"
1001
+ "version": "0.11.0"
1002
1002
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@enspirit/emb",
3
3
  "type": "module",
4
- "version": "0.10.0",
4
+ "version": "0.11.0",
5
5
  "keywords": [
6
6
  "monorepo",
7
7
  "docker",