hereya-cli 0.18.0 → 0.20.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.
Files changed (62) hide show
  1. package/README.md +24 -24
  2. package/bin/dev.js +1 -1
  3. package/dist/backend/common.d.ts +4 -4
  4. package/dist/backend/local.js +10 -2
  5. package/dist/commands/add/index.d.ts +4 -4
  6. package/dist/commands/add/index.js +12 -21
  7. package/dist/commands/bootstrap/index.d.ts +2 -2
  8. package/dist/commands/deploy/index.d.ts +3 -3
  9. package/dist/commands/deploy/index.js +45 -36
  10. package/dist/commands/down/index.d.ts +4 -4
  11. package/dist/commands/down/index.js +10 -21
  12. package/dist/commands/env/index.d.ts +4 -4
  13. package/dist/commands/env/index.js +6 -2
  14. package/dist/commands/env/set/index.d.ts +4 -4
  15. package/dist/commands/init/index.d.ts +3 -3
  16. package/dist/commands/remove/index.d.ts +3 -3
  17. package/dist/commands/remove/index.js +9 -19
  18. package/dist/commands/run/index.d.ts +3 -3
  19. package/dist/commands/run/index.js +7 -3
  20. package/dist/commands/unbootstrap/index.d.ts +2 -2
  21. package/dist/commands/undeploy/index.d.ts +3 -3
  22. package/dist/commands/undeploy/index.js +21 -24
  23. package/dist/commands/up/index.d.ts +4 -4
  24. package/dist/commands/up/index.js +24 -32
  25. package/dist/commands/workspace/create/index.d.ts +1 -1
  26. package/dist/commands/workspace/delete/index.d.ts +1 -1
  27. package/dist/commands/workspace/env/index.d.ts +3 -3
  28. package/dist/commands/workspace/env/set/index.d.ts +5 -5
  29. package/dist/commands/workspace/env/unset/index.d.ts +2 -2
  30. package/dist/commands/workspace/install/index.d.ts +5 -5
  31. package/dist/commands/workspace/install/index.js +8 -3
  32. package/dist/commands/workspace/uninstall/index.d.ts +5 -5
  33. package/dist/commands/workspace/uninstall/index.js +8 -3
  34. package/dist/executor/index.d.ts +11 -0
  35. package/dist/executor/index.js +8 -0
  36. package/dist/executor/interface.d.ts +41 -0
  37. package/dist/executor/interface.js +1 -0
  38. package/dist/executor/local.d.ts +7 -0
  39. package/dist/executor/local.js +56 -0
  40. package/dist/iac/cdk.js +5 -5
  41. package/dist/iac/index.js +5 -5
  42. package/dist/iac/terraform.js +7 -7
  43. package/dist/infrastructure/aws.js +1 -1
  44. package/dist/infrastructure/common.d.ts +2 -2
  45. package/dist/infrastructure/index.d.ts +3 -3
  46. package/dist/infrastructure/index.js +6 -6
  47. package/dist/infrastructure/local.js +1 -1
  48. package/dist/lib/env/index.d.ts +4 -0
  49. package/dist/lib/env/index.js +11 -3
  50. package/dist/lib/env-utils.d.ts +0 -7
  51. package/dist/lib/env-utils.js +0 -18
  52. package/dist/lib/log.js +1 -1
  53. package/dist/lib/package/common.d.ts +1 -0
  54. package/dist/lib/package/index.d.ts +1 -0
  55. package/dist/lib/package/index.js +3 -3
  56. package/dist/lib/package/local.d.ts +1 -1
  57. package/dist/lib/package/local.js +17 -4
  58. package/dist/lib/shell.d.ts +17 -7
  59. package/dist/lib/shell.js +73 -14
  60. package/dist/lib/yaml-utils.js +1 -1
  61. package/oclif.manifest.json +72 -72
  62. package/package.json +37 -37
