hereya-cli 0.20.0 → 0.22.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
@@ -1,7 +1,7 @@
1
1
  hereya-cli
2
2
  =================
3
3
 
4
- Use infrastructure components as simple software packages.
4
+ Manage infrastructure components as packages.
5
5
 
6
6
 
7
7
  [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
@@ -20,7 +20,7 @@ $ npm install -g hereya-cli
20
20
  $ hereya COMMAND
21
21
  running command...
22
22
  $ hereya (--version)
23
- hereya-cli/0.20.0 linux-x64 node-v22.13.1
23
+ hereya-cli/0.22.0 linux-x64 node-v22.13.1
24
24
  $ hereya --help [COMMAND]
25
25
  USAGE
26
26
  $ hereya COMMAND
@@ -59,12 +59,19 @@ USAGE
59
59
  $ hereya add PACKAGE [--chdir <value>] [--debug] [-p <value>...]
60
60
 
61
61
  ARGUMENTS
62
- PACKAGE The package to add. Packages are gitHub repositories. Use the format owner/repository
62
+ PACKAGE The package to add, specified as a GitHub repository in the format owner/repository.
63
+ To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to
64
+ $HEREYA_REGISTRY_URL/owner/repository.
65
+ For local packages, use the format local://path/to/package where path/to/package is the path to the package
66
+ on your local machine.
63
67
 
64
68
  FLAGS
65
69
  -p, --parameter=<value>... [default: ] parameter for the package, in the form of 'key=value'. Can be specified
66
70
  multiple times.
67
- --chdir=<value> directory to run command in
71
+ --chdir=<value> Directory where the command will be executed.
72
+ If not specified, it defaults to the current working directory.
73
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
74
+ environment variable.
68
75
  --debug enable debug mode
69
76
 
70
77
  DESCRIPTION
@@ -74,7 +81,7 @@ EXAMPLES
74
81
  $ hereya add cloudy/docker_postgres
75
82
  ```
76
83
 
77
- _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/add/index.ts)_
84
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/add/index.ts)_
78
85
 
79
86
  ## `hereya bootstrap INFRASTRUCTURETYPE`
80
87
 
@@ -99,7 +106,7 @@ EXAMPLES
99
106
  $ hereya bootstrap local
100
107
  ```
101
108
 
102
- _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/bootstrap/index.ts)_
109
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/bootstrap/index.ts)_
103
110
 
104
111
  ## `hereya deploy`
105
112
 
@@ -111,7 +118,10 @@ USAGE
111
118
 
112
119
  FLAGS
113
120
  -w, --workspace=<value> (required) name of the workspace to deploy the packages for
114
- --chdir=<value> directory to run command in
121
+ --chdir=<value> Directory where the command will be executed.
122
+ If not specified, it defaults to the current working directory.
123
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
124
+ environment variable.
115
125
  --debug enable debug mode
116
126
 
117
127
  DESCRIPTION
@@ -121,7 +131,7 @@ EXAMPLES
121
131
  $ hereya deploy
122
132
  ```
123
133
 
124
- _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/deploy/index.ts)_
134
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/deploy/index.ts)_
125
135
 
126
136
  ## `hereya down`
127
137
 
@@ -132,8 +142,11 @@ USAGE
132
142
  $ hereya down [--chdir <value>] [--debug] [--deploy] [-w <value>]
133
143
 
134
144
  FLAGS
135
- -w, --workspace=<value> name of the workspace to install the packages for
136
- --chdir=<value> directory to run command in
145
+ -w, --workspace=<value> name of the workspace to destroy the packages for
146
+ --chdir=<value> Directory where the command will be executed.
147
+ If not specified, it defaults to the current working directory.
148
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
149
+ environment variable.
137
150
  --debug enable debug mode
138
151
  --deploy destroy deployment companion packages
139
152
 
@@ -144,7 +157,7 @@ EXAMPLES
144
157
  $ hereya down
145
158
  ```
146
159
 
147
- _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/down/index.ts)_
160
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/down/index.ts)_
148
161
 
149
162
  ## `hereya env [NAME]`
150
163
 
@@ -175,7 +188,7 @@ EXAMPLES
175
188
  $ hereya env -w dev -l
