@enspirit/emb 0.8.3 → 0.9.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.8.3 darwin-x64 node-v22.18.0
17
+ @enspirit/emb/0.9.0 darwin-x64 node-v22.18.0
18
18
  $ emb --help [COMMAND]
19
19
  USAGE
20
20
  $ emb COMMAND
@@ -44,6 +44,7 @@ USAGE
44
44
  * [`emb restart [COMPONENT]`](#emb-restart-component)
45
45
  * [`emb run TASK`](#emb-run-task)
46
46
  * [`emb shell COMPONENT`](#emb-shell-component)
47
+ * [`emb start [COMPONENT]`](#emb-start-component)
47
48
  * [`emb stop`](#emb-stop)
48
49
  * [`emb tasks`](#emb-tasks)
49
50
  * [`emb tasks run TASK`](#emb-tasks-run-task)
@@ -536,6 +537,27 @@ EXAMPLES
536
537
  $ emb shell
537
538
  ```
538
539
 
540
+ ## `emb start [COMPONENT]`
541
+
542
+ Starts the whole project.
543
+
544
+ ```
545
+ USAGE
546
+ $ emb start [COMPONENT...] [--json]
547
+
548
+ ARGUMENTS
549
+ COMPONENT... The component(s) to start
550
+
551
+ GLOBAL FLAGS
552
+ --json Format output as json.
553
+
554
+ DESCRIPTION
555
+ Starts the whole project.
556
+
557
+ EXAMPLES
558
+ $ emb start
559
+ ```
560
+
539
561
  ## `emb stop`
540
562
 
541
563
  Stop the whole project.
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '../index.js';
2
+ export default class StartCommand extends BaseCommand {
3
+ static description: string;
4
+ static enableJsonFlag: boolean;
5
+ static examples: string[];
6
+ static flags: {};
7
+ static args: {
8
+ component: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
9
+ };
10
+ static strict: boolean;
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,30 @@
1
+ import { Args } from '@oclif/core';
2
+ import { BaseCommand, getContext } from '../index.js';
3
+ import { ComposeStartOperation } from '../../docker/index.js';
4
+ export default class StartCommand extends BaseCommand {
5
+ static description = 'Starts the whole project.';
6
+ static enableJsonFlag = true;
7
+ static examples = ['<%= config.bin %> <%= command.id %>'];
8
+ static flags = {};
9
+ static args = {
10
+ component: Args.string({
11
+ name: 'component',
12
+ description: 'The component(s) to start',
13
+ }),
14
+ };
15
+ static strict = false;
16
+ async run() {
17
+ const { argv } = await this.parse(StartCommand);
18
+ const { monorepo } = getContext();
19
+ let components;
20
+ if (argv.length > 0) {
21
+ components =
22
+ argv.length > 0
23
+ ? argv.map((name) => monorepo.component(name))
24
+ : monorepo.components;
25
+ }
26
+ await monorepo.run(new ComposeStartOperation(), {
27
+ services: components?.map((c) => c.name),
28
+ });
29
+ }
30
+ }
@@ -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/start/
5
+ */
6
+ declare const schema: z.ZodOptional<z.ZodObject<{
7
+ services: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ }, z.core.$strip>>;
9
+ export declare class ComposeStartOperation extends AbstractOperation<typeof schema, void> {
10
+ constructor();
11
+ protected _run(input: z.input<typeof schema>): Promise<void>;
12
+ }
13
+ export {};
@@ -0,0 +1,42 @@
1
+ import { getContext } from '../../../index.js';
2
+ import * as z from 'zod';
3
+ import { ExecuteLocalCommandOperation, taskManagerFactory } from '../../../monorepo/index.js';
4
+ import { AbstractOperation } from '../../../operations/index.js';
5
+ /**
6
+ * https://docs.docker.com/reference/cli/docker/compose/start/
7
+ */
8
+ const schema = z
9
+ .object({
10
+ services: z
11
+ .array(z.string())
12
+ .optional()
13
+ .describe('The list of service to start'),
14
+ })
15
+ .optional();
16
+ export class ComposeStartOperation extends AbstractOperation {
17
+ constructor() {
18
+ super(schema);
19
+ }
20
+ async _run(input) {
21
+ const { monorepo } = getContext();
22
+ const manager = taskManagerFactory();
23
+ const command = ['docker', 'compose', 'start'];
24
+ if (input?.services) {
25
+ command.push(...input.services);
26
+ }
27
+ manager.add([
28
+ {
29
+ async task(ctx, task) {
30
+ return monorepo.run(new ExecuteLocalCommandOperation(task.stdout()), {
31
+ script: command.join(' '),
32
+ workingDir: monorepo.rootDir,
33
+ });
34
+ },
35
+ title: input?.services
36
+ ? `Starting ${input.services.join(', ')}`
37
+ : 'Starting project',
38
+ },
39
+ ]);
40
+ await manager.runAll();
41
+ }
42
+ }
@@ -2,5 +2,6 @@ export * from './ComposeDownOperation.js';
2
2
  export * from './ComposeExecOperation.js';
3
3
  export * from './ComposeExecShellOperation.js';
4
4
  export * from './ComposeRestartOperation.js';
5
+ export * from './ComposeStartOperation.js';
5
6
  export * from './ComposeStopOperation.js';
6
7
  export * from './ComposeUpOperation.js';
@@ -2,5 +2,6 @@ export * from './ComposeDownOperation.js';
2
2
  export * from './ComposeExecOperation.js';
3
3
  export * from './ComposeExecShellOperation.js';
4
4
  export * from './ComposeRestartOperation.js';
5
+ export * from './ComposeStartOperation.js';
5
6
  export * from './ComposeStopOperation.js';
6
7
  export * from './ComposeUpOperation.js';
@@ -38,7 +38,6 @@ export class RunTasksOperation {
38
38
  ? ExecutorType.container
39
39
  : ExecutorType.local
40
40
  : ExecutorType.local);
41
- console.log(compose.isService(task.component), task.component);
42
41
  if (executor === ExecutorType.container &&
43
42
  (!task.component || !compose.isService(task.component))) {
44
43
  throw new Error('Cannot use the container executor with this task');
@@ -125,6 +125,44 @@
125
125
  "restart.js"
126
126
  ]
127
127
  },
128
+ "start": {
129
+ "aliases": [],
130
+ "args": {
131
+ "component": {
132
+ "description": "The component(s) to start",
133
+ "name": "component"
134
+ }
135
+ },
136
+ "description": "Starts the whole project.",
137
+ "examples": [
138
+ "<%= config.bin %> <%= command.id %>"
139
+ ],
140
+ "flags": {
141
+ "json": {
142
+ "description": "Format output as json.",
143
+ "helpGroup": "GLOBAL",
144
+ "name": "json",
145
+ "allowNo": false,
146
+ "type": "boolean"
147
+ }
148
+ },
149
+ "hasDynamicHelp": false,
150
+ "hiddenAliases": [],
151
+ "id": "start",
152
+ "pluginAlias": "@enspirit/emb",
153
+ "pluginName": "@enspirit/emb",
154
+ "pluginType": "core",
155
+ "strict": false,
156
+ "enableJsonFlag": true,
157
+ "isESM": true,
158
+ "relativePath": [
159
+ "dist",
160
+ "src",
161
+ "cli",
162
+ "commands",
163
+ "start.js"
164
+ ]
165
+ },
128
166
  "stop": {
129
167
  "aliases": [],
130
168
  "args": {},
@@ -653,18 +691,12 @@
653
691
  "push.js"
654
692
  ]
655
693
  },
656
- "resources:build": {
694
+ "tasks": {
657
695
  "aliases": [],
658
- "args": {
659
- "component": {
660
- "description": "List of resources to build (defaults to all)",
661
- "name": "component",
662
- "required": false
663
- }
664
- },
665
- "description": "Build the resources of the monorepo",
696
+ "args": {},
697
+ "description": "List tasks.",
666
698
  "examples": [
667
- "<%= config.bin %> <%= command.id %> build --flavor development"
699
+ "<%= config.bin %> <%= command.id %>"
668
700
  ],
669
701
  "flags": {
670
702
  "json": {
@@ -673,38 +705,15 @@
673
705
  "name": "json",
674
706
  "allowNo": false,
675
707
  "type": "boolean"
676
- },
677
- "flavor": {
678
- "description": "Specify the flavor to use.",
679
- "name": "flavor",
680
- "required": false,
681
- "hasDynamicHelp": false,
682
- "multiple": false,
683
- "type": "option"
684
- },
685
- "dry-run": {
686
- "description": "Do not build the resources but only produce build meta information",
687
- "name": "dry-run",
688
- "required": false,
689
- "allowNo": false,
690
- "type": "boolean"
691
- },
692
- "force": {
693
- "char": "f",
694
- "description": "Bypass the cache and force the build",
695
- "name": "force",
696
- "required": false,
697
- "allowNo": false,
698
- "type": "boolean"
699
708
  }
700
709
  },
701
710
  "hasDynamicHelp": false,
702
711
  "hiddenAliases": [],
703
- "id": "resources:build",
712
+ "id": "tasks",
704
713
  "pluginAlias": "@enspirit/emb",
705
714
  "pluginName": "@enspirit/emb",
706
715
  "pluginType": "core",
707
- "strict": false,
716
+ "strict": true,
708
717
  "enableJsonFlag": true,
709
718
  "isESM": true,
710
719
  "relativePath": [
@@ -712,14 +721,22 @@
712
721
  "src",
713
722
  "cli",
714
723
  "commands",
715
- "resources",
716
- "build.js"
724
+ "tasks",
725
+ "index.js"
717
726
  ]
718
727
  },
719
- "resources": {
720
- "aliases": [],
721
- "args": {},
722
- "description": "List resources.",
728
+ "tasks:run": {
729
+ "aliases": [
730
+ "run"
731
+ ],
732
+ "args": {
733
+ "task": {
734
+ "description": "List of tasks to run. You can provide either ids or names (eg: component:task or task)",
735
+ "name": "task",
736
+ "required": true
737
+ }
738
+ },
739
+ "description": "Run tasks.",
723
740
  "examples": [
724
741
  "<%= config.bin %> <%= command.id %>"
725
742
  ],
@@ -731,21 +748,33 @@
731
748
  "allowNo": false,
732
749
  "type": "boolean"
733
750
  },
734
- "flavor": {
735
- "description": "Specify the flavor to use.",
736
- "name": "flavor",
737
- "required": false,
751
+ "executor": {
752
+ "char": "x",
753
+ "description": "Where to run the task. (experimental!)",
754
+ "name": "executor",
738
755
  "hasDynamicHelp": false,
739
756
  "multiple": false,
757
+ "options": [
758
+ "container",
759
+ "local"
760
+ ],
740
761
  "type": "option"
762
+ },
763
+ "all-matching": {
764
+ "char": "a",
765
+ "description": "Run all tasks matching (when multiple matches)",
766
+ "name": "all-matching",
767
+ "allowNo": false,
768
+ "type": "boolean"
741
769
  }
742
770
  },
743
771
  "hasDynamicHelp": false,
744
772
  "hiddenAliases": [],
745
- "id": "resources",
773
+ "id": "tasks:run",
746
774
  "pluginAlias": "@enspirit/emb",
747
775
  "pluginName": "@enspirit/emb",
748
776
  "pluginType": "core",
777
+ "strict": false,
749
778
  "enableJsonFlag": true,
750
779
  "isESM": true,
751
780
  "relativePath": [
@@ -753,16 +782,22 @@
753
782
  "src",
754
783
  "cli",
755
784
  "commands",
756
- "resources",
757
- "index.js"
785
+ "tasks",
786
+ "run.js"
758
787
  ]
759
788
  },
760
- "tasks": {
789
+ "resources:build": {
761
790
  "aliases": [],
762
- "args": {},
763
- "description": "List tasks.",
791
+ "args": {
792
+ "component": {
793
+ "description": "List of resources to build (defaults to all)",
794
+ "name": "component",
795
+ "required": false
796
+ }
797
+ },
798
+ "description": "Build the resources of the monorepo",
764
799
  "examples": [
765
- "<%= config.bin %> <%= command.id %>"
800
+ "<%= config.bin %> <%= command.id %> build --flavor development"
766
801
  ],
767
802
  "flags": {
768
803
  "json": {
@@ -771,15 +806,38 @@
771
806
  "name": "json",
772
807
  "allowNo": false,
773
808
  "type": "boolean"
809
+ },
810
+ "flavor": {
811
+ "description": "Specify the flavor to use.",
812
+ "name": "flavor",
813
+ "required": false,
814
+ "hasDynamicHelp": false,
815
+ "multiple": false,
816
+ "type": "option"
817
+ },
818
+ "dry-run": {
819
+ "description": "Do not build the resources but only produce build meta information",
820
+ "name": "dry-run",
821
+ "required": false,
822
+ "allowNo": false,
823
+ "type": "boolean"
824
+ },
825
+ "force": {
826
+ "char": "f",
827
+ "description": "Bypass the cache and force the build",
828
+ "name": "force",
829
+ "required": false,
830
+ "allowNo": false,
831
+ "type": "boolean"
774
832
  }
775
833
  },
776
834
  "hasDynamicHelp": false,
777
835
  "hiddenAliases": [],
778
- "id": "tasks",
836
+ "id": "resources:build",
779
837
  "pluginAlias": "@enspirit/emb",
780
838
  "pluginName": "@enspirit/emb",
781
839
  "pluginType": "core",
782
- "strict": true,
840
+ "strict": false,
783
841
  "enableJsonFlag": true,
784
842
  "isESM": true,
785
843
  "relativePath": [
@@ -787,22 +845,14 @@
787
845
  "src",
788
846
  "cli",
789
847
  "commands",
790
- "tasks",
791
- "index.js"
848
+ "resources",
849
+ "build.js"
792
850
  ]
793
851
  },
794
- "tasks:run": {
795
- "aliases": [
796
- "run"
797
- ],
798
- "args": {
799
- "task": {
800
- "description": "List of tasks to run. You can provide either ids or names (eg: component:task or task)",
801
- "name": "task",
802
- "required": true
803
- }
804
- },
805
- "description": "Run tasks.",
852
+ "resources": {
853
+ "aliases": [],
854
+ "args": {},
855
+ "description": "List resources.",
806
856
  "examples": [
807
857
  "<%= config.bin %> <%= command.id %>"
808
858
  ],
@@ -814,33 +864,21 @@
814
864
  "allowNo": false,
815
865
  "type": "boolean"
816
866
  },
817
- "executor": {
818
- "char": "x",
819
- "description": "Where to run the task. (experimental!)",
820
- "name": "executor",
867
+ "flavor": {
868
+ "description": "Specify the flavor to use.",
869
+ "name": "flavor",
870
+ "required": false,
821
871
  "hasDynamicHelp": false,
822
872
  "multiple": false,
823
- "options": [
824
- "container",
825
- "local"
826
- ],
827
873
  "type": "option"
828
- },
829
- "all-matching": {
830
- "char": "a",
831
- "description": "Run all tasks matching (when multiple matches)",
832
- "name": "all-matching",
833
- "allowNo": false,
834
- "type": "boolean"
835
874
  }
836
875
  },
837
876
  "hasDynamicHelp": false,
838
877
  "hiddenAliases": [],
839
- "id": "tasks:run",
878
+ "id": "resources",
840
879
  "pluginAlias": "@enspirit/emb",
841
880
  "pluginName": "@enspirit/emb",
842
881
  "pluginType": "core",
843
- "strict": false,
844
882
  "enableJsonFlag": true,
845
883
  "isESM": true,
846
884
  "relativePath": [
@@ -848,10 +886,10 @@
848
886
  "src",
849
887
  "cli",
850
888
  "commands",
851
- "tasks",
852
- "run.js"
889
+ "resources",
890
+ "index.js"
853
891
  ]
854
892
  }
855
893
  },
856
- "version": "0.8.3"
894
+ "version": "0.9.0"
857
895
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@enspirit/emb",
3
3
  "type": "module",
4
- "version": "0.8.3",
4
+ "version": "0.9.0",
5
5
  "keywords": [
6
6
  "monorepo",
7
7
  "docker",