package/README.md CHANGED
@@ -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.18.0 linux-x64 node-v22.13.1
23
+ hereya-cli/0.20.0 linux-x64 node-v22.13.1
24
24
  $ hereya --help [COMMAND]
25
25
  USAGE
26
26
  $ hereya COMMAND
@@ -56,7 +56,7 @@ Add a package to the project.
56
56
 
57
57
  ```
58
58
  USAGE
59
- $ hereya add PACKAGE [--chdir <value>] [--debug] [-p <value>]
59
+ $ hereya add PACKAGE [--chdir <value>] [--debug] [-p <value>...]
60
60
 
61
61
  ARGUMENTS
62
62
  PACKAGE The package to add. Packages are gitHub repositories. Use the format owner/repository
@@ -74,7 +74,7 @@ EXAMPLES
74
74
  $ hereya add cloudy/docker_postgres
75
75
  ```
76
76
 
77
- _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/add/index.ts)_
77
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/add/index.ts)_
78
78
 
79
79
  ## `hereya bootstrap INFRASTRUCTURETYPE`
80
80
 
@@ -99,7 +99,7 @@ EXAMPLES
99
99
  $ hereya bootstrap local
100
100
  ```
101
101
 
102
- _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/bootstrap/index.ts)_
102
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/bootstrap/index.ts)_
103
103
 
104
104
  ## `hereya deploy`
105
105
 
@@ -121,7 +121,7 @@ EXAMPLES
121
121
  $ hereya deploy
122
122
  ```
123
123
 
124
- _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/deploy/index.ts)_
124
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/deploy/index.ts)_
125
125
 
126
126
  ## `hereya down`
127
127
 
@@ -144,7 +144,7 @@ EXAMPLES
144
144
  $ hereya down
145
145
  ```
146
146
 
147
- _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/down/index.ts)_
147
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/down/index.ts)_
148
148
 
149
149
  ## `hereya env [NAME]`
150
150
 
@@ -175,7 +175,7 @@ EXAMPLES
175
175
  $ hereya env -w dev -l
176
176
  ```
177
177
 
178
- _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/env/index.ts)_
178
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/env/index.ts)_
179
179
 
180
180
  ## `hereya env set [NAME]`
181
181
 
@@ -202,7 +202,7 @@ EXAMPLES
202
202
  $ hereya env set FOO -v bar -w dev
203
203
  ```
204
204
 
205
- _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/env/set/index.ts)_
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)_
206
206
 
207
207
  ## `hereya help [COMMAND]`
208
208
 
@@ -222,7 +222,7 @@ DESCRIPTION
222
222
  Display help for hereya.
223
223
  ```
224
224
 
225
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.1.0/src/commands/help.ts)_
225
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.25/src/commands/help.ts)_
226
226
 
227
227
  ## `hereya init PROJECT`
228
228
 
@@ -248,7 +248,7 @@ EXAMPLES
248
248
  $ hereya init myProject -w=defaultWorkspace --chdir=./myProject
249
249
  ```
250
250
 
251
- _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/init/index.ts)_
251
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/init/index.ts)_
252
252
 
253
253
  ## `hereya remove PACKAGE`
254
254
 
@@ -272,7 +272,7 @@ EXAMPLES
272
272
  $ hereya remove cloudy/docker_postgres
273
273
  ```
274
274
 
275
- _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/remove/index.ts)_
275
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/remove/index.ts)_
276
276
 
277
277
  ## `hereya run CMD`
278
278
 
@@ -298,7 +298,7 @@ EXAMPLES
298
298
  $ hereya run -w uat -- node index.js
299
299
  ```
300
300
 
301
- _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/run/index.ts)_
301
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/run/index.ts)_
302
302
 
303
303
  ## `hereya unbootstrap INFRASTRUCTURETYPE`
304
304
 
@@ -323,7 +323,7 @@ EXAMPLES
323
323
  $ hereya unbootstrap local
324
324
  ```