176
189
  ```
177
190
 
178
- _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/env/index.ts)_
191
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/env/index.ts)_
179
192
 
180
193
  ## `hereya env set [NAME]`
181
194
 
@@ -202,7 +215,7 @@ EXAMPLES
202
215
  $ hereya env set FOO -v bar -w dev
203
216
  ```
204
217
 
205
- _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/env/set/index.ts)_
218
+ _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/env/set/index.ts)_
206
219
 
207
220
  ## `hereya help [COMMAND]`
208
221
 
@@ -248,7 +261,7 @@ EXAMPLES
248
261
  $ hereya init myProject -w=defaultWorkspace --chdir=./myProject
249
262
  ```
250
263
 
251
- _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/init/index.ts)_
264
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/init/index.ts)_
252
265
 
253
266
  ## `hereya remove PACKAGE`
254
267
 
@@ -259,10 +272,13 @@ USAGE
259
272
  $ hereya remove PACKAGE [--chdir <value>] [--debug]
260
273
 
261
274
  ARGUMENTS
262
- PACKAGE The package to remove. Packages are gitHub repositories. Use the format owner/repository
275
+ PACKAGE Remove a previously added package.
263
276
 
264
277
  FLAGS
265
- --chdir=<value> directory to run command in
278
+ --chdir=<value> Directory where the command will be executed.
279
+ If not specified, it defaults to the current working directory.
280
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment
281
+ variable.
266
282
  --debug enable debug mode
267
283
 
268
284
  DESCRIPTION
@@ -272,7 +288,7 @@ EXAMPLES
272
288
  $ hereya remove cloudy/docker_postgres
273
289
  ```
274
290
 
275
- _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/remove/index.ts)_
291
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/remove/index.ts)_
276
292
 
277
293
  ## `hereya run CMD`
278
294
 
@@ -298,7 +314,7 @@ EXAMPLES
298
314
  $ hereya run -w uat -- node index.js
299
315
  ```
300
316
 
301
- _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/run/index.ts)_
317
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/run/index.ts)_
302
318
 
303
319
  ## `hereya unbootstrap INFRASTRUCTURETYPE`
304
320
 
@@ -323,7 +339,7 @@ EXAMPLES
323
339
  $ hereya unbootstrap local
324
340
  ```
325
341
 
326
- _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/unbootstrap/index.ts)_
342
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/unbootstrap/index.ts)_
327
343
 
328
344
  ## `hereya undeploy`
329
345
 
@@ -335,7 +351,10 @@ USAGE
335
351
 
336
352
  FLAGS
337
353
  -w, --workspace=<value> (required) name of the workspace to undeploy the packages for
338
- --chdir=<value> directory to run command in
354
+ --chdir=<value> Directory where the command will be executed.
355
+ If not specified, it defaults to the current working directory.
356
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
357
+ environment variable.
339
358
  --debug enable debug mode
340
359
 
341
360
  DESCRIPTION
@@ -345,7 +364,7 @@ EXAMPLES
345
364
  $ hereya undeploy
346
365
  ```
347
366
 
348
- _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/undeploy/index.ts)_
367
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/undeploy/index.ts)_
349
368
 
350
369
  ## `hereya up`
351
370
 
@@ -357,7 +376,10 @@ USAGE
357
376
 
358
377
  FLAGS
359
378
  -w, --workspace=<value> name of the workspace to install the packages for
360
- --chdir=<value> directory to run command in
379
+ --chdir=<value> Directory where the command will be executed.
380
+ If not specified, it defaults to the current working directory.
381
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
382
+ environment variable.
361
383
  --debug enable debug mode
362
384
  --deploy provision deployment companion packages
363
385
 
@@ -368,7 +390,7 @@ EXAMPLES
368
390
  $ hereya up
369
391
  ```
370
392
 
371
- _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/up/index.ts)_
393
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/up/index.ts)_
372
394
 
373
395
  ## `hereya workspace create NAME`
374
396
 
@@ -388,7 +410,7 @@ EXAMPLES
388
410
  $ hereya workspace create dev
