hereya-cli 0.4.6 → 0.5.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 +26 -24
- package/dist/commands/add/index.js +2 -2
- package/dist/commands/deploy/index.d.ts +1 -1
- package/dist/commands/deploy/index.js +4 -2
- package/dist/commands/down/index.d.ts +1 -0
- package/dist/commands/down/index.js +6 -1
- package/dist/commands/remove/index.js +1 -1
- package/dist/commands/undeploy/index.d.ts +1 -1
- package/dist/commands/undeploy/index.js +4 -3
- package/dist/commands/up/index.d.ts +1 -0
- package/dist/commands/up/index.js +8 -2
- package/dist/infrastructure/index.d.ts +1 -0
- package/dist/infrastructure/index.js +8 -8
- package/dist/lib/config/common.d.ts +2 -1
- package/dist/lib/config/simple.js +7 -2
- package/dist/lib/package/index.d.ts +24 -0
- package/dist/lib/package/index.js +11 -1
- package/oclif.manifest.json +56 -42
- package/package.json +5 -3
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.
|
|
23
|
+
hereya-cli/0.5.0 linux-x64 node-v20.13.1
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -70,7 +70,7 @@ EXAMPLES
|
|
|
70
70
|
$ hereya add cloudy/docker_postgres
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
73
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/add/index.ts)_
|
|
74
74
|
|
|
75
75
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
76
76
|
|
|
@@ -95,7 +95,7 @@ EXAMPLES
|
|
|
95
95
|
$ hereya bootstrap local
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
98
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/bootstrap/index.ts)_
|
|
99
99
|
|
|
100
100
|
## `hereya deploy`
|
|
101
101
|
|
|
@@ -103,10 +103,10 @@ Deploy a hereya project using the project deployment package
|
|
|
103
103
|
|
|
104
104
|
```
|
|
105
105
|
USAGE
|
|
106
|
-
$ hereya deploy
|
|
106
|
+
$ hereya deploy -w <value> [--chdir <value>]
|
|
107
107
|
|
|
108
108
|
FLAGS
|
|
109
|
-
-w, --workspace=<value> name of the workspace to deploy the packages for
|
|
109
|
+
-w, --workspace=<value> (required) name of the workspace to deploy the packages for
|
|
110
110
|
--chdir=<value> directory to run command in
|
|
111
111
|
|
|
112
112
|
DESCRIPTION
|
|
@@ -116,7 +116,7 @@ EXAMPLES
|
|
|
116
116
|
$ hereya deploy
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
119
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/deploy/index.ts)_
|
|
120
120
|
|
|
121
121
|
## `hereya down`
|
|
122
122
|
|
|
@@ -124,11 +124,12 @@ Destroy all packages in the project.
|
|
|
124
124
|
|
|
125
125
|
```
|
|
126
126
|
USAGE
|
|
127
|
-
$ hereya down [--chdir <value>] [-w <value>]
|
|
127
|
+
$ hereya down [--chdir <value>] [--deploy] [-w <value>]
|
|
128
128
|
|
|
129
129
|
FLAGS
|
|
130
130
|
-w, --workspace=<value> name of the workspace to install the packages for
|
|
131
131
|
--chdir=<value> directory to run command in
|
|
132
|
+
--deploy destroy deployment companion packages
|
|
132
133
|
|
|
133
134
|
DESCRIPTION
|
|
134
135
|
Destroy all packages in the project.
|
|
@@ -137,7 +138,7 @@ EXAMPLES
|
|
|
137
138
|
$ hereya down
|
|
138
139
|
```
|
|
139
140
|
|
|
140
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
141
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/down/index.ts)_
|
|
141
142
|
|
|
142
143
|
## `hereya env`
|
|
143
144
|
|
|
@@ -160,7 +161,7 @@ EXAMPLES
|
|
|
160
161
|
$ hereya env -w dev
|
|
161
162
|
```
|
|
162
163
|
|
|
163
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
164
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/env/index.ts)_
|
|
164
165
|
|
|
165
166
|
## `hereya help [COMMAND]`
|
|
166
167
|
|
|
@@ -180,7 +181,7 @@ DESCRIPTION
|
|
|
180
181
|
Display help for hereya.
|
|
181
182
|
```
|
|
182
183
|
|
|
183
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0
|
|
184
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.1.0/src/commands/help.ts)_
|
|
184
185
|
|
|
185
186
|
## `hereya init PROJECT`
|
|
186
187
|
|
|
@@ -206,7 +207,7 @@ EXAMPLES
|
|
|
206
207
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
207
208
|
```
|
|
208
209
|
|
|
209
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
210
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/init/index.ts)_
|
|
210
211
|
|
|
211
212
|
## `hereya remote exec [PKGPATH]`
|
|
212
213
|
|
|
@@ -230,7 +231,7 @@ EXAMPLES
|
|
|
230
231
|
$ hereya remote exec
|
|
231
232
|
```
|
|
232
233
|
|
|
233
|
-
_See code: [src/commands/remote/exec/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
234
|
+
_See code: [src/commands/remote/exec/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/remote/exec/index.ts)_
|
|
234
235
|
|
|
235
236
|
## `hereya remove PACKAGE`
|
|
236
237
|
|
|
@@ -253,7 +254,7 @@ EXAMPLES
|
|
|
253
254
|
$ hereya remove cloudy/docker_postgres
|
|
254
255
|
```
|
|
255
256
|
|
|
256
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
257
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/remove/index.ts)_
|
|
257
258
|
|
|
258
259
|
## `hereya run CMD`
|
|
259
260
|
|
|
@@ -279,7 +280,7 @@ EXAMPLES
|
|
|
279
280
|
$ hereya run -w uat -- node index.js
|
|
280
281
|
```
|
|
281
282
|
|
|
282
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
283
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/run/index.ts)_
|
|
283
284
|
|
|
284
285
|
## `hereya undeploy`
|
|
285
286
|
|
|
@@ -287,10 +288,10 @@ Undeploy a hereya project by removing all resources.
|
|
|
287
288
|
|
|
288
289
|
```
|
|
289
290
|
USAGE
|
|
290
|
-
$ hereya undeploy
|
|
291
|
+
$ hereya undeploy -w <value> [--chdir <value>]
|
|
291
292
|
|
|
292
293
|
FLAGS
|
|
293
|
-
-w, --workspace=<value> name of the workspace to undeploy the packages for
|
|
294
|
+
-w, --workspace=<value> (required) name of the workspace to undeploy the packages for
|
|
294
295
|
--chdir=<value> directory to run command in
|
|
295
296
|
|
|
296
297
|
DESCRIPTION
|
|
@@ -300,7 +301,7 @@ EXAMPLES
|
|
|
300
301
|
$ hereya undeploy
|
|
301
302
|
```
|
|
302
303
|
|
|
303
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
304
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/undeploy/index.ts)_
|
|
304
305
|
|
|
305
306
|
## `hereya up`
|
|
306
307
|
|
|
@@ -308,11 +309,12 @@ Provision all packages in the project.
|
|
|
308
309
|
|
|
309
310
|
```
|
|
310
311
|
USAGE
|
|
311
|
-
$ hereya up [--chdir <value>] [-w <value>]
|
|
312
|
+
$ hereya up [--chdir <value>] [--deploy] [-w <value>]
|
|
312
313
|
|
|
313
314
|
FLAGS
|
|
314
315
|
-w, --workspace=<value> name of the workspace to install the packages for
|
|
315
316
|
--chdir=<value> directory to run command in
|
|
317
|
+
--deploy provision deployment companion packages
|
|
316
318
|
|
|
317
319
|
DESCRIPTION
|
|
318
320
|
Provision all packages in the project.
|
|
@@ -321,7 +323,7 @@ EXAMPLES
|
|
|
321
323
|
$ hereya up
|
|
322
324
|
```
|
|
323
325
|
|
|
324
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
326
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/up/index.ts)_
|
|
325
327
|
|
|
326
328
|
## `hereya workspace create NAME`
|
|
327
329
|
|
|
@@ -341,7 +343,7 @@ EXAMPLES
|
|
|
341
343
|
$ hereya workspace create dev
|
|
342
344
|
```
|
|
343
345
|
|
|
344
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
346
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/workspace/create/index.ts)_
|
|
345
347
|
|
|
346
348
|
## `hereya workspace delete NAME`
|
|
347
349
|
|
|
@@ -361,7 +363,7 @@ EXAMPLES
|
|
|
361
363
|
$ hereya workspace delete dev
|
|
362
364
|
```
|
|
363
365
|
|
|
364
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
366
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/workspace/delete/index.ts)_
|
|
365
367
|
|
|
366
368
|
## `hereya workspace env`
|
|
367
369
|
|
|
@@ -381,7 +383,7 @@ EXAMPLES
|
|
|
381
383
|
$ hereya workspace env -w dev
|
|
382
384
|
```
|
|
383
385
|
|
|
384
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
386
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/workspace/env/index.ts)_
|
|
385
387
|
|
|
386
388
|
## `hereya workspace install PACKAGE`
|
|
387
389
|
|
|
@@ -407,7 +409,7 @@ EXAMPLES
|
|
|
407
409
|
$ hereya workspace install hereya/aws-cognito
|
|
408
410
|
```
|
|
409
411
|
|
|
410
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
412
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/workspace/install/index.ts)_
|
|
411
413
|
|
|
412
414
|
## `hereya workspace uninstall PACKAGE`
|
|
413
415
|
|
|
@@ -433,5 +435,5 @@ EXAMPLES
|
|
|
433
435
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
434
436
|
```
|
|
435
437
|
|
|
436
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
438
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.5.0/src/commands/workspace/uninstall/index.ts)_
|
|
437
439
|
<!-- commandsstop -->
|
|
@@ -73,12 +73,12 @@ export default class Add extends Command {
|
|
|
73
73
|
const envManager = getEnvManager();
|
|
74
74
|
await envManager.addProjectEnv({
|
|
75
75
|
env,
|
|
76
|
-
infra: metadata.infra,
|
|
76
|
+
infra: metadata.originalInfra ?? metadata.infra,
|
|
77
77
|
projectRootDir,
|
|
78
78
|
workspace: config.workspace,
|
|
79
79
|
});
|
|
80
80
|
await configManager.addPackage({
|
|
81
|
-
|
|
81
|
+
metadata,
|
|
82
82
|
package: args.package,
|
|
83
83
|
projectRootDir,
|
|
84
84
|
});
|
|
@@ -4,7 +4,7 @@ export default class Deploy extends Command {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
chdir: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
-
workspace: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string
|
|
7
|
+
workspace: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
8
|
};
|
|
9
9
|
run(): Promise<void>;
|
|
10
10
|
}
|
|
@@ -19,7 +19,7 @@ export default class Deploy extends Command {
|
|
|
19
19
|
workspace: Flags.string({
|
|
20
20
|
char: 'w',
|
|
21
21
|
description: 'name of the workspace to deploy the packages for',
|
|
22
|
-
required:
|
|
22
|
+
required: true,
|
|
23
23
|
}),
|
|
24
24
|
};
|
|
25
25
|
async run() {
|
|
@@ -66,6 +66,7 @@ export default class Deploy extends Command {
|
|
|
66
66
|
});
|
|
67
67
|
const destroyOutput = await destroyPackage({
|
|
68
68
|
env: workspaceEnv,
|
|
69
|
+
isDeploying: true,
|
|
69
70
|
package: packageName,
|
|
70
71
|
parameters,
|
|
71
72
|
project: config.project,
|
|
@@ -78,7 +79,7 @@ export default class Deploy extends Command {
|
|
|
78
79
|
}
|
|
79
80
|
this.log(`Package ${packageName} un-deployed successfully`);
|
|
80
81
|
}));
|
|
81
|
-
await Up.run(['--chdir', projectRootDir, '--workspace', workspace]);
|
|
82
|
+
await Up.run(['--chdir', projectRootDir, '--workspace', workspace, '--deploy']);
|
|
82
83
|
const { env: newProjectEnv } = await envManager.getProjectEnv({
|
|
83
84
|
markSecret: true,
|
|
84
85
|
projectRootDir,
|
|
@@ -92,6 +93,7 @@ export default class Deploy extends Command {
|
|
|
92
93
|
});
|
|
93
94
|
const provisionOutput = await provisionPackage({
|
|
94
95
|
env: workspaceEnv,
|
|
96
|
+
isDeploying: true,
|
|
95
97
|
package: packageName,
|
|
96
98
|
parameters,
|
|
97
99
|
project: config.project,
|
|
@@ -4,6 +4,7 @@ export default class Down extends Command {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
chdir: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
+
deploy: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
7
8
|
workspace: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
9
|
};
|
|
9
10
|
run(): Promise<void>;
|
|
@@ -14,6 +14,10 @@ export default class Down extends Command {
|
|
|
14
14
|
description: 'directory to run command in',
|
|
15
15
|
required: false,
|
|
16
16
|
}),
|
|
17
|
+
deploy: Flags.boolean({
|
|
18
|
+
description: 'destroy deployment companion packages',
|
|
19
|
+
required: false,
|
|
20
|
+
}),
|
|
17
21
|
workspace: Flags.string({
|
|
18
22
|
char: 'w',
|
|
19
23
|
description: 'name of the workspace to install the packages for',
|
|
@@ -50,6 +54,7 @@ export default class Down extends Command {
|
|
|
50
54
|
});
|
|
51
55
|
const destroyOutput = await destroyPackage({
|
|
52
56
|
env: workspaceEnv,
|
|
57
|
+
isDeploying: flags.deploy,
|
|
53
58
|
package: packageName,
|
|
54
59
|
parameters,
|
|
55
60
|
project: config.project,
|
|
@@ -67,7 +72,7 @@ export default class Down extends Command {
|
|
|
67
72
|
// eslint-disable-next-line no-await-in-loop
|
|
68
73
|
await envManager.removeProjectEnv({
|
|
69
74
|
env,
|
|
70
|
-
infra: metadata.infra,
|
|
75
|
+
infra: metadata.originalInfra ?? metadata.infra,
|
|
71
76
|
projectRootDir,
|
|
72
77
|
workspace,
|
|
73
78
|
});
|
|
@@ -4,7 +4,7 @@ export default class Undeploy extends Command {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
chdir: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
-
workspace: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string
|
|
7
|
+
workspace: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
8
|
};
|
|
9
9
|
run(): Promise<void>;
|
|
10
10
|
}
|
|
@@ -19,7 +19,7 @@ export default class Undeploy extends Command {
|
|
|
19
19
|
workspace: Flags.string({
|
|
20
20
|
char: 'w',
|
|
21
21
|
description: 'name of the workspace to undeploy the packages for',
|
|
22
|
-
required:
|
|
22
|
+
required: true,
|
|
23
23
|
}),
|
|
24
24
|
};
|
|
25
25
|
async run() {
|
|
@@ -58,18 +58,19 @@ export default class Undeploy extends Command {
|
|
|
58
58
|
});
|
|
59
59
|
const destroyOutput = await destroyPackage({
|
|
60
60
|
env: workspaceEnv,
|
|
61
|
+
isDeploying: true,
|
|
61
62
|
package: packageName,
|
|
62
63
|
parameters,
|
|
63
64
|
project: config.project,
|
|
64
65
|
projectEnv,
|
|
65
66
|
projectRootDir,
|
|
66
|
-
workspace
|
|
67
|
+
workspace
|
|
67
68
|
});
|
|
68
69
|
if (!destroyOutput.success) {
|
|
69
70
|
this.error(destroyOutput.reason);
|
|
70
71
|
}
|
|
71
72
|
this.log(`Package ${packageName} un-deployed successfully`);
|
|
72
73
|
}));
|
|
73
|
-
await Down.run(['--chdir', projectRootDir, '--workspace', workspace]);
|
|
74
|
+
await Down.run(['--chdir', projectRootDir, '--workspace', workspace, '--deploy']);
|
|
74
75
|
}
|
|
75
76
|
}
|
|
@@ -4,6 +4,7 @@ export default class Up extends Command {
|
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
chdir: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
7
|
+
deploy: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
7
8
|
workspace: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
9
|
};
|
|
9
10
|
run(): Promise<void>;
|
|
@@ -14,6 +14,10 @@ export default class Up extends Command {
|
|
|
14
14
|
description: 'directory to run command in',
|
|
15
15
|
required: false,
|
|
16
16
|
}),
|
|
17
|
+
deploy: Flags.boolean({
|
|
18
|
+
description: 'provision deployment companion packages',
|
|
19
|
+
required: false,
|
|
20
|
+
}),
|
|
17
21
|
workspace: Flags.string({
|
|
18
22
|
char: 'w',
|
|
19
23
|
description: 'name of the workspace to install the packages for',
|
|
@@ -58,6 +62,7 @@ export default class Up extends Command {
|
|
|
58
62
|
});
|
|
59
63
|
const destroyOutput = await destroyPackage({
|
|
60
64
|
env: workspaceEnv,
|
|
65
|
+
isDeploying: flags.deploy,
|
|
61
66
|
package: packageName,
|
|
62
67
|
parameters,
|
|
63
68
|
project: config.project,
|
|
@@ -78,6 +83,7 @@ export default class Up extends Command {
|
|
|
78
83
|
});
|
|
79
84
|
const provisionOutput = await provisionPackage({
|
|
80
85
|
env: workspaceEnv,
|
|
86
|
+
isDeploying: flags.deploy,
|
|
81
87
|
package: packageName,
|
|
82
88
|
parameters,
|
|
83
89
|
project: config.project,
|
|
@@ -96,7 +102,7 @@ export default class Up extends Command {
|
|
|
96
102
|
await Promise.all([
|
|
97
103
|
envManager.removeProjectEnv({
|
|
98
104
|
env,
|
|
99
|
-
infra: metadata.infra,
|
|
105
|
+
infra: metadata.originalInfra ?? metadata.infra,
|
|
100
106
|
projectRootDir,
|
|
101
107
|
workspace,
|
|
102
108
|
}),
|
|
@@ -106,7 +112,7 @@ export default class Up extends Command {
|
|
|
106
112
|
// eslint-disable-next-line no-await-in-loop
|
|
107
113
|
await envManager.addProjectEnv({
|
|
108
114
|
env,
|
|
109
|
-
infra: metadata.infra,
|
|
115
|
+
infra: metadata.originalInfra ?? metadata.infra,
|
|
110
116
|
projectRootDir,
|
|
111
117
|
workspace,
|
|
112
118
|
});
|
|
@@ -27,11 +27,11 @@ export function getInfrastructure(input) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
export async function destroyPackage(input) {
|
|
30
|
-
const resolvePackageOutput = await resolvePackage({ package: input.package });
|
|
30
|
+
const resolvePackageOutput = await resolvePackage({ isDeploying: input.isDeploying, package: input.package });
|
|
31
31
|
if (!resolvePackageOutput.found) {
|
|
32
32
|
return { reason: resolvePackageOutput.reason, success: false };
|
|
33
33
|
}
|
|
34
|
-
const { canonicalName, metadata, packageUri } = resolvePackageOutput;
|
|
34
|
+
const { canonicalName, metadata, packageUri, pkgName } = resolvePackageOutput;
|
|
35
35
|
const infrastructure$ = getInfrastructure({ type: metadata.infra });
|
|
36
36
|
if (!infrastructure$.supported) {
|
|
37
37
|
return { reason: infrastructure$.reason, success: false };
|
|
@@ -49,7 +49,7 @@ export async function destroyPackage(input) {
|
|
|
49
49
|
.filter(Boolean).join('')
|
|
50
50
|
.replaceAll(/[^\dA-Za-z]/g, ''),
|
|
51
51
|
parameters: input.parameters,
|
|
52
|
-
pkgName
|
|
52
|
+
pkgName,
|
|
53
53
|
pkgUrl: packageUri,
|
|
54
54
|
projectEnv: input.projectEnv ?? {},
|
|
55
55
|
projectRootDir: input.projectRootDir,
|
|
@@ -61,7 +61,7 @@ export async function destroyPackage(input) {
|
|
|
61
61
|
.filter(Boolean).join('')
|
|
62
62
|
.replaceAll(/[^\dA-Za-z]/g, ''),
|
|
63
63
|
parameters: input.parameters,
|
|
64
|
-
pkgName
|
|
64
|
+
pkgName,
|
|
65
65
|
pkgUrl: packageUri,
|
|
66
66
|
});
|
|
67
67
|
if (!destroyOutput.success) {
|
|
@@ -70,11 +70,11 @@ export async function destroyPackage(input) {
|
|
|
70
70
|
return { env: destroyOutput.env, metadata, success: true };
|
|
71
71
|
}
|
|
72
72
|
export async function provisionPackage(input) {
|
|
73
|
-
const resolvePackageOutput = await resolvePackage({ package: input.package });
|
|
73
|
+
const resolvePackageOutput = await resolvePackage({ isDeploying: input.isDeploying, package: input.package });
|
|
74
74
|
if (!resolvePackageOutput.found) {
|
|
75
75
|
return { reason: resolvePackageOutput.reason, success: false };
|
|
76
76
|
}
|
|
77
|
-
const { canonicalName, metadata, packageUri } = resolvePackageOutput;
|
|
77
|
+
const { canonicalName, metadata, packageUri, pkgName } = resolvePackageOutput;
|
|
78
78
|
const infrastructure$ = getInfrastructure({ type: metadata.infra });
|
|
79
79
|
if (!infrastructure$.supported) {
|
|
80
80
|
return { reason: infrastructure$.reason, success: false };
|
|
@@ -92,7 +92,7 @@ export async function provisionPackage(input) {
|
|
|
92
92
|
.filter(Boolean).join('')
|
|
93
93
|
.replaceAll(/[^\dA-Za-z]/g, ''),
|
|
94
94
|
parameters: input.parameters,
|
|
95
|
-
pkgName
|
|
95
|
+
pkgName,
|
|
96
96
|
pkgUrl: packageUri,
|
|
97
97
|
projectEnv: input.projectEnv ?? {},
|
|
98
98
|
projectRootDir: input.projectRootDir,
|
|
@@ -104,7 +104,7 @@ export async function provisionPackage(input) {
|
|
|
104
104
|
.filter(Boolean).join('')
|
|
105
105
|
.replaceAll(/[^\dA-Za-z]/g, ''),
|
|
106
106
|
parameters: input.parameters,
|
|
107
|
-
pkgName
|
|
107
|
+
pkgName,
|
|
108
108
|
pkgUrl: packageUri,
|
|
109
109
|
});
|
|
110
110
|
if (!provisionOutput.success) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IPackageMetadata } from '../package/index.js';
|
|
1
2
|
export interface ConfigManager {
|
|
2
3
|
addPackage: (input: AddPackageInput) => Promise<void>;
|
|
3
4
|
loadConfig: (input: LoadConfigInput) => Promise<LoadConfigOutput>;
|
|
@@ -33,7 +34,7 @@ export interface SaveConfigInput {
|
|
|
33
34
|
projectRootDir?: string;
|
|
34
35
|
}
|
|
35
36
|
export type AddPackageInput = {
|
|
36
|
-
|
|
37
|
+
metadata: IPackageMetadata;
|
|
37
38
|
package: string;
|
|
38
39
|
projectRootDir?: string;
|
|
39
40
|
};
|
|
@@ -6,7 +6,7 @@ export class SimpleConfigManager {
|
|
|
6
6
|
const { config } = await this.loadConfig({ projectRootDir: input.projectRootDir });
|
|
7
7
|
await yaml.save({
|
|
8
8
|
...config,
|
|
9
|
-
...(input.deploy ? {
|
|
9
|
+
...(input.metadata.deploy ? {
|
|
10
10
|
deploy: {
|
|
11
11
|
...config.deploy,
|
|
12
12
|
[input.package]: {
|
|
@@ -18,6 +18,11 @@ export class SimpleConfigManager {
|
|
|
18
18
|
...config.packages,
|
|
19
19
|
[input.package]: {
|
|
20
20
|
version: '',
|
|
21
|
+
...(input.metadata.onDeploy ? {
|
|
22
|
+
onDeploy: {
|
|
23
|
+
...input.metadata.onDeploy,
|
|
24
|
+
}
|
|
25
|
+
} : {})
|
|
21
26
|
}
|
|
22
27
|
}
|
|
23
28
|
}),
|
|
@@ -35,7 +40,7 @@ export class SimpleConfigManager {
|
|
|
35
40
|
const { config } = await this.loadConfig({ projectRootDir: input.projectRootDir });
|
|
36
41
|
const newPackages = { ...config.packages };
|
|
37
42
|
const newDeploy = { ...config.deploy };
|
|
38
|
-
if (input.deploy) {
|
|
43
|
+
if (input.metadata.deploy) {
|
|
39
44
|
delete newDeploy[input.package];
|
|
40
45
|
}
|
|
41
46
|
else {
|
|
@@ -7,6 +7,7 @@ export declare function getPackageManager(): PackageManager;
|
|
|
7
7
|
export declare function resolvePackage(input: ResolvePackageInput): Promise<ResolvePackageOutput>;
|
|
8
8
|
export declare function getPackageCanonicalName(packageName: string): string;
|
|
9
9
|
export type ResolvePackageInput = {
|
|
10
|
+
isDeploying?: boolean;
|
|
10
11
|
package: string;
|
|
11
12
|
};
|
|
12
13
|
export type ResolvePackageOutput = {
|
|
@@ -14,6 +15,7 @@ export type ResolvePackageOutput = {
|
|
|
14
15
|
found: true;
|
|
15
16
|
metadata: z.infer<typeof PackageMetadata>;
|
|
16
17
|
packageUri: string;
|
|
18
|
+
pkgName: string;
|
|
17
19
|
} | {
|
|
18
20
|
found: false;
|
|
19
21
|
reason: string;
|
|
@@ -22,12 +24,34 @@ export declare const PackageMetadata: z.ZodObject<{
|
|
|
22
24
|
deploy: z.ZodOptional<z.ZodBoolean>;
|
|
23
25
|
iac: z.ZodNativeEnum<typeof IacType>;
|
|
24
26
|
infra: z.ZodNativeEnum<typeof InfrastructureType>;
|
|
27
|
+
onDeploy: z.ZodOptional<z.ZodObject<{
|
|
28
|
+
pkg: z.ZodString;
|
|
29
|
+
version: z.ZodString;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
version: string;
|
|
32
|
+
pkg: string;
|
|
33
|
+
}, {
|
|
34
|
+
version: string;
|
|
35
|
+
pkg: string;
|
|
36
|
+
}>>;
|
|
37
|
+
originalInfra: z.ZodOptional<z.ZodNativeEnum<typeof InfrastructureType>>;
|
|
25
38
|
}, "strip", z.ZodTypeAny, {
|
|
26
39
|
iac: IacType;
|
|
27
40
|
infra: InfrastructureType;
|
|
28
41
|
deploy?: boolean | undefined;
|
|
42
|
+
onDeploy?: {
|
|
43
|
+
version: string;
|
|
44
|
+
pkg: string;
|
|
45
|
+
} | undefined;
|
|
46
|
+
originalInfra?: InfrastructureType | undefined;
|
|
29
47
|
}, {
|
|
30
48
|
iac: IacType;
|
|
31
49
|
infra: InfrastructureType;
|
|
32
50
|
deploy?: boolean | undefined;
|
|
51
|
+
onDeploy?: {
|
|
52
|
+
version: string;
|
|
53
|
+
pkg: string;
|
|
54
|
+
} | undefined;
|
|
55
|
+
originalInfra?: InfrastructureType | undefined;
|
|
33
56
|
}>;
|
|
57
|
+
export type IPackageMetadata = z.infer<typeof PackageMetadata>;
|
|
@@ -25,14 +25,19 @@ export async function resolvePackage(input) {
|
|
|
25
25
|
const metadataContent$ = metadataContentCandidates[0];
|
|
26
26
|
try {
|
|
27
27
|
const metadata = PackageMetadata.parse(yaml.parse(metadataContent$.content));
|
|
28
|
+
if (input.isDeploying && metadata.onDeploy) {
|
|
29
|
+
return resolvePackage({ package: metadata.onDeploy.pkg });
|
|
30
|
+
}
|
|
28
31
|
if (process.env.HEREYA_OVERRIDE_INFRA) {
|
|
32
|
+
metadata.originalInfra = metadata.infra;
|
|
29
33
|
metadata.infra = process.env.HEREYA_OVERRIDE_INFRA;
|
|
30
34
|
}
|
|
31
35
|
return {
|
|
32
36
|
canonicalName: getPackageCanonicalName(input.package),
|
|
33
37
|
found: true,
|
|
34
38
|
metadata,
|
|
35
|
-
packageUri: pkgUrl
|
|
39
|
+
packageUri: pkgUrl,
|
|
40
|
+
pkgName: input.package
|
|
36
41
|
};
|
|
37
42
|
}
|
|
38
43
|
catch (error) {
|
|
@@ -46,4 +51,9 @@ export const PackageMetadata = z.object({
|
|
|
46
51
|
deploy: z.boolean().optional(),
|
|
47
52
|
iac: z.nativeEnum(IacType),
|
|
48
53
|
infra: z.nativeEnum(InfrastructureType),
|
|
54
|
+
onDeploy: z.object({
|
|
55
|
+
pkg: z.string(),
|
|
56
|
+
version: z.string(),
|
|
57
|
+
}).optional(),
|
|
58
|
+
originalInfra: z.nativeEnum(InfrastructureType).optional(),
|
|
49
59
|
});
|
package/oclif.manifest.json
CHANGED
|
@@ -48,45 +48,6 @@
|
|
|
48
48
|
"index.js"
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
|
-
"bootstrap": {
|
|
52
|
-
"aliases": [],
|
|
53
|
-
"args": {
|
|
54
|
-
"infrastructureType": {
|
|
55
|
-
"description": "infrastructure to bootstrap. Options are local, aws, azure, gcp",
|
|
56
|
-
"name": "infrastructureType",
|
|
57
|
-
"required": true
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"description": "Install necessary resources for hereya operations in an infrastructure.",
|
|
61
|
-
"examples": [
|
|
62
|
-
"<%= config.bin %> <%= command.id %> aws",
|
|
63
|
-
"<%= config.bin %> <%= command.id %> local"
|
|
64
|
-
],
|
|
65
|
-
"flags": {
|
|
66
|
-
"force": {
|
|
67
|
-
"char": "f",
|
|
68
|
-
"description": "redeploy hereya resources if already deployed",
|
|
69
|
-
"name": "force",
|
|
70
|
-
"allowNo": false,
|
|
71
|
-
"type": "boolean"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"hasDynamicHelp": false,
|
|
75
|
-
"hiddenAliases": [],
|
|
76
|
-
"id": "bootstrap",
|
|
77
|
-
"pluginAlias": "hereya-cli",
|
|
78
|
-
"pluginName": "hereya-cli",
|
|
79
|
-
"pluginType": "core",
|
|
80
|
-
"strict": true,
|
|
81
|
-
"enableJsonFlag": false,
|
|
82
|
-
"isESM": true,
|
|
83
|
-
"relativePath": [
|
|
84
|
-
"dist",
|
|
85
|
-
"commands",
|
|
86
|
-
"bootstrap",
|
|
87
|
-
"index.js"
|
|
88
|
-
]
|
|
89
|
-
},
|
|
90
51
|
"deploy": {
|
|
91
52
|
"aliases": [],
|
|
92
53
|
"args": {},
|
|
@@ -107,7 +68,7 @@
|
|
|
107
68
|
"char": "w",
|
|
108
69
|
"description": "name of the workspace to deploy the packages for",
|
|
109
70
|
"name": "workspace",
|
|
110
|
-
"required":
|
|
71
|
+
"required": true,
|
|
111
72
|
"hasDynamicHelp": false,
|
|
112
73
|
"multiple": false,
|
|
113
74
|
"type": "option"
|
|
@@ -129,6 +90,45 @@
|
|
|
129
90
|
"index.js"
|
|
130
91
|
]
|
|
131
92
|
},
|
|
93
|
+
"bootstrap": {
|
|
94
|
+
"aliases": [],
|
|
95
|
+
"args": {
|
|
96
|
+
"infrastructureType": {
|
|
97
|
+
"description": "infrastructure to bootstrap. Options are local, aws, azure, gcp",
|
|
98
|
+
"name": "infrastructureType",
|
|
99
|
+
"required": true
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"description": "Install necessary resources for hereya operations in an infrastructure.",
|
|
103
|
+
"examples": [
|
|
104
|
+
"<%= config.bin %> <%= command.id %> aws",
|
|
105
|
+
"<%= config.bin %> <%= command.id %> local"
|
|
106
|
+
],
|
|
107
|
+
"flags": {
|
|
108
|
+
"force": {
|
|
109
|
+
"char": "f",
|
|
110
|
+
"description": "redeploy hereya resources if already deployed",
|
|
111
|
+
"name": "force",
|
|
112
|
+
"allowNo": false,
|
|
113
|
+
"type": "boolean"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"hasDynamicHelp": false,
|
|
117
|
+
"hiddenAliases": [],
|
|
118
|
+
"id": "bootstrap",
|
|
119
|
+
"pluginAlias": "hereya-cli",
|
|
120
|
+
"pluginName": "hereya-cli",
|
|
121
|
+
"pluginType": "core",
|
|
122
|
+
"strict": true,
|
|
123
|
+
"enableJsonFlag": false,
|
|
124
|
+
"isESM": true,
|
|
125
|
+
"relativePath": [
|
|
126
|
+
"dist",
|
|
127
|
+
"commands",
|
|
128
|
+
"bootstrap",
|
|
129
|
+
"index.js"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
132
|
"down": {
|
|
133
133
|
"aliases": [],
|
|
134
134
|
"args": {},
|
|
@@ -145,6 +145,13 @@
|
|
|
145
145
|
"multiple": false,
|
|
146
146
|
"type": "option"
|
|
147
147
|
},
|
|
148
|
+
"deploy": {
|
|
149
|
+
"description": "destroy deployment companion packages",
|
|
150
|
+
"name": "deploy",
|
|
151
|
+
"required": false,
|
|
152
|
+
"allowNo": false,
|
|
153
|
+
"type": "boolean"
|
|
154
|
+
},
|
|
148
155
|
"workspace": {
|
|
149
156
|
"char": "w",
|
|
150
157
|
"description": "name of the workspace to install the packages for",
|
|
@@ -371,7 +378,7 @@
|
|
|
371
378
|
"char": "w",
|
|
372
379
|
"description": "name of the workspace to undeploy the packages for",
|
|
373
380
|
"name": "workspace",
|
|
374
|
-
"required":
|
|
381
|
+
"required": true,
|
|
375
382
|
"hasDynamicHelp": false,
|
|
376
383
|
"multiple": false,
|
|
377
384
|
"type": "option"
|
|
@@ -409,6 +416,13 @@
|
|
|
409
416
|
"multiple": false,
|
|
410
417
|
"type": "option"
|
|
411
418
|
},
|
|
419
|
+
"deploy": {
|
|
420
|
+
"description": "provision deployment companion packages",
|
|
421
|
+
"name": "deploy",
|
|
422
|
+
"required": false,
|
|
423
|
+
"allowNo": false,
|
|
424
|
+
"type": "boolean"
|
|
425
|
+
},
|
|
412
426
|
"workspace": {
|
|
413
427
|
"char": "w",
|
|
414
428
|
"description": "name of the workspace to install the packages for",
|
|
@@ -699,5 +713,5 @@
|
|
|
699
713
|
]
|
|
700
714
|
}
|
|
701
715
|
},
|
|
702
|
-
"version": "0.
|
|
716
|
+
"version": "0.5.0"
|
|
703
717
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hereya-cli",
|
|
3
3
|
"description": "Infrastructure as Package",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"author": "Hereya Developers",
|
|
6
6
|
"bin": {
|
|
7
7
|
"hereya": "./bin/run.js"
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@oclif/prettier-config": "^0.2.1",
|
|
30
|
-
"@oclif/test": "^
|
|
30
|
+
"@oclif/test": "^4",
|
|
31
31
|
"@types/chai": "^4",
|
|
32
32
|
"@types/mocha": "^10",
|
|
33
33
|
"@types/mock-fs": "^4.13.4",
|
|
34
34
|
"@types/node": "^18",
|
|
35
|
+
"@types/sinon": "^17.0.3",
|
|
35
36
|
"chai": "^4",
|
|
36
37
|
"eslint": "^8",
|
|
37
38
|
"eslint-config-oclif": "^5",
|
|
@@ -88,5 +89,6 @@
|
|
|
88
89
|
"version": "oclif readme && git add README.md",
|
|
89
90
|
"doc": "yarn build && yarn run version && shx rm -rf dist"
|
|
90
91
|
},
|
|
91
|
-
"types": "dist/index.d.ts"
|
|
92
|
+
"types": "dist/index.d.ts",
|
|
93
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
92
94
|
}
|