325
325
 
326
- _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/unbootstrap/index.ts)_
326
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/unbootstrap/index.ts)_
327
327
 
328
328
  ## `hereya undeploy`
329
329
 
@@ -345,7 +345,7 @@ EXAMPLES
345
345
  $ hereya undeploy
346
346
  ```
347
347
 
348
- _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/undeploy/index.ts)_
348
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/undeploy/index.ts)_
349
349
 
350
350
  ## `hereya up`
351
351
 
@@ -368,7 +368,7 @@ EXAMPLES
368
368
  $ hereya up
369
369
  ```
370
370
 
371
- _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/up/index.ts)_
371
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.20.0/src/commands/up/index.ts)_
372
372
 
373
373
  ## `hereya workspace create NAME`
374
374
 
@@ -388,7 +388,7 @@ EXAMPLES
388
388
  $ hereya workspace create dev
389
389
  ```
390
390
 
391
- _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/workspace/create/index.ts)_
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)_
392
392
 
393
393
  ## `hereya workspace delete NAME`
394
394
 
@@ -408,7 +408,7 @@ EXAMPLES
408
408
  $ hereya workspace delete dev
409
409
  ```
410
410
 
411
- _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/workspace/delete/index.ts)_
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)_
412
412
 
413
413
  ## `hereya workspace env [NAME]`
414
414
 
@@ -434,7 +434,7 @@ EXAMPLES
434
434
  $ hereya workspace env myEnv -w dev
435
435
  ```
436
436
 
437
- _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/workspace/env/index.ts)_
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)_
438
438
 
439
439
  ## `hereya workspace env set`
440
440
 
@@ -458,7 +458,7 @@ EXAMPLES
458
458
  $ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
459
459
  ```
460
460
 
461
- _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/workspace/env/set/index.ts)_
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)_
462
462
 
463
463
  ## `hereya workspace env unset`
464
464
 
@@ -479,7 +479,7 @@ EXAMPLES
479
479
  $ hereya workspace env unset -w my-workspace -n myVar
480
480
  ```
481
481
 
482
- _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/workspace/env/unset/index.ts)_
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)_
483
483
 
484
484
  ## `hereya workspace install PACKAGE`
485
485
 
@@ -487,7 +487,7 @@ Add a package to the workspace.
487
487
 
488
488
  ```
489
489
  USAGE
490
- $ hereya workspace install PACKAGE -w <value> [--debug] [-p <value>] [-f <value>]
490
+ $ hereya workspace install PACKAGE -w <value> [--debug] [-p <value>...] [-f <value>]
491
491
 
492
492
  ARGUMENTS
493
493
  PACKAGE The package to add. Packages are gitHub repositories. Use the format owner/repository
@@ -506,7 +506,7 @@ EXAMPLES
506
506
  $ hereya workspace install hereya/aws-cognito
507
507
  ```
508
508
 
509
- _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/workspace/install/index.ts)_
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)_
510
510
 
511
511
  ## `hereya workspace uninstall PACKAGE`
512
512
 
@@ -514,7 +514,7 @@ Remove a package from a workspace.
514
514
 
515
515
  ```
516
516
  USAGE
517
- $ hereya workspace uninstall PACKAGE -w <value> [--debug] [-p <value>] [-f <value>]
517
+ $ hereya workspace uninstall PACKAGE -w <value> [--debug] [-p <value>...] [-f <value>]
518
518
 
519
519
  ARGUMENTS
520
520
  PACKAGE The package to remove. Packages are gitHub repositories. Use the format owner/repository
@@ -533,5 +533,5 @@ EXAMPLES
533
533
  $ hereya workspace uninstall hereya/aws-cognito