389
411
  ```
390
412
 
391
- _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/workspace/create/index.ts)_
413
+ _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/create/index.ts)_
392
414
 
393
415
  ## `hereya workspace delete NAME`
394
416
 
@@ -408,7 +430,7 @@ EXAMPLES
408
430
  $ hereya workspace delete dev
409
431
  ```
410
432
 
411
- _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/workspace/delete/index.ts)_
433
+ _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/delete/index.ts)_
412
434
 
413
435
  ## `hereya workspace env [NAME]`
414
436
 
@@ -434,7 +456,7 @@ EXAMPLES
434
456
  $ hereya workspace env myEnv -w dev
435
457
  ```
436
458
 
437
- _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/workspace/env/index.ts)_
459
+ _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/env/index.ts)_
438
460
 
439
461
  ## `hereya workspace env set`
440
462
 
@@ -458,7 +480,7 @@ EXAMPLES
458
480
  $ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
459
481
  ```
460
482
 
461
- _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/workspace/env/set/index.ts)_
483
+ _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/env/set/index.ts)_
462
484
 
463
485
  ## `hereya workspace env unset`
464
486
 
@@ -479,7 +501,7 @@ EXAMPLES
479
501
  $ hereya workspace env unset -w my-workspace -n myVar
480
502
  ```
481
503
 
482
- _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/workspace/env/unset/index.ts)_
504
+ _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/env/unset/index.ts)_
483
505
 
484
506
  ## `hereya workspace install PACKAGE`
485
507
 
@@ -506,7 +528,7 @@ EXAMPLES
506
528
  $ hereya workspace install hereya/aws-cognito
507
529
  ```
508
530
 
509
- _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/workspace/install/index.ts)_
531
+ _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/install/index.ts)_
510
532
 
511
533
  ## `hereya workspace uninstall PACKAGE`
512
534
 
@@ -533,5 +555,5 @@ EXAMPLES
533
555
  $ hereya workspace uninstall hereya/aws-cognito
