hereya-cli 0.43.0 → 0.44.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 +33 -33
- package/dist/commands/add/index.js +5 -2
- package/dist/commands/deploy/index.js +13 -4
- package/dist/commands/down/index.js +4 -1
- package/dist/commands/import/index.js +5 -2
- package/dist/commands/remove/index.js +4 -1
- package/dist/commands/undeploy/index.js +7 -2
- package/dist/commands/up/index.js +7 -2
- package/dist/lib/parameter/index.d.ts +2 -1
- package/dist/lib/parameter/index.js +59 -11
- package/dist/lib/profile-utils.d.ts +2 -0
- package/dist/lib/profile-utils.js +9 -0
- package/oclif.manifest.json +3 -3
- package/package.json +1 -1
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.44.0 linux-x64 node-v22.17.1
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -71,8 +71,8 @@ ARGUMENTS
|
|
|
71
71
|
PACKAGE The package to add, specified as a GitHub repository in the format owner/repository.
|
|
72
72
|
To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to
|
|
73
73
|
$HEREYA_REGISTRY_URL/owner/repository.
|
|
74
|
-
For local packages, use the format local
|
|
75
|
-
|
|
74
|
+
For local packages, use the format local/path/to/package where path/to/package is the path to the package on
|
|
75
|
+
your local machine.
|
|
76
76
|
|
|
77
77
|
FLAGS
|
|
78
78
|
-p, --parameter=<value>... [default: ] parameter for the package, in the form of 'key=value'. Can be specified
|
|
@@ -90,7 +90,7 @@ EXAMPLES
|
|
|
90
90
|
$ hereya add cloudy/docker_postgres
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
93
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/add/index.ts)_
|
|
94
94
|
|
|
95
95
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
96
96
|
|
|
@@ -115,7 +115,7 @@ EXAMPLES
|
|
|
115
115
|
$ hereya bootstrap local
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
118
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/bootstrap/index.ts)_
|
|
119
119
|
|
|
120
120
|
## `hereya config export-backend [FILE]`
|
|
121
121
|
|
|
@@ -137,7 +137,7 @@ EXAMPLES
|
|
|
137
137
|
$ hereya config export-backend ./path/to/export.json
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
140
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/config/export-backend/index.ts)_
|
|
141
141
|
|
|
142
142
|
## `hereya config get-backend`
|
|
143
143
|
|
|
@@ -154,7 +154,7 @@ EXAMPLES
|
|
|
154
154
|
$ hereya config get-backend
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
157
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/config/get-backend/index.ts)_
|
|
158
158
|
|
|
159
159
|
## `hereya config import-backend FILE`
|
|
160
160
|
|
|
@@ -174,7 +174,7 @@ EXAMPLES
|
|
|
174
174
|
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
177
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/config/import-backend/index.ts)_
|
|
178
178
|
|
|
179
179
|
## `hereya config use-backend TYPE`
|
|
180
180
|
|
|
@@ -196,7 +196,7 @@ EXAMPLES
|
|
|
196
196
|
$ hereya config use-backend local
|
|
197
197
|
```
|
|
198
198
|
|
|
199
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
199
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/config/use-backend/index.ts)_
|
|
200
200
|
|
|
201
201
|
## `hereya deploy`
|
|
202
202
|
|
|
@@ -221,7 +221,7 @@ EXAMPLES
|
|
|
221
221
|
$ hereya deploy
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
224
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/deploy/index.ts)_
|
|
225
225
|
|
|
226
226
|
## `hereya down`
|
|
227
227
|
|
|
@@ -248,7 +248,7 @@ EXAMPLES
|
|
|
248
248
|
$ hereya down
|
|
249
249
|
```
|
|
250
250
|
|
|
251
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
251
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/down/index.ts)_
|
|
252
252
|
|
|
253
253
|
## `hereya env [NAME]`
|
|
254
254
|
|
|
@@ -279,7 +279,7 @@ EXAMPLES
|
|
|
279
279
|
$ hereya env -w dev -l
|
|
280
280
|
```
|
|
281
281
|
|
|
282
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
282
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/env/index.ts)_
|
|
283
283
|
|
|
284
284
|
## `hereya env set [NAME]`
|
|
285
285
|
|
|
@@ -306,7 +306,7 @@ EXAMPLES
|
|
|
306
306
|
$ hereya env set FOO -v bar -w dev
|
|
307
307
|
```
|
|
308
308
|
|
|
309
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
309
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/env/set/index.ts)_
|
|
310
310
|
|
|
311
311
|
## `hereya help [COMMAND]`
|
|
312
312
|
|
|
@@ -340,8 +340,8 @@ ARGUMENTS
|
|
|
340
340
|
PACKAGE The package to import, specified as a GitHub repository in the format owner/repository.
|
|
341
341
|
To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to
|
|
342
342
|
$HEREYA_REGISTRY_URL/owner/repository.
|
|
343
|
-
For local packages, use the format local
|
|
344
|
-
|
|
343
|
+
For local packages, use the format local/path/to/package where path/to/package is the path to the package on
|
|
344
|
+
your local machine.
|
|
345
345
|
|
|
346
346
|
FLAGS
|
|
347
347
|
-f, --stateFile=<value> (required) state file to use
|
|
@@ -363,7 +363,7 @@ EXAMPLES
|
|
|
363
363
|
$ hereya import org/my-package -f state.tfstate -w my-workspace
|
|
364
364
|
```
|
|
365
365
|
|
|
366
|
-
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
366
|
+
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/import/index.ts)_
|
|
367
367
|
|
|
368
368
|
## `hereya init PROJECT`
|
|
369
369
|
|
|
@@ -389,7 +389,7 @@ EXAMPLES
|
|
|
389
389
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
390
390
|
```
|
|
391
391
|
|
|
392
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
392
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/init/index.ts)_
|
|
393
393
|
|
|
394
394
|
## `hereya login [URL]`
|
|
395
395
|
|
|
@@ -418,7 +418,7 @@ EXAMPLES
|
|
|
418
418
|
$ hereya login --token=your-token https://cloud.hereya.dev
|
|
419
419
|
```
|
|
420
420
|
|
|
421
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
421
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/login/index.ts)_
|
|
422
422
|
|
|
423
423
|
## `hereya logout`
|
|
424
424
|
|
|
@@ -435,7 +435,7 @@ EXAMPLES
|
|
|
435
435
|
$ hereya logout
|
|
436
436
|
```
|
|
437
437
|
|
|
438
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
438
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/logout/index.ts)_
|
|
439
439
|
|
|
440
440
|
## `hereya remove PACKAGE`
|
|
441
441
|
|
|
@@ -462,7 +462,7 @@ EXAMPLES
|
|
|
462
462
|
$ hereya remove cloudy/docker_postgres
|
|
463
463
|
```
|
|
464
464
|
|
|
465
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
465
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/remove/index.ts)_
|
|
466
466
|
|
|
467
467
|
## `hereya run CMD`
|
|
468
468
|
|
|
@@ -488,7 +488,7 @@ EXAMPLES
|
|
|
488
488
|
$ hereya run -w uat -- node index.js
|
|
489
489
|
```
|
|
490
490
|
|
|
491
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
491
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/run/index.ts)_
|
|
492
492
|
|
|
493
493
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
494
494
|
|
|
@@ -513,7 +513,7 @@ EXAMPLES
|
|
|
513
513
|
$ hereya unbootstrap local
|
|
514
514
|
```
|
|
515
515
|
|
|
516
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
516
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/unbootstrap/index.ts)_
|
|
517
517
|
|
|
518
518
|
## `hereya undeploy`
|
|
519
519
|
|
|
@@ -538,7 +538,7 @@ EXAMPLES
|
|
|
538
538
|
$ hereya undeploy
|
|
539
539
|
```
|
|
540
540
|
|
|
541
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
541
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/undeploy/index.ts)_
|
|
542
542
|
|
|
543
543
|
## `hereya up`
|
|
544
544
|
|
|
@@ -565,7 +565,7 @@ EXAMPLES
|
|
|
565
565
|
$ hereya up
|
|
566
566
|
```
|
|
567
567
|
|
|
568
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
568
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/up/index.ts)_
|
|
569
569
|
|
|
570
570
|
## `hereya workspace create NAME`
|
|
571
571
|
|
|
@@ -589,7 +589,7 @@ EXAMPLES
|
|
|
589
589
|
$ hereya workspace create dev
|
|
590
590
|
```
|
|
591
591
|
|
|
592
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
592
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/workspace/create/index.ts)_
|
|
593
593
|
|
|
594
594
|
## `hereya workspace delete NAME`
|
|
595
595
|
|
|
@@ -609,7 +609,7 @@ EXAMPLES
|
|
|
609
609
|
$ hereya workspace delete dev
|
|
610
610
|
```
|
|
611
611
|
|
|
612
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
612
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/workspace/delete/index.ts)_
|
|
613
613
|
|
|
614
614
|
## `hereya workspace env [NAME]`
|
|
615
615
|
|
|
@@ -635,7 +635,7 @@ EXAMPLES
|
|
|
635
635
|
$ hereya workspace env myEnv -w dev
|
|
636
636
|
```
|
|
637
637
|
|
|
638
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
638
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/workspace/env/index.ts)_
|
|
639
639
|
|
|
640
640
|
## `hereya workspace env set`
|
|
641
641
|
|
|
@@ -659,7 +659,7 @@ EXAMPLES
|
|
|
659
659
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
660
660
|
```
|
|
661
661
|
|
|
662
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
662
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/workspace/env/set/index.ts)_
|
|
663
663
|
|
|
664
664
|
## `hereya workspace env unset`
|
|
665
665
|
|
|
@@ -680,7 +680,7 @@ EXAMPLES
|
|
|
680
680
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
681
681
|
```
|
|
682
682
|
|
|
683
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
683
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/workspace/env/unset/index.ts)_
|
|
684
684
|
|
|
685
685
|
## `hereya workspace install PACKAGE`
|
|
686
686
|
|
|
@@ -707,7 +707,7 @@ EXAMPLES
|
|
|
707
707
|
$ hereya workspace install hereya/aws-cognito
|
|
708
708
|
```
|
|
709
709
|
|
|
710
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
710
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/workspace/install/index.ts)_
|
|
711
711
|
|
|
712
712
|
## `hereya workspace list`
|
|
713
713
|
|
|
@@ -724,7 +724,7 @@ EXAMPLES
|
|
|
724
724
|
$ hereya workspace list
|
|
725
725
|
```
|
|
726
726
|
|
|
727
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
727
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/workspace/list/index.ts)_
|
|
728
728
|
|
|
729
729
|
## `hereya workspace set-profile PROFILE`
|
|
730
730
|
|
|
@@ -747,7 +747,7 @@ EXAMPLES
|
|
|
747
747
|
$ hereya workspace set-profile prod-profile -w production
|
|
748
748
|
```
|
|
749
749
|
|
|
750
|
-
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
750
|
+
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/workspace/set-profile/index.ts)_
|
|
751
751
|
|
|
752
752
|
## `hereya workspace uninstall PACKAGE`
|
|
753
753
|
|
|
@@ -774,5 +774,5 @@ EXAMPLES
|
|
|
774
774
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
775
775
|
```
|
|
776
776
|
|
|
777
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
777
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.44.0/src/commands/workspace/uninstall/index.ts)_
|
|
778
778
|
<!-- commandsstop -->
|
|
@@ -8,6 +8,7 @@ import { getEnvManager } from '../../lib/env/index.js';
|
|
|
8
8
|
import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
9
9
|
import { arrayOfStringToObject } from '../../lib/object-utils.js';
|
|
10
10
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
11
|
+
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
11
12
|
import { delay } from '../../lib/shell.js';
|
|
12
13
|
export default class Add extends Command {
|
|
13
14
|
static args = {
|
|
@@ -15,7 +16,7 @@ export default class Add extends Command {
|
|
|
15
16
|
description: `
|
|
16
17
|
The package to add, specified as a GitHub repository in the format owner/repository.
|
|
17
18
|
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
|
|
19
|
+
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
20
|
`,
|
|
20
21
|
required: true,
|
|
21
22
|
}),
|
|
@@ -74,11 +75,13 @@ export default class Add extends Command {
|
|
|
74
75
|
async task(ctx) {
|
|
75
76
|
const userSpecifiedParameters = arrayOfStringToObject(ctx.userSpecifiedParameters);
|
|
76
77
|
const parameterManager = getParameterManager();
|
|
78
|
+
const backend = await getBackend();
|
|
79
|
+
const profile = await getProfileFromWorkspace(backend, ctx.configOutput.config.workspace);
|
|
77
80
|
const parametersOutput = await parameterManager.getPackageParameters({
|
|
78
81
|
package: ctx.package,
|
|
82
|
+
profile,
|
|
79
83
|
projectRootDir,
|
|
80
84
|
userSpecifiedParameters,
|
|
81
|
-
workspace: ctx.configOutput.config.workspace,
|
|
82
85
|
});
|
|
83
86
|
ctx.parametersOutput = parametersOutput;
|
|
84
87
|
await delay(500);
|
|
@@ -7,6 +7,7 @@ import { getConfigManager } from '../../lib/config/index.js';
|
|
|
7
7
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
8
8
|
import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
9
9
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
10
|
+
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
10
11
|
import { delay } from '../../lib/shell.js';
|
|
11
12
|
export default class Deploy extends Command {
|
|
12
13
|
static description = 'Deploy a hereya project using the project deployment package';
|
|
@@ -101,10 +102,12 @@ export default class Deploy extends Command {
|
|
|
101
102
|
},
|
|
102
103
|
async task(_, task) {
|
|
103
104
|
const parameterManager = getParameterManager();
|
|
105
|
+
const backend = await getBackend();
|
|
106
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
104
107
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
105
108
|
package: packageName,
|
|
109
|
+
profile,
|
|
106
110
|
projectRootDir,
|
|
107
|
-
workspace: ctx.workspace,
|
|
108
111
|
});
|
|
109
112
|
const executor$ = getExecutor();
|
|
110
113
|
if (!executor$.success) {
|
|
@@ -139,10 +142,12 @@ export default class Deploy extends Command {
|
|
|
139
142
|
},
|
|
140
143
|
async task(_, task) {
|
|
141
144
|
const parameterManager = getParameterManager();
|
|
145
|
+
const backend = await getBackend();
|
|
146
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
142
147
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
143
148
|
package: packageName,
|
|
149
|
+
profile,
|
|
144
150
|
projectRootDir,
|
|
145
|
-
workspace: ctx.workspace,
|
|
146
151
|
});
|
|
147
152
|
const executor$ = getExecutor();
|
|
148
153
|
if (!executor$.success) {
|
|
@@ -183,10 +188,12 @@ export default class Deploy extends Command {
|
|
|
183
188
|
},
|
|
184
189
|
async task(_, task) {
|
|
185
190
|
const parameterManager = getParameterManager();
|
|
191
|
+
const backend = await getBackend();
|
|
192
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
186
193
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
187
194
|
package: packageName,
|
|
195
|
+
profile,
|
|
188
196
|
projectRootDir,
|
|
189
|
-
workspace: ctx.workspace,
|
|
190
197
|
});
|
|
191
198
|
const executor$ = getExecutor();
|
|
192
199
|
if (!executor$.success) {
|
|
@@ -284,10 +291,12 @@ export default class Deploy extends Command {
|
|
|
284
291
|
},
|
|
285
292
|
async task(_, task) {
|
|
286
293
|
const parameterManager = getParameterManager();
|
|
294
|
+
const backend = await getBackend();
|
|
295
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
287
296
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
288
297
|
package: packageName,
|
|
298
|
+
profile,
|
|
289
299
|
projectRootDir,
|
|
290
|
-
workspace: ctx.workspace,
|
|
291
300
|
});
|
|
292
301
|
const executor$ = getExecutor();
|
|
293
302
|
if (!executor$.success) {
|
|
@@ -6,6 +6,7 @@ import { getConfigManager } from '../../lib/config/index.js';
|
|
|
6
6
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
7
7
|
import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
8
8
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
9
|
+
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
9
10
|
import { delay } from '../../lib/shell.js';
|
|
10
11
|
export default class Down extends Command {
|
|
11
12
|
static description = 'Destroy all packages in the project.';
|
|
@@ -94,10 +95,12 @@ export default class Down extends Command {
|
|
|
94
95
|
},
|
|
95
96
|
async task(_, task) {
|
|
96
97
|
const parameterManager = getParameterManager();
|
|
98
|
+
const backend = await getBackend();
|
|
99
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
97
100
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
98
101
|
package: packageName,
|
|
102
|
+
profile,
|
|
99
103
|
projectRootDir,
|
|
100
|
-
workspace: ctx.workspace,
|
|
101
104
|
});
|
|
102
105
|
const executor$ = getExecutor();
|
|
103
106
|
if (!executor$.success) {
|
|
@@ -7,6 +7,7 @@ import { logEnv } from '../../lib/env-utils.js';
|
|
|
7
7
|
import { getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
8
8
|
import { arrayOfStringToObject } from '../../lib/object-utils.js';
|
|
9
9
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
10
|
+
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
10
11
|
import { delay } from '../../lib/shell.js';
|
|
11
12
|
export default class Import extends Command {
|
|
12
13
|
static args = {
|
|
@@ -14,7 +15,7 @@ export default class Import extends Command {
|
|
|
14
15
|
description: `
|
|
15
16
|
The package to import, specified as a GitHub repository in the format owner/repository.
|
|
16
17
|
To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to $HEREYA_REGISTRY_URL/owner/repository.
|
|
17
|
-
For local packages, use the format local
|
|
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.
|
|
18
19
|
`,
|
|
19
20
|
required: true,
|
|
20
21
|
}),
|
|
@@ -88,11 +89,13 @@ export default class Import extends Command {
|
|
|
88
89
|
async task(ctx) {
|
|
89
90
|
const userSpecifiedParameters = arrayOfStringToObject(ctx.userSpecifiedParameters);
|
|
90
91
|
const parameterManager = getParameterManager();
|
|
92
|
+
const backend = await getBackend();
|
|
93
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
91
94
|
const parametersOutput = await parameterManager.getPackageParameters({
|
|
92
95
|
package: ctx.package,
|
|
96
|
+
profile,
|
|
93
97
|
projectRootDir,
|
|
94
98
|
userSpecifiedParameters,
|
|
95
|
-
workspace: ctx.workspace,
|
|
96
99
|
});
|
|
97
100
|
ctx.parametersOutput = parametersOutput;
|
|
98
101
|
await delay(500);
|
|
@@ -6,6 +6,7 @@ import { getConfigManager } from '../../lib/config/index.js';
|
|
|
6
6
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
7
7
|
import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
8
8
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
9
|
+
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
9
10
|
import { delay } from '../../lib/shell.js';
|
|
10
11
|
export default class Remove extends Command {
|
|
11
12
|
static args = {
|
|
@@ -63,10 +64,12 @@ export default class Remove extends Command {
|
|
|
63
64
|
{
|
|
64
65
|
async task(ctx) {
|
|
65
66
|
const parameterManager = getParameterManager();
|
|
67
|
+
const backend = await getBackend();
|
|
68
|
+
const profile = await getProfileFromWorkspace(backend, ctx.configOutput.config.workspace);
|
|
66
69
|
const parametersOutput = await parameterManager.getPackageParameters({
|
|
67
70
|
package: ctx.package,
|
|
71
|
+
profile,
|
|
68
72
|
projectRootDir,
|
|
69
|
-
workspace: ctx.configOutput.config.workspace,
|
|
70
73
|
});
|
|
71
74
|
ctx.parametersOutput = parametersOutput;
|
|
72
75
|
await delay(500);
|
|
@@ -7,6 +7,7 @@ import { getConfigManager } from '../../lib/config/index.js';
|
|
|
7
7
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
8
8
|
import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
9
9
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
10
|
+
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
10
11
|
import { delay } from '../../lib/shell.js';
|
|
11
12
|
export default class Undeploy extends Command {
|
|
12
13
|
static description = 'Undeploy a hereya project by removing all resources.';
|
|
@@ -106,10 +107,12 @@ export default class Undeploy extends Command {
|
|
|
106
107
|
},
|
|
107
108
|
async task(_, task) {
|
|
108
109
|
const parameterManager = getParameterManager();
|
|
110
|
+
const backend = await getBackend();
|
|
111
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
109
112
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
110
113
|
package: packageName,
|
|
114
|
+
profile,
|
|
111
115
|
projectRootDir,
|
|
112
|
-
workspace: ctx.workspace,
|
|
113
116
|
});
|
|
114
117
|
const executor$ = getExecutor();
|
|
115
118
|
if (!executor$.success) {
|
|
@@ -144,10 +147,12 @@ export default class Undeploy extends Command {
|
|
|
144
147
|
},
|
|
145
148
|
async task(_, task) {
|
|
146
149
|
const parameterManager = getParameterManager();
|
|
150
|
+
const backend = await getBackend();
|
|
151
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
147
152
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
148
153
|
package: packageName,
|
|
154
|
+
profile,
|
|
149
155
|
projectRootDir,
|
|
150
|
-
workspace: ctx.workspace,
|
|
151
156
|
});
|
|
152
157
|
const executor$ = getExecutor();
|
|
153
158
|
if (!executor$.success) {
|
|
@@ -6,6 +6,7 @@ import { getConfigManager } from '../../lib/config/index.js';
|
|
|
6
6
|
import { getEnvManager } from '../../lib/env/index.js';
|
|
7
7
|
import { getLogger, getLogPath, isDebug, setDebug } from '../../lib/log.js';
|
|
8
8
|
import { getParameterManager } from '../../lib/parameter/index.js';
|
|
9
|
+
import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
|
|
9
10
|
import { delay } from '../../lib/shell.js';
|
|
10
11
|
export default class Up extends Command {
|
|
11
12
|
static description = 'Provision all packages in the project.';
|
|
@@ -102,10 +103,12 @@ export default class Up extends Command {
|
|
|
102
103
|
},
|
|
103
104
|
async task(_, task) {
|
|
104
105
|
const parameterManager = getParameterManager();
|
|
106
|
+
const backend = await getBackend();
|
|
107
|
+
const profile = await getProfileFromWorkspace(backend, workspace);
|
|
105
108
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
106
109
|
package: packageName,
|
|
110
|
+
profile,
|
|
107
111
|
projectRootDir,
|
|
108
|
-
workspace,
|
|
109
112
|
});
|
|
110
113
|
const executor$ = getExecutor();
|
|
111
114
|
if (!executor$.success) {
|
|
@@ -146,10 +149,12 @@ export default class Up extends Command {
|
|
|
146
149
|
},
|
|
147
150
|
async task(_, task) {
|
|
148
151
|
const parameterManager = getParameterManager();
|
|
152
|
+
const backend = await getBackend();
|
|
153
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
149
154
|
const { parameters } = await parameterManager.getPackageParameters({
|
|
150
155
|
package: packageName,
|
|
156
|
+
profile,
|
|
151
157
|
projectRootDir,
|
|
152
|
-
workspace: ctx.workspace,
|
|
153
158
|
});
|
|
154
159
|
const executor$ = getExecutor();
|
|
155
160
|
if (!executor$.success) {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
export declare class ParameterManager {
|
|
2
2
|
getPackageParameters(input: GetPackageParametersInput): Promise<GetPackageParametersOutput>;
|
|
3
3
|
savePackageParameters(input: SavePackageParametersInput): Promise<SavePackageParametersOutput>;
|
|
4
|
+
private extractProfileSections;
|
|
4
5
|
private getParametersFolder;
|
|
5
6
|
}
|
|
6
7
|
export declare const parameterManager: ParameterManager;
|
|
7
8
|
export declare function getParameterManager(): ParameterManager;
|
|
8
9
|
export type GetPackageParametersInput = {
|
|
9
10
|
package: string;
|
|
11
|
+
profile: string;
|
|
10
12
|
projectRootDir?: string;
|
|
11
13
|
userSpecifiedParameters?: {
|
|
12
14
|
[key: string]: string;
|
|
13
15
|
};
|
|
14
|
-
workspace: string;
|
|
15
16
|
};
|
|
16
17
|
export type GetPackageParametersOutput = {
|
|
17
18
|
parameters: {
|
|
@@ -1,20 +1,40 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import { getAnyPath } from '../filesystem.js';
|
|
3
4
|
import { getPackageCanonicalName } from '../package/index.js';
|
|
4
|
-
import { load, save } from '../yaml-utils.js';
|
|
5
|
+
import { load, parseYaml, save } from '../yaml-utils.js';
|
|
5
6
|
export class ParameterManager {
|
|
6
7
|
async getPackageParameters(input) {
|
|
7
8
|
const pkgName = getPackageCanonicalName(input.package);
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const paramsFolder = await this.getParametersFolder(input.projectRootDir);
|
|
10
|
+
// Load base file
|
|
11
|
+
const baseFilePath = await getAnyPath(path.join(paramsFolder, `${pkgName}.yaml`), path.join(paramsFolder, `${pkgName}.yml`));
|
|
12
|
+
// For base file, we need to extract just the first document (before any ---)
|
|
13
|
+
let baseParams = null;
|
|
14
|
+
if (baseFilePath) {
|
|
15
|
+
try {
|
|
16
|
+
const content = await fs.readFile(baseFilePath, 'utf8');
|
|
17
|
+
const firstDocIndex = content.indexOf('\n---');
|
|
18
|
+
const baseContent = firstDocIndex === -1 ? content : content.slice(0, Math.max(0, firstDocIndex));
|
|
19
|
+
const { data } = await parseYaml(baseContent);
|
|
20
|
+
baseParams = data;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
baseParams = null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// Load profile-specific file
|
|
27
|
+
const profileFilePath = await getAnyPath(path.join(paramsFolder, `${pkgName}.${input.profile}.yaml`), path.join(paramsFolder, `${pkgName}.${input.profile}.yml`));
|
|
28
|
+
const { data: profileParams } = await load(profileFilePath);
|
|
29
|
+
// Extract profile sections from base file
|
|
30
|
+
const profileSections = await this.extractProfileSections(baseFilePath, input.profile);
|
|
31
|
+
// Merge all parameters (order matters for precedence)
|
|
32
|
+
const parameters = {
|
|
33
|
+
...baseParams,
|
|
34
|
+
...profileParams,
|
|
35
|
+
...profileSections,
|
|
36
|
+
...input.userSpecifiedParameters
|
|
37
|
+
};
|
|
18
38
|
return { parameters };
|
|
19
39
|
}
|
|
20
40
|
async savePackageParameters(input) {
|
|
@@ -46,6 +66,34 @@ export class ParameterManager {
|
|
|
46
66
|
saved: true,
|
|
47
67
|
};
|
|
48
68
|
}
|
|
69
|
+
async extractProfileSections(filePath, targetProfile) {
|
|
70
|
+
if (!filePath)
|
|
71
|
+
return null;
|
|
72
|
+
try {
|
|
73
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
74
|
+
const documents = content.split(/^---$/m);
|
|
75
|
+
// Parse all documents in parallel
|
|
76
|
+
const parsedDocs = await Promise.all(documents.map(async (doc) => {
|
|
77
|
+
if (!doc.trim())
|
|
78
|
+
return null;
|
|
79
|
+
const { data } = await parseYaml(doc);
|
|
80
|
+
return data;
|
|
81
|
+
}));
|
|
82
|
+
// Find matching profile document
|
|
83
|
+
for (const data of parsedDocs) {
|
|
84
|
+
if (data && data.profile === targetProfile) {
|
|
85
|
+
// Remove the profile field and return the rest
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
87
|
+
const { profile, ...params } = data;
|
|
88
|
+
return params;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Ignore errors, return null
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
49
97
|
async getParametersFolder(projectRootDir) {
|
|
50
98
|
return path.join(projectRootDir ?? process.cwd(), 'hereyaconfig', 'hereyavars');
|
|
51
99
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export async function getProfileFromWorkspace(backend, workspaceName) {
|
|
2
|
+
const workspace$ = await backend.getWorkspace(workspaceName);
|
|
3
|
+
if (!workspace$.found || workspace$.hasError) {
|
|
4
|
+
// Fallback to workspace name if workspace not found
|
|
5
|
+
return workspaceName;
|
|
6
|
+
}
|
|
7
|
+
// Use profile if defined, otherwise use workspace name
|
|
8
|
+
return workspace$.workspace.profile ?? workspaceName;
|
|
9
|
+
}
|
package/oclif.manifest.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"aliases": [],
|
|
5
5
|
"args": {
|
|
6
6
|
"package": {
|
|
7
|
-
"description": "\n The package to add, specified as a GitHub repository in the format owner/repository.\n To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to $HEREYA_REGISTRY_URL/owner/repository.\n For local packages, use the format local
|
|
7
|
+
"description": "\n The package to add, specified as a GitHub repository in the format owner/repository.\n To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to $HEREYA_REGISTRY_URL/owner/repository.\n For local packages, use the format local/path/to/package where path/to/package is the path to the package on your local machine.\n ",
|
|
8
8
|
"name": "package",
|
|
9
9
|
"required": true
|
|
10
10
|
}
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
"aliases": [],
|
|
269
269
|
"args": {
|
|
270
270
|
"package": {
|
|
271
|
-
"description": "\n The package to import, specified as a GitHub repository in the format owner/repository.\n To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to $HEREYA_REGISTRY_URL/owner/repository.\n For local packages, use the format local
|
|
271
|
+
"description": "\n The package to import, specified as a GitHub repository in the format owner/repository.\n To change the registry URL, set the HEREYA_REGISTRY_URL environment variable, so that it points to $HEREYA_REGISTRY_URL/owner/repository.\n For local packages, use the format local/path/to/package where path/to/package is the path to the package on your local machine.\n ",
|
|
272
272
|
"name": "package",
|
|
273
273
|
"required": true
|
|
274
274
|
}
|
|
@@ -1317,5 +1317,5 @@
|
|
|
1317
1317
|
]
|
|
1318
1318
|
}
|
|
1319
1319
|
},
|
|
1320
|
-
"version": "0.
|
|
1320
|
+
"version": "0.44.0"
|
|
1321
1321
|
}
|