534
534
  ```
535
535
 
536
- _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.18.0/src/commands/workspace/uninstall/index.ts)_
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)_
537
537
  <!-- commandsstop -->
package/bin/dev.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
2
2
 
3
- // eslint-disable-next-line n/shebang
3
+
4
4
  import {execute} from '@oclif/core'
5
5
 
6
6
  await execute({development: true, dir: import.meta.url})
@@ -86,6 +86,10 @@ export type GetWorkspaceEnvOutput = {
86
86
  export type GetWorkspaceOutput = {
87
87
  found: false;
88
88
  } | ({
89
+ error: string;
90
+ found: true;
91
+ hasError: true;
92
+ } | {
89
93
  found: true;
90
94
  hasError: false;
91
95
  workspace: {
@@ -103,10 +107,6 @@ export type GetWorkspaceOutput = {
103
107
  };
104
108
  };
105
109
  };
106
- } | {
107
- error: string;
108
- found: true;
109
- hasError: true;
110
110
  });
111
111
  export type GetStateInput = {
112
112
  project: string;
@@ -2,8 +2,8 @@ import fs from 'node:fs/promises';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { z } from 'zod';
5
+ import { getExecutor } from '../executor/index.js';
5
6
  import { getInfrastructure } from '../infrastructure/index.js';
6
- import { resolveEnvValues } from '../lib/env-utils.js';
7
7
  import { getAnyPath } from '../lib/filesystem.js';
8
8
  import { load, save } from '../lib/yaml-utils.js';
9
9
  const WorkspaceSchema = z.object({
@@ -181,8 +181,16 @@ export class LocalBackend {
181
181
  success: false,
182
182
  };
183
183
  }
184
+ const executor$ = getExecutor();
185
+ if (!executor$.success) {
186
+ return {
187
+ reason: executor$.reason,
188
+ success: false,
189
+ };
190
+ }
191
+ const { executor } = executor$;
184
192
  return {
185
- env: await resolveEnvValues(workspace$.workspace.env ?? {}),
193
+ env: await executor.resolveEnvValues({ env: workspace$.workspace.env ?? {} }),
186
194
  success: true,
187
195
  };
188
196
  }
@@ -1,14 +1,14 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class Add extends Command {
3
3
  static args: {
4
- package: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
4
+ package: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- chdir: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
- debug: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
11
- parameter: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string[], import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
+ chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ parameter: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
12
12
  };
13
13
  run(): Promise<void>;
14
14
  }
@@ -1,10 +1,10 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
- import { Listr, ListrLogLevels, ListrLogger } from 'listr2';
2
+ import { Listr, ListrLogger, ListrLogLevels } from 'listr2';
3
3
  import { getBackend } from '../../backend/index.js';
4
- import { provisionPackage } from '../../infrastructure/index.js';
4
+ import { getExecutor } from '../../executor/index.js';
5
5
  import { getConfigManager } from '../../lib/config/index.js';
6
- import { getEnvManager } from '../../lib/env/index.js';
7
6
  import { logEnv } from '../../lib/env-utils.js';
7
+ import { getEnvManager } from '../../lib/env/index.js';
8
8
  import { arrayOfStringToObject } from '../../lib/object-utils.js';
9
9
  import { getParameterManager } from '../../lib/parameter/index.js';
10
10
  import { delay, setDebug } from '../../lib/shell.js';
@@ -49,32 +49,18 @@ export default class Add extends Command {
49
49
  },
50
50
  },
51
51
  {
52
- async task(ctx) {
52
+ async task(ctx, task) {
53
53
  const configManager = getConfigManager();
54
54
  const loadConfigOutput = await configManager.loadConfig({ projectRootDir });
55
55
  if (!loadConfigOutput.found) {
56
56
  throw new Error("Project not initialized. Run 'hereya init' first.");
57
57
  }
58
58
  ctx.configOutput = loadConfigOutput;
59
+ task.output = `Loaded project config`;
59
60
  await delay(500);
60
61
  },
61
62
  title: 'Loading project config',
62
63
  },
63
- {
64
- async task(ctx) {
65
- const backend = await getBackend();
66
- const getWorkspaceEnvOutput = await backend.getWorkspaceEnv({
67
- project: ctx.configOutput.config.project,
68
- workspace: ctx.configOutput.config.workspace,
69
- });
70
- if (!getWorkspaceEnvOutput.success) {
71
- throw new Error(getWorkspaceEnvOutput.reason);
72
- }
73
- ctx.workspaceEnvOutput = getWorkspaceEnvOutput;
74
- await delay(500);
75
- },
76
- title: 'Loading Workspace environment variables',
77
- },
78
64
  {
79
65
  async task(ctx) {
80
66
  const userSpecifiedParameters = arrayOfStringToObject(ctx.userSpecifiedParameters);
@@ -92,11 +78,16 @@ export default class Add extends Command {
92
78
  },
93
79
  {
94
80
  async task(ctx) {
95
- const provisionOutput = await provisionPackage({
96
- env: ctx.workspaceEnvOutput.env,
81
+ const executor$ = getExecutor();
82
+ if (!executor$.success) {
83
+ throw new Error(executor$.reason);
84
+ }
85
+ const { executor } = executor$;
86
+ const provisionOutput = await executor.provision({
97
87
  package: ctx.package,
98
88
  parameters: ctx.parametersOutput.parameters,
99
89
  project: ctx.configOutput.config.project,
90
+ projectRootDir,
100
91
  skipDeploy: true,
101
92
  workspace: ctx.configOutput.config.workspace,
102
93
  });
@@ -1,12 +1,12 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class Bootstrap extends Command {
3
3
  static args: {
4
- infrastructureType: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
4
+ infrastructureType: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
9
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
10
  };
11
11
  run(): Promise<void>;
12
12
  }
@@ -3,9 +3,9 @@ export default class Deploy extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
6
- chdir: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
7
- debug: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
8
- workspace: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
6
+ chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ workspace: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
9
  };
10
10
  run(): Promise<void>;
11
11
  }
@@ -1,8 +1,8 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { Listr, ListrLogLevels, ListrLogger } from 'listr2';
2
+ import { Listr, ListrLogger, ListrLogLevels } from 'listr2';
3
3
  import path from 'node:path';
4
4
  import { getBackend } from '../../backend/index.js';
5
- import { destroyPackage, provisionPackage } from '../../infrastructure/index.js';
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
8
  import { getParameterManager } from '../../lib/parameter/index.js';
@@ -41,34 +41,23 @@ export default class Deploy extends Command {
41
41
  ctx.configOutput = loadConfigOutput;
42
42
  ctx.deployPackages = Object.keys(loadConfigOutput.config.deploy ?? {});
43
43
  ctx.packages = Object.keys(loadConfigOutput.config.packages ?? {});
44
- await delay(500);
45
- },
46
- title: 'Loading project config',
47
- },
48
- {
49
- async task(ctx) {
50
- const backend = await getBackend();
51
- const getWorkspaceEnvOutput = await backend.getWorkspaceEnv({
52
- project: ctx.configOutput.config.project,
53
- workspace: flags.workspace,
54
- });
55
- if (!getWorkspaceEnvOutput.success) {
56
- throw new Error(getWorkspaceEnvOutput.reason);
57
- }
58
- ctx.workspaceEnv = getWorkspaceEnvOutput.env;
59
44
  ctx.workspace = flags.workspace;
60
45
  await delay(500);
61
46
  },
62
- title: 'Loading workspace environment variables',
47
+ title: 'Loading project config',
63
48
  },
64
49
  {
65
50
  async task(ctx) {
66
51
  const envManager = getEnvManager();
67
- const { env: projectEnv } = await envManager.getProjectEnv({
52
+ const getProjectEnvOutput = await envManager.getProjectEnv({
68
53
  markSecret: true,
69
54
  projectRootDir,
70
55
  workspace: ctx.workspace,
71
56
  });
57
+ if (!getProjectEnvOutput.success) {
58
+ throw new Error(getProjectEnvOutput.reason);
59
+ }
60
+ const { env: projectEnv } = getProjectEnvOutput;
72
61
  ctx.projectEnv = projectEnv;
73
62
  await delay(500);
74
63
  },
@@ -109,8 +98,12 @@ export default class Deploy extends Command {
109
98
  projectRootDir,
110
99
  workspace: ctx.workspace,
111
100
  });
112
- const destroyOutput = await destroyPackage({
113
- env: ctx.workspaceEnv,
101
+ const executor$ = getExecutor();
102
+ if (!executor$.success) {
103
+ throw new Error(executor$.reason);
104
+ }
105
+ const { executor } = executor$;
106
+ const destroyOutput = await executor.destroy({
114
107
  isDeploying: true,
115
108
  package: packageName,
116
109
  parameters,
@@ -139,12 +132,17 @@ export default class Deploy extends Command {
139
132
  projectRootDir,
140
133
  workspace: ctx.workspace,
141
134
  });
142
- const destroyOutput = await destroyPackage({
143
- env: ctx.workspaceEnv,
135
+ const executor$ = getExecutor();
136
+ if (!executor$.success) {
137
+ throw new Error(executor$.reason);
138
+ }
139
+ const { executor } = executor$;
140
+ const destroyOutput = await executor.destroy({
144
141
  isDeploying: true,
145
142
  package: packageName,
146
143
  parameters,
147
144
  project: ctx.configOutput.config.project,
145
+ projectRootDir,
148
146
  workspace: ctx.workspace,
149
147
  });
150
148
  if (!destroyOutput.success) {
@@ -174,12 +172,17 @@ export default class Deploy extends Command {
174
172
  projectRootDir,
175
173
  workspace: ctx.workspace,
176
174
  });
177
- const provisionOutput = await provisionPackage({
178
- env: ctx.workspaceEnv,
175
+ const executor$ = getExecutor();
176
+ if (!executor$.success) {
177
+ throw new Error(executor$.reason);
178
+ }
179
+ const { executor } = executor$;
180
+ const provisionOutput = await executor.provision({
179
181
  isDeploying: true,
180
182
  package: packageName,
181
183
  parameters,
182
184
  project: ctx.configOutput.config.project,
185
+ projectRootDir,
183
186
  workspace: ctx.workspace,
184
187
  });
185
188
  if (!provisionOutput.success) {
@@ -204,14 +207,12 @@ export default class Deploy extends Command {
204
207
  const envManager = getEnvManager();
205
208
  for (const { env, metadata } of ctx.removed) {
206
209
  // eslint-disable-next-line no-await-in-loop
207
- await Promise.all([
208
- envManager.removeProjectEnv({
209
- env,
210
- infra: metadata.originalInfra ?? metadata.infra,
211
- projectRootDir,
212
- workspace: ctx.workspace,
213
- }),
214
- ]);
210
+ await envManager.removeProjectEnv({
211
+ env,
212
+ infra: metadata.originalInfra ?? metadata.infra,
213
+ projectRootDir,
214
+ workspace: ctx.workspace,
215
+ });
215
216
  }
216
217
  await delay(500);
217
218
  },
@@ -251,11 +252,15 @@ export default class Deploy extends Command {
251
252
  skip: (ctx) => ctx.deployPackages.length === 0,
252
253
  async task(ctx, task) {
253
254
  const envManager = getEnvManager();
254
- const { env: projectEnv } = await envManager.getProjectEnv({
255
+ const getProjectEnvOutput = await envManager.getProjectEnv({
255
256
  markSecret: true,
256
257
  projectRootDir,
257
258
  workspace: ctx.workspace,
258
259
  });
260
+ if (!getProjectEnvOutput.success) {
261
+ throw new Error(getProjectEnvOutput.reason);
262
+ }
263
+ const { env: projectEnv } = getProjectEnvOutput;
259
264
  return task.newListr(ctx.deployPackages.map((packageName) => ({
260
265
  async task() {
261
266
  const parameterManager = getParameterManager();
@@ -264,8 +269,12 @@ export default class Deploy extends Command {
264
269
  projectRootDir,
265
270
  workspace: ctx.workspace,
266
271
  });
267
- const provisionOutput = await provisionPackage({
268
- env: ctx.workspaceEnv,
272
+ const executor$ = getExecutor();
273
+ if (!executor$.success) {
274
+ throw new Error(executor$.reason);
275
+ }
276
+ const { executor } = executor$;
277
+ const provisionOutput = await executor.provision({
269
278
  isDeploying: true,
270
279
  package: packageName,
271
280
  parameters,
@@ -3,10 +3,10 @@ export default class Down extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static flags: {
6
- chdir: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
7
- debug: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
8
- deploy: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
9
- workspace: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
6
+ chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ deploy: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
10
  };
11
11
  run(): Promise<void>;
12
12
  }
@@ -1,7 +1,7 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { Listr, ListrLogLevels, ListrLogger } from 'listr2';
2
+ import { Listr, ListrLogger, ListrLogLevels } from 'listr2';
3
3
  import { getBackend } from '../../backend/index.js';
4
- import { destroyPackage } from '../../infrastructure/index.js';
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
7
  import { getParameterManager } from '../../lib/parameter/index.js';
@@ -45,27 +45,11 @@ export default class Down extends Command {
45
45
  throw new Error("Project not initialized. Run 'hereya init' first.");
46
46
  }
47
47
  ctx.configOutput = loadConfigOutput;
48
+ ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
48
49
  await delay(500);
49
50
  },
50
51
  title: 'Loading project config',
51
52
  },
52
- {
53
- async task(ctx) {
54
- const backend = await getBackend();
55
- const workspace = flags.workspace || ctx.configOutput.config.workspace;
56
- const getWorkspaceEnvOutput = await backend.getWorkspaceEnv({
57
- project: ctx.configOutput.config.project,
58
- workspace,
59
- });
60
- if (!getWorkspaceEnvOutput.success) {
61
- throw new Error(getWorkspaceEnvOutput.reason);
62
- }
63
- ctx.workspaceEnvOutput = getWorkspaceEnvOutput;
64
- ctx.workspace = workspace;
65
- await delay(500);
66
- },
67
- title: 'Loading workspace environment variables',
68
- },
69
53
  {
70
54
  async task(ctx) {
71
55
  const packages = Object.keys(ctx.configOutput.config.packages ?? {});
@@ -98,12 +82,17 @@ export default class Down extends Command {
98
82
  projectRootDir,
99
83
  workspace: ctx.workspace,
100
84
  });
101
- const destroyOutput = await destroyPackage({
102
- env: ctx.workspaceEnvOutput.env,
85
+ const executor$ = getExecutor();
86
+ if (!executor$.success) {
87
+ throw new Error(executor$.reason);
88
+ }
89
+ const { executor } = executor$;
90
+ const destroyOutput = await executor.destroy({
103
91
  isDeploying: flags.deploy,
104
92
  package: packageName,
105
93
  parameters,
106
94
  project: ctx.configOutput.config.project,
95
+ projectRootDir,
107
96
  workspace: ctx.workspace,
108
97
  });
109
98
  if (!destroyOutput.success) {
@@ -1,14 +1,14 @@
1
1
  import { Command } from '@oclif/core';
2
2
  export default class Env extends Command {
3
3
  static args: {
4
- name: import("@oclif/core/lib/interfaces/parser.js").Arg<string | undefined, Record<string, unknown>>;
4
+ name: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
5
  };
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- chdir: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
10
- list: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
11
- workspace: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
+ chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ list: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
12
  };
13
13
  run(): Promise<void>;
14
14
  }