534
556
  ```
535
557
 
536
- _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/workspace/uninstall/index.ts)_
558
+ _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.22.0/src/commands/workspace/uninstall/index.ts)_
537
559
  <!-- commandsstop -->
@@ -5,13 +5,18 @@ import { getExecutor } from '../../executor/index.js';
5
5
  import { getConfigManager } from '../../lib/config/index.js';
6
6
  import { logEnv } from '../../lib/env-utils.js';
7
7
  import { getEnvManager } from '../../lib/env/index.js';
8
+ import { getLogger, isDebug, setDebug } from '../../lib/log.js';
8
9
  import { arrayOfStringToObject } from '../../lib/object-utils.js';
9
10
  import { getParameterManager } from '../../lib/parameter/index.js';
10
- import { delay, setDebug } from '../../lib/shell.js';
11
+ import { delay } from '../../lib/shell.js';
11
12
  export default class Add extends Command {
12
13
  static args = {
13
14
  package: Args.string({
14
- description: 'The package to add. Packages are gitHub repositories. Use the format owner/repository',
15
+ description: `
16
+ The package to add, specified as a GitHub repository in the format owner/repository.
17
+ To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to $HEREYA_REGISTRY_URL/owner/repository.
18
+ For local packages, use the format local://path/to/package where path/to/package is the path to the package on your local machine.
19
+ `,
15
20
  required: true,
16
21
  }),
17
22
  };
@@ -19,7 +24,11 @@ export default class Add extends Command {
19
24
  static examples = ['<%= config.bin %> <%= command.id %> cloudy/docker_postgres'];
20
25
  static flags = {
21
26
  chdir: Flags.string({
22
- description: 'directory to run command in',
27
+ description: `
28
+ Directory where the command will be executed.
29
+ If not specified, it defaults to the current working directory.
30
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.
31
+ `,
23
32
  required: false,
24
33
  }),
25
34
  debug: Flags.boolean({
@@ -77,13 +86,17 @@ export default class Add extends Command {
77
86
  title: 'Resolving package parameters',
78
87
  },
79
88
  {
80
- async task(ctx) {
89
+ rendererOptions: {
90
+ persistentOutput: isDebug(),
91
+ },
92
+ async task(ctx, task) {
81
93
  const executor$ = getExecutor();
82
94
  if (!executor$.success) {
83
95
  throw new Error(executor$.reason);
84
96
  }
85
97
  const { executor } = executor$;
86
98
  const provisionOutput = await executor.provision({
99
+ logger: getLogger(task),
87
100
  package: ctx.package,
88
101
  parameters: ctx.parametersOutput.parameters,
89
102
  project: ctx.configOutput.config.project,
@@ -145,7 +158,7 @@ export default class Add extends Command {
145
158
  },
146
159
  title: 'Saving state',
147
160
  },
148
- ], { concurrent: false });
161
+ ], { concurrent: false, rendererOptions: { collapseSubtasks: !isDebug() } });
149
162
  },
150
163
  title: `Adding ${args.package}`,
151
164
  },
@@ -5,14 +5,19 @@ import { getBackend } from '../../backend/index.js';
5
5
  import { getExecutor } from '../../executor/index.js';
6
6
  import { getConfigManager } from '../../lib/config/index.js';
7
7
  import { getEnvManager } from '../../lib/env/index.js';
8
+ import { getLogger, isDebug, setDebug } from '../../lib/log.js';
8
9
  import { getParameterManager } from '../../lib/parameter/index.js';
9
- import { delay, setDebug } from '../../lib/shell.js';
10
+ import { delay } from '../../lib/shell.js';
10
11
  export default class Deploy extends Command {
11
12
  static description = 'Deploy a hereya project using the project deployment package';
12
13
  static examples = ['<%= config.bin %> <%= command.id %>'];
13
14
  static flags = {
14
15
  chdir: Flags.string({
15
- description: 'directory to run command in',
16
+ description: `
17
+ Directory where the command will be executed.
18
+ If not specified, it defaults to the current working directory.
19
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.
20
+ `,
16
21
  required: false,
17
22
  }),
18
23
  debug: Flags.boolean({
@@ -91,7 +96,10 @@ export default class Deploy extends Command {
91
96
  skip: (ctx) => ctx.removedDeployPackages.length === 0,
92
97
  task(ctx, task) {
93
98
  return task.newListr(ctx.removedDeployPackages.map((packageName) => ({
94
- async task() {
99
+ rendererOptions: {
100
+ persistentOutput: isDebug(),
101
+ },
102
+ async task(_, task) {
95
103
  const parameterManager = getParameterManager();
96
104
  const { parameters } = await parameterManager.getPackageParameters({
97
105
  package: packageName,
@@ -105,6 +113,7 @@ export default class Deploy extends Command {
105
113
  const { executor } = executor$;
106
114
  const destroyOutput = await executor.destroy({
107
115
  isDeploying: true,
116
+ logger: getLogger(task),
108
117
  package: packageName,
109
118
  parameters,
110
119
  project: ctx.configOutput.config.project,
@@ -117,7 +126,7 @@ export default class Deploy extends Command {
117
126
  }
118
127
  },
119
128
  title: `Destroying package ${packageName}`,
120
- })), { concurrent: true });
129
+ })), { concurrent: true, rendererOptions: { collapseSubtasks: !isDebug() } });
121
130
  },
122
131
  title: 'Destroying removed deployment packages',
123
132
  },
@@ -125,7 +134,10 @@ export default class Deploy extends Command {
125
134
  skip: (ctx) => ctx.removedPackages.length === 0,
126
135
  task(ctx, task) {
127
136
  return task.newListr(ctx.removedPackages.map((packageName) => ({
128
- async task() {
137
+ rendererOptions: {
138
+ persistentOutput: isDebug(),
139
+ },
140
+ async task(_, task) {
129
141
  const parameterManager = getParameterManager();
130
142
  const { parameters } = await parameterManager.getPackageParameters({
131
143
  package: packageName,
@@ -139,6 +151,7 @@ export default class Deploy extends Command {
139
151
  const { executor } = executor$;
140
152
  const destroyOutput = await executor.destroy({
141
153
  isDeploying: true,
154
+ logger: getLogger(task),
142
155
  package: packageName,
143
156
  parameters,
144
157
  project: ctx.configOutput.config.project,
@@ -154,7 +167,7 @@ export default class Deploy extends Command {
154
167
  ctx.removed = output;
155
168
  },
156
169
  title: `Destroying ${packageName}`,
157
- })), { concurrent: true });
170
+ })), { concurrent: true, rendererOptions: { collapseSubtasks: !isDebug() } });
158
171
  },
159
172
  title: 'Destroying removed packages',
160
173
  },
@@ -165,7 +178,10 @@ export default class Deploy extends Command {
165
178
  return;
166
179
  }
167
180
  return task.newListr(ctx.packages.map((packageName) => ({
168
- async task() {
181
+ rendererOptions: {
182
+ persistentOutput: isDebug(),
183
+ },
184
+ async task(_, task) {
169
185
  const parameterManager = getParameterManager();
170
186
  const { parameters } = await parameterManager.getPackageParameters({
171
187
  package: packageName,
@@ -179,6 +195,7 @@ export default class Deploy extends Command {
179
195
  const { executor } = executor$;
180
196
  const provisionOutput = await executor.provision({
181
197
  isDeploying: true,
198
+ logger: getLogger(task),
182
199
  package: packageName,
183
200
  parameters,
184
201
  project: ctx.configOutput.config.project,
@@ -194,7 +211,7 @@ export default class Deploy extends Command {
194
211
  ctx.added = output;
195
212
  },
196
213
  title: `Provisioning ${packageName}`,
197
- })), { concurrent: true });
214
+ })), { concurrent: true, rendererOptions: { collapseSubtasks: !isDebug() } });
198
215
  },
199
216
  title: `Provisioning packages`,
200
217
  },
@@ -262,7 +279,10 @@ export default class Deploy extends Command {
262
279
  }
263
280
  const { env: projectEnv } = getProjectEnvOutput;
264
281
  return task.newListr(ctx.deployPackages.map((packageName) => ({
265
- async task() {
282
+ rendererOptions: {
283
+ persistentOutput: isDebug(),
284
+ },
285
+ async task(_, task) {
266
286
  const parameterManager = getParameterManager();
267
287
  const { parameters } = await parameterManager.getPackageParameters({
268
288
  package: packageName,
@@ -276,6 +296,7 @@ export default class Deploy extends Command {
276
296
  const { executor } = executor$;
277
297
  const provisionOutput = await executor.provision({
278
298
  isDeploying: true,
299
+ logger: getLogger(task),
279
300
  package: packageName,
280
301
  parameters,
281
302
  project: ctx.configOutput.config.project,
@@ -291,7 +312,7 @@ export default class Deploy extends Command {
291
312
  .join('\n'));
292
313
  },
293
314
  title: `Provisioning package ${packageName}`,
294
- })), { concurrent: true });
315
+ })), { concurrent: true, rendererOptions: { collapseSubtasks: !isDebug() } });
295
316
  },
296
317
  title: 'Provisioning deployment packages',
297
318
  },
@@ -4,14 +4,19 @@ import { getBackend } from '../../backend/index.js';
4
4
  import { getExecutor } from '../../executor/index.js';
5
5
  import { getConfigManager } from '../../lib/config/index.js';
6
6
  import { getEnvManager } from '../../lib/env/index.js';
7
+ import { getLogger, isDebug, setDebug } from '../../lib/log.js';
7
8
  import { getParameterManager } from '../../lib/parameter/index.js';
8
- import { delay, setDebug } from '../../lib/shell.js';
9
+ import { delay } from '../../lib/shell.js';
9
10
  export default class Down extends Command {
10
11
  static description = 'Destroy all packages in the project.';
11
12
  static examples = ['<%= config.bin %> <%= command.id %>'];
12
13
  static flags = {
13
14
  chdir: Flags.string({
14
- description: 'directory to run command in',
15
+ description: `
16
+ Directory where the command will be executed.
17
+ If not specified, it defaults to the current working directory.
18
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.
19
+ `,
15
20
  required: false,
16
21
  }),
17
22
  debug: Flags.boolean({
@@ -24,7 +29,7 @@ export default class Down extends Command {
24
29
  }),
25
30
  workspace: Flags.string({
26
31
  char: 'w',
27
- description: 'name of the workspace to install the packages for',
32
+ description: 'name of the workspace to destroy the packages for',
28
33
  required: false,
29
34
  }),
30
35
  };
@@ -75,7 +80,10 @@ export default class Down extends Command {
75
80
  return;
76
81
  }
77
82
  return task.newListr(ctx.packages.map((packageName) => ({
78
- async task() {
83
+ rendererOptions: {
84
+ persistentOutput: isDebug(),
85
+ },
86
+ async task(_, task) {
79
87
  const parameterManager = getParameterManager();
80
88
  const { parameters } = await parameterManager.getPackageParameters({
81
89
  package: packageName,
@@ -89,6 +97,7 @@ export default class Down extends Command {
89
97
  const { executor } = executor$;
90
98
  const destroyOutput = await executor.destroy({
91
99
  isDeploying: flags.deploy,
100
+ logger: getLogger(task),
92
101
  package: packageName,
93
102
  parameters,
94
103
  project: ctx.configOutput.config.project,
@@ -104,7 +113,7 @@ export default class Down extends Command {
104
113
  ctx.destroyed = output;
105
114
  },
106
115
  title: `Destroying ${packageName}`,
107
- })), { concurrent: true });
116
+ })), { concurrent: true, rendererOptions: { collapseSubtasks: !isDebug() } });
108
117
  },
109
118
  title: `Destroying packages`,
110
119
  },
@@ -139,7 +148,7 @@ export default class Down extends Command {
139
148
  },
140
149
  title: 'Saving state',
141
150
  },
142
- ], { concurrent: false });
151
+ ], { concurrent: false, rendererOptions: { collapseSubtasks: !isDebug() } });
143
152
  },
144
153
  title: 'Shutting down the project',
145
154
  },
@@ -4,12 +4,13 @@ import { getBackend } from '../../backend/index.js';
4
4
  import { getExecutor } from '../../executor/index.js';
5
5
  import { getConfigManager } from '../../lib/config/index.js';
6
6
  import { getEnvManager } from '../../lib/env/index.js';
7
+ import { getLogger, isDebug, setDebug } from '../../lib/log.js';
7
8
  import { getParameterManager } from '../../lib/parameter/index.js';
8
- import { delay, setDebug } from '../../lib/shell.js';
9
+ import { delay } from '../../lib/shell.js';
9
10
  export default class Remove extends Command {
10
11
  static args = {
11
12
  package: Args.string({
12
- description: 'The package to remove. Packages are gitHub repositories. Use the format owner/repository',
13
+ description: `Remove a previously added package.`,
13
14
  required: true,
14
15
  }),
15
16
  };
@@ -17,7 +18,11 @@ export default class Remove extends Command {
17
18
  static examples = ['<%= config.bin %> <%= command.id %> cloudy/docker_postgres'];
18
19
  static flags = {
19
20
  chdir: Flags.string({
20
- description: 'directory to run command in',
21
+ description: `
22
+ Directory where the command will be executed.
23
+ If not specified, it defaults to the current working directory.
24
+ Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR environment variable.
25
+ `,
21
26
  required: false,
22
27
  }),
23
28
  debug: Flags.boolean({
@@ -69,13 +74,17 @@ export default class Remove extends Command {
69
74
  title: 'Resolving package parameters',
70
75
  },
71
76
  {
72
- async task(ctx) {
77
+ rendererOptions: {
78
+ persistentOutput: isDebug(),
79
+ },
80
+ async task(ctx, task) {
73
81
  const executor$ = getExecutor();
74
82
  if (!executor$.success) {
75
83
  throw new Error(executor$.reason);
76
84
  }
77
85
  const { executor } = executor$;
78
86
  const destroyOutput = await executor.destroy({
87
+ logger: getLogger(task),
79
88
  package: ctx.package,
80
89
  parameters: ctx.parametersOutput.parameters,
81
90
  project: ctx.configOutput.config.project,
@@ -129,7 +138,7 @@ export default class Remove extends Command {
129
138
  },
130
139
  title: `Removing ${args.package}`,
131
140
  },
132
- ]);
141
+ ], { concurrent: false, rendererOptions: { collapseSubtasks: !isDebug() } });
133
142
  try {
134
143
  await task.run();
135
144
  myLogger.log(ListrLogLevels.COMPLETED, 'Package removed successfully');