hereya-cli 0.45.0 → 0.47.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 +135 -36
- package/dist/backend/cloud/cloud-backend.d.ts +2 -1
- package/dist/backend/cloud/cloud-backend.js +18 -0
- package/dist/backend/common.d.ts +12 -0
- package/dist/backend/file-storage/local.js +10 -2
- package/dist/backend/file.d.ts +2 -1
- package/dist/backend/file.js +17 -0
- package/dist/commands/add/index.d.ts +1 -0
- package/dist/commands/add/index.js +12 -5
- package/dist/commands/delete-state/index.d.ts +10 -0
- package/dist/commands/delete-state/index.js +49 -0
- package/dist/commands/env/set/index.js +4 -2
- package/dist/commands/flow/down/index.d.ts +14 -0
- package/dist/commands/flow/down/index.js +110 -0
- package/dist/commands/flow/up/index.d.ts +14 -0
- package/dist/commands/flow/up/index.js +99 -0
- package/dist/commands/remove/index.d.ts +1 -0
- package/dist/commands/remove/index.js +12 -5
- package/dist/lib/env/index.js +3 -1
- package/dist/lib/git-utils.d.ts +29 -0
- package/dist/lib/git-utils.js +62 -0
- package/oclif.manifest.json +210 -1
- 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.47.0 linux-x64 node-v22.17.1
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -35,10 +35,13 @@ USAGE
|
|
|
35
35
|
* [`hereya config get-backend`](#hereya-config-get-backend)
|
|
36
36
|
* [`hereya config import-backend FILE`](#hereya-config-import-backend-file)
|
|
37
37
|
* [`hereya config use-backend TYPE`](#hereya-config-use-backend-type)
|
|
38
|
+
* [`hereya delete-state`](#hereya-delete-state)
|
|
38
39
|
* [`hereya deploy`](#hereya-deploy)
|
|
39
40
|
* [`hereya down`](#hereya-down)
|
|
40
41
|
* [`hereya env [NAME]`](#hereya-env-name)
|
|
41
42
|
* [`hereya env set [NAME]`](#hereya-env-set-name)
|
|
43
|
+
* [`hereya flow down`](#hereya-flow-down)
|
|
44
|
+
* [`hereya flow up`](#hereya-flow-up)
|
|
42
45
|
* [`hereya help [COMMAND]`](#hereya-help-command)
|
|
43
46
|
* [`hereya import PACKAGE`](#hereya-import-package)
|
|
44
47
|
* [`hereya init PROJECT`](#hereya-init-project)
|
|
@@ -65,7 +68,7 @@ Add a package to the project.
|
|
|
65
68
|
|
|
66
69
|
```
|
|
67
70
|
USAGE
|
|
68
|
-
$ hereya add PACKAGE [--chdir <value>] [--debug] [-p <value>...]
|
|
71
|
+
$ hereya add PACKAGE [--chdir <value>] [--debug] [-p <value>...] [-w <value>]
|
|
69
72
|
|
|
70
73
|
ARGUMENTS
|
|
71
74
|
PACKAGE The package to add, specified as a GitHub repository in the format owner/repository.
|
|
@@ -77,6 +80,7 @@ ARGUMENTS
|
|
|
77
80
|
FLAGS
|
|
78
81
|
-p, --parameter=<value>... [default: ] parameter for the package, in the form of 'key=value'. Can be specified
|
|
79
82
|
multiple times.
|
|
83
|
+
-w, --workspace=<value> name of the workspace to add the package to (defaults to current workspace)
|
|
80
84
|
--chdir=<value> Directory where the command will be executed.
|
|
81
85
|
If not specified, it defaults to the current working directory.
|
|
82
86
|
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
@@ -90,7 +94,7 @@ EXAMPLES
|
|
|
90
94
|
$ hereya add cloudy/docker_postgres
|
|
91
95
|
```
|
|
92
96
|
|
|
93
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
97
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/add/index.ts)_
|
|
94
98
|
|
|
95
99
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
96
100
|
|
|
@@ -115,7 +119,7 @@ EXAMPLES
|
|
|
115
119
|
$ hereya bootstrap local
|
|
116
120
|
```
|
|
117
121
|
|
|
118
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
122
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/bootstrap/index.ts)_
|
|
119
123
|
|
|
120
124
|
## `hereya config export-backend [FILE]`
|
|
121
125
|
|
|
@@ -137,7 +141,7 @@ EXAMPLES
|
|
|
137
141
|
$ hereya config export-backend ./path/to/export.json
|
|
138
142
|
```
|
|
139
143
|
|
|
140
|
-
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
144
|
+
_See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/config/export-backend/index.ts)_
|
|
141
145
|
|
|
142
146
|
## `hereya config get-backend`
|
|
143
147
|
|
|
@@ -154,7 +158,7 @@ EXAMPLES
|
|
|
154
158
|
$ hereya config get-backend
|
|
155
159
|
```
|
|
156
160
|
|
|
157
|
-
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
161
|
+
_See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/config/get-backend/index.ts)_
|
|
158
162
|
|
|
159
163
|
## `hereya config import-backend FILE`
|
|
160
164
|
|
|
@@ -174,7 +178,7 @@ EXAMPLES
|
|
|
174
178
|
$ hereya config import-backend ./path/to/cloud-backend.json
|
|
175
179
|
```
|
|
176
180
|
|
|
177
|
-
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
181
|
+
_See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/config/import-backend/index.ts)_
|
|
178
182
|
|
|
179
183
|
## `hereya config use-backend TYPE`
|
|
180
184
|
|
|
@@ -196,7 +200,33 @@ EXAMPLES
|
|
|
196
200
|
$ hereya config use-backend local
|
|
197
201
|
```
|
|
198
202
|
|
|
199
|
-
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
203
|
+
_See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/config/use-backend/index.ts)_
|
|
204
|
+
|
|
205
|
+
## `hereya delete-state`
|
|
206
|
+
|
|
207
|
+
Delete the remote state of a project for a given workspace
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
USAGE
|
|
211
|
+
$ hereya delete-state -w <value> [--chdir <value>]
|
|
212
|
+
|
|
213
|
+
FLAGS
|
|
214
|
+
-w, --workspace=<value> (required) workspace name
|
|
215
|
+
--chdir=<value> Directory where the command will be executed.
|
|
216
|
+
If not specified, it defaults to the current working directory.
|
|
217
|
+
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
218
|
+
environment variable.
|
|
219
|
+
|
|
220
|
+
DESCRIPTION
|
|
221
|
+
Delete the remote state of a project for a given workspace
|
|
222
|
+
|
|
223
|
+
EXAMPLES
|
|
224
|
+
$ hereya delete-state -w dev
|
|
225
|
+
|
|
226
|
+
$ hereya delete-state --workspace staging
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
_See code: [src/commands/delete-state/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/delete-state/index.ts)_
|
|
200
230
|
|
|
201
231
|
## `hereya deploy`
|
|
202
232
|
|
|
@@ -221,7 +251,7 @@ EXAMPLES
|
|
|
221
251
|
$ hereya deploy
|
|
222
252
|
```
|
|
223
253
|
|
|
224
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
254
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/deploy/index.ts)_
|
|
225
255
|
|
|
226
256
|
## `hereya down`
|
|
227
257
|
|
|
@@ -248,7 +278,7 @@ EXAMPLES
|
|
|
248
278
|
$ hereya down
|
|
249
279
|
```
|
|
250
280
|
|
|
251
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
281
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/down/index.ts)_
|
|
252
282
|
|
|
253
283
|
## `hereya env [NAME]`
|
|
254
284
|
|
|
@@ -279,7 +309,7 @@ EXAMPLES
|
|
|
279
309
|
$ hereya env -w dev -l
|
|
280
310
|
```
|
|
281
311
|
|
|
282
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
312
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/env/index.ts)_
|
|
283
313
|
|
|
284
314
|
## `hereya env set [NAME]`
|
|
285
315
|
|
|
@@ -306,7 +336,75 @@ EXAMPLES
|
|
|
306
336
|
$ hereya env set FOO -v bar -w dev
|
|
307
337
|
```
|
|
308
338
|
|
|
309
|
-
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
339
|
+
_See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/env/set/index.ts)_
|
|
340
|
+
|
|
341
|
+
## `hereya flow down`
|
|
342
|
+
|
|
343
|
+
Create a git branch-based workspace and destroy all packages
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
USAGE
|
|
347
|
+
$ hereya flow down [--chdir <value>] [--debug] [--deploy] [--pin] [--profile <value>] [-s <value>...]
|
|
348
|
+
|
|
349
|
+
FLAGS
|
|
350
|
+
-s, --select=<value>... [default: ] select the packages to destroy
|
|
351
|
+
--chdir=<value> Directory where the command will be executed.
|
|
352
|
+
If not specified, it defaults to the current working directory.
|
|
353
|
+
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
354
|
+
environment variable.
|
|
355
|
+
--debug enable debug mode
|
|
356
|
+
--deploy destroy deployment companion packages
|
|
357
|
+
--pin append git commit SHA to workspace name for commit-specific isolation
|
|
358
|
+
--profile=<value> profile to use for the workspace (will be appended to workspace name)
|
|
359
|
+
|
|
360
|
+
DESCRIPTION
|
|
361
|
+
Create a git branch-based workspace and destroy all packages
|
|
362
|
+
|
|
363
|
+
EXAMPLES
|
|
364
|
+
$ hereya flow down
|
|
365
|
+
|
|
366
|
+
$ hereya flow down --debug
|
|
367
|
+
|
|
368
|
+
$ hereya flow down --profile staging
|
|
369
|
+
|
|
370
|
+
$ hereya flow down --pin
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
_See code: [src/commands/flow/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/flow/down/index.ts)_
|
|
374
|
+
|
|
375
|
+
## `hereya flow up`
|
|
376
|
+
|
|
377
|
+
Create a git branch-based workspace and provision all packages
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
USAGE
|
|
381
|
+
$ hereya flow up [--chdir <value>] [--debug] [--deploy] [--pin] [--profile <value>] [-s <value>...]
|
|
382
|
+
|
|
383
|
+
FLAGS
|
|
384
|
+
-s, --select=<value>... [default: ] select the packages to provision
|
|
385
|
+
--chdir=<value> Directory where the command will be executed.
|
|
386
|
+
If not specified, it defaults to the current working directory.
|
|
387
|
+
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
388
|
+
environment variable.
|
|
389
|
+
--debug enable debug mode
|
|
390
|
+
--deploy provision deployment companion packages
|
|
391
|
+
--pin append git commit SHA to workspace name for commit-specific isolation
|
|
392
|
+
--profile=<value> profile to use for the workspace (will be appended to workspace name)
|
|
393
|
+
|
|
394
|
+
DESCRIPTION
|
|
395
|
+
Create a git branch-based workspace and provision all packages
|
|
396
|
+
|
|
397
|
+
EXAMPLES
|
|
398
|
+
$ hereya flow up
|
|
399
|
+
|
|
400
|
+
$ hereya flow up --debug
|
|
401
|
+
|
|
402
|
+
$ hereya flow up --profile staging
|
|
403
|
+
|
|
404
|
+
$ hereya flow up --pin
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
_See code: [src/commands/flow/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/flow/up/index.ts)_
|
|
310
408
|
|
|
311
409
|
## `hereya help [COMMAND]`
|
|
312
410
|
|
|
@@ -363,7 +461,7 @@ EXAMPLES
|
|
|
363
461
|
$ hereya import org/my-package -f state.tfstate -w my-workspace
|
|
364
462
|
```
|
|
365
463
|
|
|
366
|
-
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
464
|
+
_See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/import/index.ts)_
|
|
367
465
|
|
|
368
466
|
## `hereya init PROJECT`
|
|
369
467
|
|
|
@@ -389,7 +487,7 @@ EXAMPLES
|
|
|
389
487
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
390
488
|
```
|
|
391
489
|
|
|
392
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
490
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/init/index.ts)_
|
|
393
491
|
|
|
394
492
|
## `hereya login [URL]`
|
|
395
493
|
|
|
@@ -418,7 +516,7 @@ EXAMPLES
|
|
|
418
516
|
$ hereya login --token=your-token https://cloud.hereya.dev
|
|
419
517
|
```
|
|
420
518
|
|
|
421
|
-
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
519
|
+
_See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/login/index.ts)_
|
|
422
520
|
|
|
423
521
|
## `hereya logout`
|
|
424
522
|
|
|
@@ -435,7 +533,7 @@ EXAMPLES
|
|
|
435
533
|
$ hereya logout
|
|
436
534
|
```
|
|
437
535
|
|
|
438
|
-
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
536
|
+
_See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/logout/index.ts)_
|
|
439
537
|
|
|
440
538
|
## `hereya remove PACKAGE`
|
|
441
539
|
|
|
@@ -443,17 +541,18 @@ Remove a package from the project.
|
|
|
443
541
|
|
|
444
542
|
```
|
|
445
543
|
USAGE
|
|
446
|
-
$ hereya remove PACKAGE [--chdir <value>] [--debug]
|
|
544
|
+
$ hereya remove PACKAGE [--chdir <value>] [--debug] [-w <value>]
|
|
447
545
|
|
|
448
546
|
ARGUMENTS
|
|
449
547
|
PACKAGE Remove a previously added package.
|
|
450
548
|
|
|
451
549
|
FLAGS
|
|
452
|
-
--
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
550
|
+
-w, --workspace=<value> name of the workspace to remove the package from (defaults to current workspace)
|
|
551
|
+
--chdir=<value> Directory where the command will be executed.
|
|
552
|
+
If not specified, it defaults to the current working directory.
|
|
553
|
+
Alternatively, you can define the project root by setting the HEREYA_PROJECT_ROOT_DIR
|
|
554
|
+
environment variable.
|
|
555
|
+
--debug enable debug mode
|
|
457
556
|
|
|
458
557
|
DESCRIPTION
|
|
459
558
|
Remove a package from the project.
|
|
@@ -462,7 +561,7 @@ EXAMPLES
|
|
|
462
561
|
$ hereya remove cloudy/docker_postgres
|
|
463
562
|
```
|
|
464
563
|
|
|
465
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
564
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/remove/index.ts)_
|
|
466
565
|
|
|
467
566
|
## `hereya run CMD`
|
|
468
567
|
|
|
@@ -488,7 +587,7 @@ EXAMPLES
|
|
|
488
587
|
$ hereya run -w uat -- node index.js
|
|
489
588
|
```
|
|
490
589
|
|
|
491
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
590
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/run/index.ts)_
|
|
492
591
|
|
|
493
592
|
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
494
593
|
|
|
@@ -513,7 +612,7 @@ EXAMPLES
|
|
|
513
612
|
$ hereya unbootstrap local
|
|
514
613
|
```
|
|
515
614
|
|
|
516
|
-
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
615
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/unbootstrap/index.ts)_
|
|
517
616
|
|
|
518
617
|
## `hereya undeploy`
|
|
519
618
|
|
|
@@ -538,7 +637,7 @@ EXAMPLES
|
|
|
538
637
|
$ hereya undeploy
|
|
539
638
|
```
|
|
540
639
|
|
|
541
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
640
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/undeploy/index.ts)_
|
|
542
641
|
|
|
543
642
|
## `hereya up`
|
|
544
643
|
|
|
@@ -565,7 +664,7 @@ EXAMPLES
|
|
|
565
664
|
$ hereya up
|
|
566
665
|
```
|
|
567
666
|
|
|
568
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
667
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/up/index.ts)_
|
|
569
668
|
|
|
570
669
|
## `hereya workspace create NAME`
|
|
571
670
|
|
|
@@ -589,7 +688,7 @@ EXAMPLES
|
|
|
589
688
|
$ hereya workspace create dev
|
|
590
689
|
```
|
|
591
690
|
|
|
592
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
691
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/create/index.ts)_
|
|
593
692
|
|
|
594
693
|
## `hereya workspace delete NAME`
|
|
595
694
|
|
|
@@ -609,7 +708,7 @@ EXAMPLES
|
|
|
609
708
|
$ hereya workspace delete dev
|
|
610
709
|
```
|
|
611
710
|
|
|
612
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
711
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/delete/index.ts)_
|
|
613
712
|
|
|
614
713
|
## `hereya workspace env [NAME]`
|
|
615
714
|
|
|
@@ -635,7 +734,7 @@ EXAMPLES
|
|
|
635
734
|
$ hereya workspace env myEnv -w dev
|
|
636
735
|
```
|
|
637
736
|
|
|
638
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
737
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/env/index.ts)_
|
|
639
738
|
|
|
640
739
|
## `hereya workspace env set`
|
|
641
740
|
|
|
@@ -659,7 +758,7 @@ EXAMPLES
|
|
|
659
758
|
$ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
|
|
660
759
|
```
|
|
661
760
|
|
|
662
|
-
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
761
|
+
_See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/env/set/index.ts)_
|
|
663
762
|
|
|
664
763
|
## `hereya workspace env unset`
|
|
665
764
|
|
|
@@ -680,7 +779,7 @@ EXAMPLES
|
|
|
680
779
|
$ hereya workspace env unset -w my-workspace -n myVar
|
|
681
780
|
```
|
|
682
781
|
|
|
683
|
-
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
782
|
+
_See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/env/unset/index.ts)_
|
|
684
783
|
|
|
685
784
|
## `hereya workspace install PACKAGE`
|
|
686
785
|
|
|
@@ -707,7 +806,7 @@ EXAMPLES
|
|
|
707
806
|
$ hereya workspace install hereya/aws-cognito
|
|
708
807
|
```
|
|
709
808
|
|
|
710
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
809
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/install/index.ts)_
|
|
711
810
|
|
|
712
811
|
## `hereya workspace list`
|
|
713
812
|
|
|
@@ -724,7 +823,7 @@ EXAMPLES
|
|
|
724
823
|
$ hereya workspace list
|
|
725
824
|
```
|
|
726
825
|
|
|
727
|
-
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
826
|
+
_See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/list/index.ts)_
|
|
728
827
|
|
|
729
828
|
## `hereya workspace set-profile PROFILE`
|
|
730
829
|
|
|
@@ -747,7 +846,7 @@ EXAMPLES
|
|
|
747
846
|
$ hereya workspace set-profile prod-profile -w production
|
|
748
847
|
```
|
|
749
848
|
|
|
750
|
-
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
849
|
+
_See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/set-profile/index.ts)_
|
|
751
850
|
|
|
752
851
|
## `hereya workspace uninstall PACKAGE`
|
|
753
852
|
|
|
@@ -774,5 +873,5 @@ EXAMPLES
|
|
|
774
873
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
775
874
|
```
|
|
776
875
|
|
|
777
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
876
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.47.0/src/commands/workspace/uninstall/index.ts)_
|
|
778
877
|
<!-- commandsstop -->
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '../../lib/config/common.js';
|
|
2
|
-
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput, UpdateWorkspaceInput, UpdateWorkspaceOutput } from '../common.js';
|
|
2
|
+
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteStateInput, DeleteStateOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput, UpdateWorkspaceInput, UpdateWorkspaceOutput } from '../common.js';
|
|
3
3
|
interface CloudBackendConfig {
|
|
4
4
|
accessToken: string;
|
|
5
5
|
clientId: string;
|
|
@@ -11,6 +11,7 @@ export declare class CloudBackend implements Backend {
|
|
|
11
11
|
constructor(config: CloudBackendConfig);
|
|
12
12
|
addPackageToWorkspace(input: AddPackageToWorkspaceInput): Promise<AddPackageToWorkspaceOutput>;
|
|
13
13
|
createWorkspace(input: CreateWorkspaceInput): Promise<CreateWorkspaceOutput>;
|
|
14
|
+
deleteState(input: DeleteStateInput): Promise<DeleteStateOutput>;
|
|
14
15
|
deleteWorkspace(input: DeleteWorkspaceInput): Promise<DeleteWorkspaceOutput>;
|
|
15
16
|
exportBackend(): Promise<ExportBackendOutput>;
|
|
16
17
|
getProvisioningId(input: GetProvisioningIdInput): Promise<GetProvisioningIdOutput>;
|
|
@@ -60,6 +60,24 @@ export class CloudBackend {
|
|
|
60
60
|
workspace: this.convertWorkspace(result.workspace),
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
+
async deleteState(input) {
|
|
64
|
+
const response = await fetch(`${this.config.url}/api/projects/${encodeURIComponent(input.project)}/state/${encodeURIComponent(input.workspace)}`, {
|
|
65
|
+
headers: {
|
|
66
|
+
'Authorization': `Bearer ${this.config.accessToken}`,
|
|
67
|
+
},
|
|
68
|
+
method: 'DELETE',
|
|
69
|
+
});
|
|
70
|
+
if (!response.ok) {
|
|
71
|
+
return {
|
|
72
|
+
reason: JSON.stringify(await response.json()),
|
|
73
|
+
success: false,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
message: `State for project ${input.project} in workspace ${input.workspace} deleted successfully`,
|
|
78
|
+
success: true,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
63
81
|
async deleteWorkspace(input) {
|
|
64
82
|
const response = await fetch(`${this.config.url}/api/workspaces/${encodeURIComponent(input.name)}`, {
|
|
65
83
|
headers: {
|
package/dist/backend/common.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Config } from '../lib/config/common.js';
|
|
|
4
4
|
export interface Backend {
|
|
5
5
|
addPackageToWorkspace(input: AddPackageToWorkspaceInput): Promise<AddPackageToWorkspaceOutput>;
|
|
6
6
|
createWorkspace(input: CreateWorkspaceInput): Promise<CreateWorkspaceOutput>;
|
|
7
|
+
deleteState(input: DeleteStateInput): Promise<DeleteStateOutput>;
|
|
7
8
|
deleteWorkspace(input: DeleteWorkspaceInput): Promise<DeleteWorkspaceOutput>;
|
|
8
9
|
exportBackend(): Promise<ExportBackendOutput>;
|
|
9
10
|
getProvisioningId(input: GetProvisioningIdInput): Promise<GetProvisioningIdOutput>;
|
|
@@ -159,6 +160,17 @@ export type DeleteWorkspaceOutput = {
|
|
|
159
160
|
reason: string;
|
|
160
161
|
success: false;
|
|
161
162
|
};
|
|
163
|
+
export type DeleteStateInput = {
|
|
164
|
+
project: string;
|
|
165
|
+
workspace: string;
|
|
166
|
+
};
|
|
167
|
+
export type DeleteStateOutput = {
|
|
168
|
+
message?: string;
|
|
169
|
+
success: true;
|
|
170
|
+
} | {
|
|
171
|
+
reason: string;
|
|
172
|
+
success: false;
|
|
173
|
+
};
|
|
162
174
|
export type GetProvisioningIdInput = {
|
|
163
175
|
logicalId: string;
|
|
164
176
|
packageCanonicalName: string;
|
|
@@ -8,7 +8,7 @@ export class LocalFileStorage {
|
|
|
8
8
|
}
|
|
9
9
|
async deleteFile(input) {
|
|
10
10
|
const filePaths = input.paths.map((p) => path.join(this.basePath, p));
|
|
11
|
-
await Promise.all(filePaths.map(async (filePath) => {
|
|
11
|
+
const results = await Promise.all(filePaths.map(async (filePath) => {
|
|
12
12
|
try {
|
|
13
13
|
if (await fileExists(filePath)) {
|
|
14
14
|
await fs.unlink(filePath);
|
|
@@ -18,8 +18,16 @@ export class LocalFileStorage {
|
|
|
18
18
|
catch {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
+
return false;
|
|
21
22
|
}));
|
|
22
|
-
|
|
23
|
+
const anyDeleted = results.includes(true);
|
|
24
|
+
if (anyDeleted) {
|
|
25
|
+
return { success: true };
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
error: 'No files found to delete',
|
|
29
|
+
success: false
|
|
30
|
+
};
|
|
23
31
|
}
|
|
24
32
|
async getFileContent(input) {
|
|
25
33
|
const filePaths = input.paths.map((p) => path.join(this.basePath, p));
|
package/dist/backend/file.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Config } from '../lib/config/common.js';
|
|
2
|
-
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput, UpdateWorkspaceInput, UpdateWorkspaceOutput } from './common.js';
|
|
2
|
+
import { AddPackageToWorkspaceInput, AddPackageToWorkspaceOutput, Backend, CreateWorkspaceInput, CreateWorkspaceOutput, DeleteStateInput, DeleteStateOutput, DeleteWorkspaceInput, DeleteWorkspaceOutput, ExportBackendOutput, GetProvisioningIdInput, GetProvisioningIdOutput, GetStateInput, GetStateOutput, GetWorkspaceEnvInput, GetWorkspaceEnvOutput, GetWorkspaceOutput, ImportBackendInput, ImportBackendOutput, InitProjectInput, InitProjectOutput, RemovePackageFromWorkspaceInput, RemovePackageFromWorkspaceOutput, SetEnvVarInput, SetEnvVarOutput, UnsetEnvVarInput, UnsetEnvVarOutput, UpdateWorkspaceInput, UpdateWorkspaceOutput } from './common.js';
|
|
3
3
|
import { FileStorage } from './file-storage/common.js';
|
|
4
4
|
export declare class FileBackend implements Backend {
|
|
5
5
|
private readonly fileStorage;
|
|
6
6
|
constructor(fileStorage: FileStorage);
|
|
7
7
|
addPackageToWorkspace(input: AddPackageToWorkspaceInput): Promise<AddPackageToWorkspaceOutput>;
|
|
8
8
|
createWorkspace(input: CreateWorkspaceInput): Promise<CreateWorkspaceOutput>;
|
|
9
|
+
deleteState(input: DeleteStateInput): Promise<DeleteStateOutput>;
|
|
9
10
|
deleteWorkspace(input: DeleteWorkspaceInput): Promise<DeleteWorkspaceOutput>;
|
|
10
11
|
exportBackend(): Promise<ExportBackendOutput>;
|
|
11
12
|
getProvisioningId(input: GetProvisioningIdInput): Promise<GetProvisioningIdOutput>;
|
package/dist/backend/file.js
CHANGED
|
@@ -104,6 +104,23 @@ export class FileBackend {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
+
async deleteState(input) {
|
|
108
|
+
const paths = [
|
|
109
|
+
['state', 'projects', input.workspace, `${input.project}.yaml`].join('/'),
|
|
110
|
+
['state', 'projects', input.workspace, `${input.project}.yml`].join('/'),
|
|
111
|
+
];
|
|
112
|
+
const result = await this.fileStorage.deleteFile({ paths });
|
|
113
|
+
if (result.success) {
|
|
114
|
+
return {
|
|
115
|
+
message: `State for project ${input.project} in workspace ${input.workspace} deleted successfully`,
|
|
116
|
+
success: true,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
reason: result.error ?? 'Failed to delete state file',
|
|
121
|
+
success: false,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
107
124
|
async deleteWorkspace(input) {
|
|
108
125
|
const workspace$ = await this.getWorkspace(input.name);
|
|
109
126
|
if (!workspace$.found) {
|
|
@@ -9,6 +9,7 @@ export default class Add extends Command {
|
|
|
9
9
|
chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
parameter: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
};
|
|
13
14
|
run(): Promise<void>;
|
|
14
15
|
}
|
|
@@ -42,6 +42,11 @@ export default class Add extends Command {
|
|
|
42
42
|
description: "parameter for the package, in the form of 'key=value'. Can be specified multiple times.",
|
|
43
43
|
multiple: true,
|
|
44
44
|
}),
|
|
45
|
+
workspace: Flags.string({
|
|
46
|
+
char: 'w',
|
|
47
|
+
description: 'name of the workspace to add the package to (defaults to current workspace)',
|
|
48
|
+
required: false,
|
|
49
|
+
}),
|
|
45
50
|
};
|
|
46
51
|
async run() {
|
|
47
52
|
const { args, flags } = await this.parse(Add);
|
|
@@ -66,6 +71,8 @@ export default class Add extends Command {
|
|
|
66
71
|
throw new Error("Project not initialized. Run 'hereya init' first.");
|
|
67
72
|
}
|
|
68
73
|
ctx.configOutput = loadConfigOutput;
|
|
74
|
+
// Use workspace from flag if provided, otherwise use config workspace
|
|
75
|
+
ctx.workspace = flags.workspace || loadConfigOutput.config.workspace;
|
|
69
76
|
task.output = `Loaded project config`;
|
|
70
77
|
await delay(500);
|
|
71
78
|
},
|
|
@@ -76,7 +83,7 @@ export default class Add extends Command {
|
|
|
76
83
|
const userSpecifiedParameters = arrayOfStringToObject(ctx.userSpecifiedParameters);
|
|
77
84
|
const parameterManager = getParameterManager();
|
|
78
85
|
const backend = await getBackend();
|
|
79
|
-
const profile = await getProfileFromWorkspace(backend, ctx.
|
|
86
|
+
const profile = await getProfileFromWorkspace(backend, ctx.workspace);
|
|
80
87
|
const parametersOutput = await parameterManager.getPackageParameters({
|
|
81
88
|
package: ctx.package,
|
|
82
89
|
profile,
|
|
@@ -105,7 +112,7 @@ export default class Add extends Command {
|
|
|
105
112
|
project: ctx.configOutput.config.project,
|
|
106
113
|
projectRootDir,
|
|
107
114
|
skipDeploy: true,
|
|
108
|
-
workspace: ctx.
|
|
115
|
+
workspace: ctx.workspace,
|
|
109
116
|
});
|
|
110
117
|
if (!provisionOutput.success) {
|
|
111
118
|
throw new Error(provisionOutput.reason);
|
|
@@ -122,7 +129,7 @@ export default class Add extends Command {
|
|
|
122
129
|
env,
|
|
123
130
|
infra: metadata.originalInfra ?? metadata.infra,
|
|
124
131
|
projectRootDir,
|
|
125
|
-
workspace: ctx.
|
|
132
|
+
workspace: ctx.workspace,
|
|
126
133
|
});
|
|
127
134
|
await delay(500);
|
|
128
135
|
},
|
|
@@ -145,13 +152,13 @@ export default class Add extends Command {
|
|
|
145
152
|
const backend = await getBackend();
|
|
146
153
|
const configManager = getConfigManager();
|
|
147
154
|
const { config: newConfig } = await configManager.loadConfig({ projectRootDir });
|
|
148
|
-
await backend.saveState(newConfig);
|
|
155
|
+
await backend.saveState(newConfig, ctx.workspace);
|
|
149
156
|
const parameterManager = getParameterManager();
|
|
150
157
|
const { filePath, saved } = await parameterManager.savePackageParameters({
|
|
151
158
|
package: ctx.package,
|
|
152
159
|
parameters: ctx.parametersOutput.parameters,
|
|
153
160
|
projectRootDir,
|
|
154
|
-
workspace: ctx.
|
|
161
|
+
workspace: ctx.workspace,
|
|
155
162
|
});
|
|
156
163
|
await delay(500);
|
|
157
164
|
if (saved) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class DeleteState extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
chdir: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|