@enspirit/emb 0.8.4 → 0.10.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 +84 -32
- package/dist/src/cli/abstract/BaseCommand.d.ts +3 -0
- package/dist/src/cli/abstract/BaseCommand.js +11 -1
- package/dist/src/cli/abstract/FlavouredCommand.d.ts +1 -0
- package/dist/src/cli/abstract/FlavouredCommand.js +1 -0
- package/dist/src/cli/commands/start.d.ts +12 -0
- package/dist/src/cli/commands/start.js +30 -0
- package/dist/src/docker/compose/operations/ComposeRestartOperation.js +2 -2
- package/dist/src/docker/compose/operations/ComposeStartOperation.d.ts +13 -0
- package/dist/src/docker/compose/operations/ComposeStartOperation.js +42 -0
- package/dist/src/docker/compose/operations/ComposeUpOperation.js +2 -2
- 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/images/PushImagesOperation.js +1 -2
- package/dist/src/monorepo/monorepo.d.ts +5 -1
- package/dist/src/monorepo/monorepo.js +9 -0
- package/dist/src/monorepo/operations/resources/BuildResourcesOperation.js +2 -2
- package/dist/src/monorepo/operations/tasks/RunTasksOperation.js +2 -4
- package/dist/src/monorepo/taskManagerFactory.d.ts +6 -1
- package/dist/src/monorepo/taskManagerFactory.js +30 -16
- package/oclif.manifest.json +146 -1
- package/package.json +1 -1
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.10.0 darwin-arm64 node-v22.14.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)
|
|
@@ -87,10 +88,11 @@ Clean the project.
|
|
|
87
88
|
|
|
88
89
|
```
|
|
89
90
|
USAGE
|
|
90
|
-
$ emb clean [--json] [-f]
|
|
91
|
+
$ emb clean [--json] [--verbose] [-f]
|
|
91
92
|
|
|
92
93
|
FLAGS
|
|
93
|
-
-f, --force
|
|
94
|
+
-f, --force Force the deletion of containers & images
|
|
95
|
+
--[no-]verbose
|
|
94
96
|
|
|
95
97
|
GLOBAL FLAGS
|
|
96
98
|
--json Format output as json.
|
|
@@ -108,10 +110,11 @@ List components.
|
|
|
108
110
|
|
|
109
111
|
```
|
|
110
112
|
USAGE
|
|
111
|
-
$ emb components [--json] [--flavor <value>]
|
|
113
|
+
$ emb components [--json] [--verbose] [--flavor <value>]
|
|
112
114
|
|
|
113
115
|
FLAGS
|
|
114
116
|
--flavor=<value> Specify the flavor to use.
|
|
117
|
+
--[no-]verbose
|
|
115
118
|
|
|
116
119
|
GLOBAL FLAGS
|
|
117
120
|
--json Format output as json.
|
|
@@ -129,13 +132,14 @@ Get components logs.
|
|
|
129
132
|
|
|
130
133
|
```
|
|
131
134
|
USAGE
|
|
132
|
-
$ emb components logs COMPONENT [-f]
|
|
135
|
+
$ emb components logs COMPONENT [--verbose] [-f]
|
|
133
136
|
|
|
134
137
|
ARGUMENTS
|
|
135
138
|
COMPONENT The component you want to see the logs of
|
|
136
139
|
|
|
137
140
|
FLAGS
|
|
138
|
-
-f, --[no-]follow
|
|
141
|
+
-f, --[no-]follow Follow log output
|
|
142
|
+
--[no-]verbose
|
|
139
143
|
|
|
140
144
|
DESCRIPTION
|
|
141
145
|
Get components logs.
|
|
@@ -153,13 +157,14 @@ Get a shell on a running component.
|
|
|
153
157
|
|
|
154
158
|
```
|
|
155
159
|
USAGE
|
|
156
|
-
$ emb components shell COMPONENT [-s <value>]
|
|
160
|
+
$ emb components shell COMPONENT [--verbose] [-s <value>]
|
|
157
161
|
|
|
158
162
|
ARGUMENTS
|
|
159
163
|
COMPONENT The component you want to get a shell on
|
|
160
164
|
|
|
161
165
|
FLAGS
|
|
162
166
|
-s, --shell=<value> [default: bash] The shell to run
|
|
167
|
+
--[no-]verbose
|
|
163
168
|
|
|
164
169
|
DESCRIPTION
|
|
165
170
|
Get a shell on a running component.
|
|
@@ -177,10 +182,11 @@ Print the current config.
|
|
|
177
182
|
|
|
178
183
|
```
|
|
179
184
|
USAGE
|
|
180
|
-
$ emb config print [--json] [--flavor <value>]
|
|
185
|
+
$ emb config print [--json] [--verbose] [--flavor <value>]
|
|
181
186
|
|
|
182
187
|
FLAGS
|
|
183
188
|
--flavor=<value> Specify the flavor to use.
|
|
189
|
+
--[no-]verbose
|
|
184
190
|
|
|
185
191
|
GLOBAL FLAGS
|
|
186
192
|
--json Format output as json.
|
|
@@ -198,10 +204,11 @@ List docker containers.
|
|
|
198
204
|
|
|
199
205
|
```
|
|
200
206
|
USAGE
|
|
201
|
-
$ emb containers [--json] [-a]
|
|
207
|
+
$ emb containers [--json] [--verbose] [-a]
|
|
202
208
|
|
|
203
209
|
FLAGS
|
|
204
|
-
-a, --all
|
|
210
|
+
-a, --all Retun all containers. By default, only running containers are shown
|
|
211
|
+
--[no-]verbose
|
|
205
212
|
|
|
206
213
|
GLOBAL FLAGS
|
|
207
214
|
--json Format output as json.
|
|
@@ -222,7 +229,10 @@ Prune containers.
|
|
|
222
229
|
|
|
223
230
|
```
|
|
224
231
|
USAGE
|
|
225
|
-
$ emb containers prune [--json]
|
|
232
|
+
$ emb containers prune [--json] [--verbose]
|
|
233
|
+
|
|
234
|
+
FLAGS
|
|
235
|
+
--[no-]verbose
|
|
226
236
|
|
|
227
237
|
GLOBAL FLAGS
|
|
228
238
|
--json Format output as json.
|
|
@@ -240,10 +250,11 @@ Stop the whole project.
|
|
|
240
250
|
|
|
241
251
|
```
|
|
242
252
|
USAGE
|
|
243
|
-
$ emb down [--json] [--flavor <value>]
|
|
253
|
+
$ emb down [--json] [--verbose] [--flavor <value>]
|
|
244
254
|
|
|
245
255
|
FLAGS
|
|
246
256
|
--flavor=<value> Specify the flavor to use.
|
|
257
|
+
--[no-]verbose
|
|
247
258
|
|
|
248
259
|
GLOBAL FLAGS
|
|
249
260
|
--json Format output as json.
|
|
@@ -281,11 +292,12 @@ List docker images.
|
|
|
281
292
|
|
|
282
293
|
```
|
|
283
294
|
USAGE
|
|
284
|
-
$ emb images [--json] [--flavor <value>] [-a]
|
|
295
|
+
$ emb images [--json] [--verbose] [--flavor <value>] [-a]
|
|
285
296
|
|
|
286
297
|
FLAGS
|
|
287
298
|
-a, --all Show all images. Only images from a final layer (no children) are shown by default.
|
|
288
299
|
--flavor=<value> Specify the flavor to use.
|
|
300
|
+
--[no-]verbose
|
|
289
301
|
|
|
290
302
|
GLOBAL FLAGS
|
|
291
303
|
--json Format output as json.
|
|
@@ -303,10 +315,11 @@ Delete project images.
|
|
|
303
315
|
|
|
304
316
|
```
|
|
305
317
|
USAGE
|
|
306
|
-
$ emb images delete [--json] [-f]
|
|
318
|
+
$ emb images delete [--json] [--verbose] [-f]
|
|
307
319
|
|
|
308
320
|
FLAGS
|
|
309
|
-
-f, --force
|
|
321
|
+
-f, --force Remove the image even if it is being used by stopped containers or has other tags
|
|
322
|
+
--[no-]verbose
|
|
310
323
|
|
|
311
324
|
GLOBAL FLAGS
|
|
312
325
|
--json Format output as json.
|
|
@@ -324,10 +337,11 @@ Prune project images.
|
|
|
324
337
|
|
|
325
338
|
```
|
|
326
339
|
USAGE
|
|
327
|
-
$ emb images prune [--json] [-a]
|
|
340
|
+
$ emb images prune [--json] [--verbose] [-a]
|
|
328
341
|
|
|
329
342
|
FLAGS
|
|
330
|
-
-a, --all
|
|
343
|
+
-a, --all Prune all images. When set to true all images will be pruned, not only dangling ones
|
|
344
|
+
--[no-]verbose
|
|
331
345
|
|
|
332
346
|
GLOBAL FLAGS
|
|
333
347
|
--json Format output as json.
|
|
@@ -345,12 +359,13 @@ Push docker images.
|
|
|
345
359
|
|
|
346
360
|
```
|
|
347
361
|
USAGE
|
|
348
|
-
$ emb images push [--json] [--flavor <value>] [--registry <value>] [--retag <value>]
|
|
362
|
+
$ emb images push [--json] [--verbose] [--flavor <value>] [--registry <value>] [--retag <value>]
|
|
349
363
|
|
|
350
364
|
FLAGS
|
|
351
365
|
--flavor=<value> Specify the flavor to use.
|
|
352
366
|
--registry=<value> Override the registry to push to
|
|
353
367
|
--retag=<value> Override the original tag to push to a new tag
|
|
368
|
+
--[no-]verbose
|
|
354
369
|
|
|
355
370
|
GLOBAL FLAGS
|
|
356
371
|
--json Format output as json.
|
|
@@ -370,13 +385,14 @@ Get components logs.
|
|
|
370
385
|
|
|
371
386
|
```
|
|
372
387
|
USAGE
|
|
373
|
-
$ emb logs COMPONENT [-f]
|
|
388
|
+
$ emb logs COMPONENT [--verbose] [-f]
|
|
374
389
|
|
|
375
390
|
ARGUMENTS
|
|
376
391
|
COMPONENT The component you want to see the logs of
|
|
377
392
|
|
|
378
393
|
FLAGS
|
|
379
|
-
-f, --[no-]follow
|
|
394
|
+
-f, --[no-]follow Follow log output
|
|
395
|
+
--[no-]verbose
|
|
380
396
|
|
|
381
397
|
DESCRIPTION
|
|
382
398
|
Get components logs.
|
|
@@ -394,10 +410,11 @@ List docker containers.
|
|
|
394
410
|
|
|
395
411
|
```
|
|
396
412
|
USAGE
|
|
397
|
-
$ emb ps [--json] [-a]
|
|
413
|
+
$ emb ps [--json] [--verbose] [-a]
|
|
398
414
|
|
|
399
415
|
FLAGS
|
|
400
|
-
-a, --all
|
|
416
|
+
-a, --all Retun all containers. By default, only running containers are shown
|
|
417
|
+
--[no-]verbose
|
|
401
418
|
|
|
402
419
|
GLOBAL FLAGS
|
|
403
420
|
--json Format output as json.
|
|
@@ -418,10 +435,11 @@ List resources.
|
|
|
418
435
|
|
|
419
436
|
```
|
|
420
437
|
USAGE
|
|
421
|
-
$ emb resources [--json] [--flavor <value>]
|
|
438
|
+
$ emb resources [--json] [--verbose] [--flavor <value>]
|
|
422
439
|
|
|
423
440
|
FLAGS
|
|
424
441
|
--flavor=<value> Specify the flavor to use.
|
|
442
|
+
--[no-]verbose
|
|
425
443
|
|
|
426
444
|
GLOBAL FLAGS
|
|
427
445
|
--json Format output as json.
|
|
@@ -439,7 +457,7 @@ Build the resources of the monorepo
|
|
|
439
457
|
|
|
440
458
|
```
|
|
441
459
|
USAGE
|
|
442
|
-
$ emb resources build [COMPONENT...] [--json] [--flavor <value>] [--dry-run] [-f]
|
|
460
|
+
$ emb resources build [COMPONENT...] [--json] [--verbose] [--flavor <value>] [--dry-run] [-f]
|
|
443
461
|
|
|
444
462
|
ARGUMENTS
|
|
445
463
|
COMPONENT... List of resources to build (defaults to all)
|
|
@@ -448,6 +466,7 @@ FLAGS
|
|
|
448
466
|
-f, --force Bypass the cache and force the build
|
|
449
467
|
--dry-run Do not build the resources but only produce build meta information
|
|
450
468
|
--flavor=<value> Specify the flavor to use.
|
|
469
|
+
--[no-]verbose
|
|
451
470
|
|
|
452
471
|
GLOBAL FLAGS
|
|
453
472
|
--json Format output as json.
|
|
@@ -465,13 +484,14 @@ Restart the whole project.
|
|
|
465
484
|
|
|
466
485
|
```
|
|
467
486
|
USAGE
|
|
468
|
-
$ emb restart [COMPONENT...] [--json] [-f]
|
|
487
|
+
$ emb restart [COMPONENT...] [--json] [--verbose] [-f]
|
|
469
488
|
|
|
470
489
|
ARGUMENTS
|
|
471
490
|
COMPONENT... The component(s) to restart
|
|
472
491
|
|
|
473
492
|
FLAGS
|
|
474
|
-
-f, --no-deps
|
|
493
|
+
-f, --no-deps Don't restart depdendent components
|
|
494
|
+
--[no-]verbose
|
|
475
495
|
|
|
476
496
|
GLOBAL FLAGS
|
|
477
497
|
--json Format output as json.
|
|
@@ -489,7 +509,7 @@ Run tasks.
|
|
|
489
509
|
|
|
490
510
|
```
|
|
491
511
|
USAGE
|
|
492
|
-
$ emb run TASK... [--json] [-x container|local] [-a]
|
|
512
|
+
$ emb run TASK... [--json] [--verbose] [-x container|local] [-a]
|
|
493
513
|
|
|
494
514
|
ARGUMENTS
|
|
495
515
|
TASK... List of tasks to run. You can provide either ids or names (eg: component:task or task)
|
|
@@ -498,6 +518,7 @@ FLAGS
|
|
|
498
518
|
-a, --all-matching Run all tasks matching (when multiple matches)
|
|
499
519
|
-x, --executor=<option> Where to run the task. (experimental!)
|
|
500
520
|
<options: container|local>
|
|
521
|
+
--[no-]verbose
|
|
501
522
|
|
|
502
523
|
GLOBAL FLAGS
|
|
503
524
|
--json Format output as json.
|
|
@@ -518,13 +539,14 @@ Get a shell on a running component.
|
|
|
518
539
|
|
|
519
540
|
```
|
|
520
541
|
USAGE
|
|
521
|
-
$ emb shell COMPONENT [-s <value>]
|
|
542
|
+
$ emb shell COMPONENT [--verbose] [-s <value>]
|
|
522
543
|
|
|
523
544
|
ARGUMENTS
|
|
524
545
|
COMPONENT The component you want to get a shell on
|
|
525
546
|
|
|
526
547
|
FLAGS
|
|
527
548
|
-s, --shell=<value> [default: bash] The shell to run
|
|
549
|
+
--[no-]verbose
|
|
528
550
|
|
|
529
551
|
DESCRIPTION
|
|
530
552
|
Get a shell on a running component.
|
|
@@ -536,16 +558,41 @@ EXAMPLES
|
|
|
536
558
|
$ emb shell
|
|
537
559
|
```
|
|
538
560
|
|
|
561
|
+
## `emb start [COMPONENT]`
|
|
562
|
+
|
|
563
|
+
Starts the whole project.
|
|
564
|
+
|
|
565
|
+
```
|
|
566
|
+
USAGE
|
|
567
|
+
$ emb start [COMPONENT...] [--json] [--verbose]
|
|
568
|
+
|
|
569
|
+
ARGUMENTS
|
|
570
|
+
COMPONENT... The component(s) to start
|
|
571
|
+
|
|
572
|
+
FLAGS
|
|
573
|
+
--[no-]verbose
|
|
574
|
+
|
|
575
|
+
GLOBAL FLAGS
|
|
576
|
+
--json Format output as json.
|
|
577
|
+
|
|
578
|
+
DESCRIPTION
|
|
579
|
+
Starts the whole project.
|
|
580
|
+
|
|
581
|
+
EXAMPLES
|
|
582
|
+
$ emb start
|
|
583
|
+
```
|
|
584
|
+
|
|
539
585
|
## `emb stop`
|
|
540
586
|
|
|
541
587
|
Stop the whole project.
|
|
542
588
|
|
|
543
589
|
```
|
|
544
590
|
USAGE
|
|
545
|
-
$ emb stop [--json] [--flavor <value>]
|
|
591
|
+
$ emb stop [--json] [--verbose] [--flavor <value>]
|
|
546
592
|
|
|
547
593
|
FLAGS
|
|
548
594
|
--flavor=<value> Specify the flavor to use.
|
|
595
|
+
--[no-]verbose
|
|
549
596
|
|
|
550
597
|
GLOBAL FLAGS
|
|
551
598
|
--json Format output as json.
|
|
@@ -563,7 +610,10 @@ List tasks.
|
|
|
563
610
|
|
|
564
611
|
```
|
|
565
612
|
USAGE
|
|
566
|
-
$ emb tasks [--json]
|
|
613
|
+
$ emb tasks [--json] [--verbose]
|
|
614
|
+
|
|
615
|
+
FLAGS
|
|
616
|
+
--[no-]verbose
|
|
567
617
|
|
|
568
618
|
GLOBAL FLAGS
|
|
569
619
|
--json Format output as json.
|
|
@@ -581,7 +631,7 @@ Run tasks.
|
|
|
581
631
|
|
|
582
632
|
```
|
|
583
633
|
USAGE
|
|
584
|
-
$ emb tasks run TASK... [--json] [-x container|local] [-a]
|
|
634
|
+
$ emb tasks run TASK... [--json] [--verbose] [-x container|local] [-a]
|
|
585
635
|
|
|
586
636
|
ARGUMENTS
|
|
587
637
|
TASK... List of tasks to run. You can provide either ids or names (eg: component:task or task)
|
|
@@ -590,6 +640,7 @@ FLAGS
|
|
|
590
640
|
-a, --all-matching Run all tasks matching (when multiple matches)
|
|
591
641
|
-x, --executor=<option> Where to run the task. (experimental!)
|
|
592
642
|
<options: container|local>
|
|
643
|
+
--[no-]verbose
|
|
593
644
|
|
|
594
645
|
GLOBAL FLAGS
|
|
595
646
|
--json Format output as json.
|
|
@@ -610,7 +661,7 @@ Start the whole project.
|
|
|
610
661
|
|
|
611
662
|
```
|
|
612
663
|
USAGE
|
|
613
|
-
$ emb up [COMPONENT...] [--json] [--flavor <value>] [-f]
|
|
664
|
+
$ emb up [COMPONENT...] [--json] [--verbose] [--flavor <value>] [-f]
|
|
614
665
|
|
|
615
666
|
ARGUMENTS
|
|
616
667
|
COMPONENT... The component(s) to build and start
|
|
@@ -618,6 +669,7 @@ ARGUMENTS
|
|
|
618
669
|
FLAGS
|
|
619
670
|
-f, --force Bypass caches, force the recreation of containers, etc
|
|
620
671
|
--flavor=<value> Specify the flavor to use.
|
|
672
|
+
--[no-]verbose
|
|
621
673
|
|
|
622
674
|
GLOBAL FLAGS
|
|
623
675
|
--json Format output as json.
|
|
@@ -2,5 +2,8 @@ import { EmbContext } from '../../index.js';
|
|
|
2
2
|
import { Command } from '@oclif/core';
|
|
3
3
|
export declare abstract class BaseCommand extends Command {
|
|
4
4
|
protected context: EmbContext;
|
|
5
|
+
static baseFlags: {
|
|
6
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
5
8
|
init(): Promise<void>;
|
|
6
9
|
}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { DockerComposeClient, getContext, setContext } from '../../index.js';
|
|
2
|
-
import { Command } from '@oclif/core';
|
|
2
|
+
import { Command, Flags } from '@oclif/core';
|
|
3
3
|
import Dockerode from 'dockerode';
|
|
4
4
|
import { loadConfig } from '../../config/index.js';
|
|
5
5
|
import { Monorepo } from '../../monorepo/monorepo.js';
|
|
6
6
|
import { withMarker } from '../utils.js';
|
|
7
7
|
export class BaseCommand extends Command {
|
|
8
8
|
context;
|
|
9
|
+
static baseFlags = {
|
|
10
|
+
verbose: Flags.boolean({
|
|
11
|
+
name: 'verbose',
|
|
12
|
+
allowNo: true,
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
9
15
|
async init() {
|
|
16
|
+
const { flags } = await this.parse();
|
|
10
17
|
await super.init();
|
|
11
18
|
if (getContext()) {
|
|
12
19
|
return;
|
|
@@ -16,6 +23,9 @@ export class BaseCommand extends Command {
|
|
|
16
23
|
const monorepo = await withMarker('emb:monorepo', 'init', () => {
|
|
17
24
|
return new Monorepo(config, rootDir).init();
|
|
18
25
|
});
|
|
26
|
+
if (flags.verbose) {
|
|
27
|
+
monorepo.setTaskRenderer('verbose');
|
|
28
|
+
}
|
|
19
29
|
const compose = new DockerComposeClient(monorepo);
|
|
20
30
|
this.context = setContext({
|
|
21
31
|
docker: new Dockerode(),
|
|
@@ -5,6 +5,7 @@ export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
|
|
|
5
5
|
export declare abstract class FlavoredCommand<T extends typeof Command> extends BaseCommand {
|
|
6
6
|
static baseFlags: {
|
|
7
7
|
flavor: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
8
|
+
verbose: Interfaces.BooleanFlag<boolean>;
|
|
8
9
|
};
|
|
9
10
|
static enableJsonFlag: boolean;
|
|
10
11
|
protected args: Args<T>;
|
|
@@ -5,6 +5,7 @@ import { BaseCommand } from './BaseCommand.js';
|
|
|
5
5
|
export class FlavoredCommand extends BaseCommand {
|
|
6
6
|
// define flags that can be inherited by any command that extends FlavoredCommand
|
|
7
7
|
static baseFlags = {
|
|
8
|
+
...super.baseFlags,
|
|
8
9
|
flavor: Flags.string({
|
|
9
10
|
description: 'Specify the flavor to use.',
|
|
10
11
|
name: 'flavor',
|
|
@@ -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
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getContext } from '../../../index.js';
|
|
2
2
|
import * as z from 'zod';
|
|
3
|
-
import { ExecuteLocalCommandOperation
|
|
3
|
+
import { ExecuteLocalCommandOperation } from '../../../monorepo/index.js';
|
|
4
4
|
import { AbstractOperation } from '../../../operations/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* https://docs.docker.com/reference/cli/docker/compose/restart/
|
|
@@ -20,7 +20,7 @@ export class ComposeRestartOperation extends AbstractOperation {
|
|
|
20
20
|
}
|
|
21
21
|
async _run(input) {
|
|
22
22
|
const { monorepo } = getContext();
|
|
23
|
-
const manager =
|
|
23
|
+
const manager = monorepo.taskManager();
|
|
24
24
|
const command = ['docker', 'compose', 'restart'];
|
|
25
25
|
if (input?.services) {
|
|
26
26
|
command.push(...input.services);
|
|
@@ -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 } 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 = monorepo.taskManager();
|
|
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
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getContext } from '../../../index.js';
|
|
2
2
|
import * as z from 'zod';
|
|
3
|
-
import { ExecuteLocalCommandOperation
|
|
3
|
+
import { ExecuteLocalCommandOperation } from '../../../monorepo/index.js';
|
|
4
4
|
import { AbstractOperation } from '../../../operations/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* https://docs.docker.com/reference/cli/docker/compose/up/
|
|
@@ -23,7 +23,7 @@ export class ComposeUpOperation extends AbstractOperation {
|
|
|
23
23
|
}
|
|
24
24
|
async _run(input) {
|
|
25
25
|
const { monorepo } = getContext();
|
|
26
|
-
const manager =
|
|
26
|
+
const manager = monorepo.taskManager();
|
|
27
27
|
const command = ['docker', 'compose', 'up', '-d'];
|
|
28
28
|
if (input?.components) {
|
|
29
29
|
command.push(...input.components);
|
|
@@ -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';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { taskManagerFactory } from '../../../index.js';
|
|
2
1
|
import { join } from 'node:path/posix';
|
|
3
2
|
import { Transform } from 'node:stream';
|
|
4
3
|
import * as z from 'zod';
|
|
@@ -38,7 +37,7 @@ export class PushImagesOperation extends AbstractOperation {
|
|
|
38
37
|
});
|
|
39
38
|
return builder.getReference();
|
|
40
39
|
}));
|
|
41
|
-
const manager =
|
|
40
|
+
const manager = monorepo.taskManager();
|
|
42
41
|
const tasks = references.map((fullName) => {
|
|
43
42
|
return {
|
|
44
43
|
title: `Push ${fullName}`,
|