hereya-cli 0.6.4 → 0.7.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 +44 -18
- package/dist/commands/bootstrap/index.js +1 -1
- package/dist/commands/unbootstrap/index.d.ts +12 -0
- package/dist/commands/unbootstrap/index.js +28 -0
- package/dist/infrastructure/aws.d.ts +1 -0
- package/dist/infrastructure/aws.js +18 -1
- package/dist/infrastructure/common.d.ts +1 -0
- package/dist/infrastructure/local.d.ts +1 -0
- package/dist/infrastructure/local.js +3 -0
- package/oclif.manifest.json +41 -2
- 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.7.0 linux-x64 node-v20.14.0
|
|
24
24
|
$ hereya --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ hereya COMMAND
|
|
@@ -39,6 +39,7 @@ USAGE
|
|
|
39
39
|
* [`hereya remote exec [PKGPATH]`](#hereya-remote-exec-pkgpath)
|
|
40
40
|
* [`hereya remove PACKAGE`](#hereya-remove-package)
|
|
41
41
|
* [`hereya run CMD`](#hereya-run-cmd)
|
|
42
|
+
* [`hereya unbootstrap INFRASTRUCTURETYPE`](#hereya-unbootstrap-infrastructuretype)
|
|
42
43
|
* [`hereya undeploy`](#hereya-undeploy)
|
|
43
44
|
* [`hereya up`](#hereya-up)
|
|
44
45
|
* [`hereya workspace create NAME`](#hereya-workspace-create-name)
|
|
@@ -70,7 +71,7 @@ EXAMPLES
|
|
|
70
71
|
$ hereya add cloudy/docker_postgres
|
|
71
72
|
```
|
|
72
73
|
|
|
73
|
-
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
74
|
+
_See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/add/index.ts)_
|
|
74
75
|
|
|
75
76
|
## `hereya bootstrap INFRASTRUCTURETYPE`
|
|
76
77
|
|
|
@@ -81,7 +82,7 @@ USAGE
|
|
|
81
82
|
$ hereya bootstrap INFRASTRUCTURETYPE [-f]
|
|
82
83
|
|
|
83
84
|
ARGUMENTS
|
|
84
|
-
INFRASTRUCTURETYPE infrastructure to bootstrap. Options are local, aws
|
|
85
|
+
INFRASTRUCTURETYPE infrastructure to bootstrap. Options are local, aws
|
|
85
86
|
|
|
86
87
|
FLAGS
|
|
87
88
|
-f, --force redeploy hereya resources if already deployed
|
|
@@ -95,7 +96,7 @@ EXAMPLES
|
|
|
95
96
|
$ hereya bootstrap local
|
|
96
97
|
```
|
|
97
98
|
|
|
98
|
-
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
99
|
+
_See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/bootstrap/index.ts)_
|
|
99
100
|
|
|
100
101
|
## `hereya deploy`
|
|
101
102
|
|
|
@@ -116,7 +117,7 @@ EXAMPLES
|
|
|
116
117
|
$ hereya deploy
|
|
117
118
|
```
|
|
118
119
|
|
|
119
|
-
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
120
|
+
_See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/deploy/index.ts)_
|
|
120
121
|
|
|
121
122
|
## `hereya down`
|
|
122
123
|
|
|
@@ -138,7 +139,7 @@ EXAMPLES
|
|
|
138
139
|
$ hereya down
|
|
139
140
|
```
|
|
140
141
|
|
|
141
|
-
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
142
|
+
_See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/down/index.ts)_
|
|
142
143
|
|
|
143
144
|
## `hereya env [NAME]`
|
|
144
145
|
|
|
@@ -169,7 +170,7 @@ EXAMPLES
|
|
|
169
170
|
$ hereya env -w dev -l
|
|
170
171
|
```
|
|
171
172
|
|
|
172
|
-
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
173
|
+
_See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/env/index.ts)_
|
|
173
174
|
|
|
174
175
|
## `hereya help [COMMAND]`
|
|
175
176
|
|
|
@@ -215,7 +216,7 @@ EXAMPLES
|
|
|
215
216
|
$ hereya init myProject -w=defaultWorkspace --chdir=./myProject
|
|
216
217
|
```
|
|
217
218
|
|
|
218
|
-
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
219
|
+
_See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/init/index.ts)_
|
|
219
220
|
|
|
220
221
|
## `hereya remote exec [PKGPATH]`
|
|
221
222
|
|
|
@@ -239,7 +240,7 @@ EXAMPLES
|
|
|
239
240
|
$ hereya remote exec
|
|
240
241
|
```
|
|
241
242
|
|
|
242
|
-
_See code: [src/commands/remote/exec/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
243
|
+
_See code: [src/commands/remote/exec/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/remote/exec/index.ts)_
|
|
243
244
|
|
|
244
245
|
## `hereya remove PACKAGE`
|
|
245
246
|
|
|
@@ -262,7 +263,7 @@ EXAMPLES
|
|
|
262
263
|
$ hereya remove cloudy/docker_postgres
|
|
263
264
|
```
|
|
264
265
|
|
|
265
|
-
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
266
|
+
_See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/remove/index.ts)_
|
|
266
267
|
|
|
267
268
|
## `hereya run CMD`
|
|
268
269
|
|
|
@@ -288,7 +289,32 @@ EXAMPLES
|
|
|
288
289
|
$ hereya run -w uat -- node index.js
|
|
289
290
|
```
|
|
290
291
|
|
|
291
|
-
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
292
|
+
_See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/run/index.ts)_
|
|
293
|
+
|
|
294
|
+
## `hereya unbootstrap INFRASTRUCTURETYPE`
|
|
295
|
+
|
|
296
|
+
Uninstall hereya resources deployed with bootstrap command.
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
USAGE
|
|
300
|
+
$ hereya unbootstrap INFRASTRUCTURETYPE [-f]
|
|
301
|
+
|
|
302
|
+
ARGUMENTS
|
|
303
|
+
INFRASTRUCTURETYPE infrastructure to unbootstrap. Options are local, aws
|
|
304
|
+
|
|
305
|
+
FLAGS
|
|
306
|
+
-f, --force try to delete hereya resources even if not deployed
|
|
307
|
+
|
|
308
|
+
DESCRIPTION
|
|
309
|
+
Uninstall hereya resources deployed with bootstrap command.
|
|
310
|
+
|
|
311
|
+
EXAMPLES
|
|
312
|
+
$ hereya unbootstrap aws
|
|
313
|
+
|
|
314
|
+
$ hereya unbootstrap local
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
_See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/unbootstrap/index.ts)_
|
|
292
318
|
|
|
293
319
|
## `hereya undeploy`
|
|
294
320
|
|
|
@@ -309,7 +335,7 @@ EXAMPLES
|
|
|
309
335
|
$ hereya undeploy
|
|
310
336
|
```
|
|
311
337
|
|
|
312
|
-
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
338
|
+
_See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/undeploy/index.ts)_
|
|
313
339
|
|
|
314
340
|
## `hereya up`
|
|
315
341
|
|
|
@@ -331,7 +357,7 @@ EXAMPLES
|
|
|
331
357
|
$ hereya up
|
|
332
358
|
```
|
|
333
359
|
|
|
334
|
-
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
360
|
+
_See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/up/index.ts)_
|
|
335
361
|
|
|
336
362
|
## `hereya workspace create NAME`
|
|
337
363
|
|
|
@@ -351,7 +377,7 @@ EXAMPLES
|
|
|
351
377
|
$ hereya workspace create dev
|
|
352
378
|
```
|
|
353
379
|
|
|
354
|
-
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
380
|
+
_See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/workspace/create/index.ts)_
|
|
355
381
|
|
|
356
382
|
## `hereya workspace delete NAME`
|
|
357
383
|
|
|
@@ -371,7 +397,7 @@ EXAMPLES
|
|
|
371
397
|
$ hereya workspace delete dev
|
|
372
398
|
```
|
|
373
399
|
|
|
374
|
-
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
400
|
+
_See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/workspace/delete/index.ts)_
|
|
375
401
|
|
|
376
402
|
## `hereya workspace env [NAME]`
|
|
377
403
|
|
|
@@ -397,7 +423,7 @@ EXAMPLES
|
|
|
397
423
|
$ hereya workspace env myEnv -w dev
|
|
398
424
|
```
|
|
399
425
|
|
|
400
|
-
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
426
|
+
_See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/workspace/env/index.ts)_
|
|
401
427
|
|
|
402
428
|
## `hereya workspace install PACKAGE`
|
|
403
429
|
|
|
@@ -423,7 +449,7 @@ EXAMPLES
|
|
|
423
449
|
$ hereya workspace install hereya/aws-cognito
|
|
424
450
|
```
|
|
425
451
|
|
|
426
|
-
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
452
|
+
_See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/workspace/install/index.ts)_
|
|
427
453
|
|
|
428
454
|
## `hereya workspace uninstall PACKAGE`
|
|
429
455
|
|
|
@@ -449,5 +475,5 @@ EXAMPLES
|
|
|
449
475
|
$ hereya workspace uninstall hereya/aws-cognito
|
|
450
476
|
```
|
|
451
477
|
|
|
452
|
-
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.
|
|
478
|
+
_See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.7.0/src/commands/workspace/uninstall/index.ts)_
|
|
453
479
|
<!-- commandsstop -->
|
|
@@ -3,7 +3,7 @@ import { getInfrastructure } from '../../infrastructure/index.js';
|
|
|
3
3
|
export default class Bootstrap extends Command {
|
|
4
4
|
static args = {
|
|
5
5
|
infrastructureType: Args.string({
|
|
6
|
-
description: 'infrastructure to bootstrap. Options are local, aws
|
|
6
|
+
description: 'infrastructure to bootstrap. Options are local, aws',
|
|
7
7
|
required: true
|
|
8
8
|
})
|
|
9
9
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class Unbootstrap extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
infrastructureType: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
force: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import { getInfrastructure } from '../../infrastructure/index.js';
|
|
3
|
+
export default class Unbootstrap extends Command {
|
|
4
|
+
static args = {
|
|
5
|
+
infrastructureType: Args.string({
|
|
6
|
+
description: 'infrastructure to unbootstrap. Options are local, aws',
|
|
7
|
+
required: true
|
|
8
|
+
})
|
|
9
|
+
};
|
|
10
|
+
static description = 'Uninstall hereya resources deployed with bootstrap command.';
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> <%= command.id %> aws',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> local',
|
|
14
|
+
];
|
|
15
|
+
static flags = {
|
|
16
|
+
force: Flags.boolean({ char: 'f', description: 'try to delete hereya resources even if not deployed' }),
|
|
17
|
+
};
|
|
18
|
+
async run() {
|
|
19
|
+
const { args, flags } = await this.parse(Unbootstrap);
|
|
20
|
+
const infrastructure$ = getInfrastructure({ type: args.infrastructureType });
|
|
21
|
+
if (!infrastructure$.supported) {
|
|
22
|
+
this.warn(infrastructure$.reason);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const { infrastructure } = infrastructure$;
|
|
26
|
+
await infrastructure.unbootstrap({ force: flags.force });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -6,6 +6,7 @@ export declare class AwsInfrastructure implements Infrastructure {
|
|
|
6
6
|
provision(input: ProvisionInput): Promise<ProvisionOutput>;
|
|
7
7
|
resolveEnv(input: ResolveEnvInput): Promise<ResolveEnvOutput>;
|
|
8
8
|
saveEnv(input: SaveEnvInput): Promise<SaveEnvOutput>;
|
|
9
|
+
unbootstrap(_: BootstrapInput): Promise<void>;
|
|
9
10
|
undeploy(input: UndeployInput): Promise<UndeployOutput>;
|
|
10
11
|
private getEnv;
|
|
11
12
|
private getFilesToUpload;
|
|
@@ -13,7 +13,7 @@ import { fileExists, getAnyPath } from '../lib/filesystem.js';
|
|
|
13
13
|
import { objectToBase64 } from '../lib/object-utils.js';
|
|
14
14
|
import { runShell } from '../lib/shell.js';
|
|
15
15
|
import { InfrastructureType } from './common.js';
|
|
16
|
-
import { provisionPackage } from './index.js';
|
|
16
|
+
import { destroyPackage, provisionPackage } from './index.js';
|
|
17
17
|
export class AwsInfrastructure {
|
|
18
18
|
async bootstrap(_) {
|
|
19
19
|
const stsClient = new STSClient({});
|
|
@@ -129,6 +129,23 @@ export class AwsInfrastructure {
|
|
|
129
129
|
return { reason: error.message, success: false };
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
+
async unbootstrap(_) {
|
|
133
|
+
const ssmClient = new SSMClient({});
|
|
134
|
+
const key = '/hereya-bootstrap/config';
|
|
135
|
+
try {
|
|
136
|
+
await ssmClient.send(new DeleteParameterCommand({
|
|
137
|
+
Name: key,
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
console.log(`Could not delete parameter "${key}": ${error.message}. Continuing with unbootstrap...`);
|
|
142
|
+
}
|
|
143
|
+
const bootstrapPackage = 'hereya/bootstrap-aws-stack';
|
|
144
|
+
const output = await destroyPackage({ package: bootstrapPackage });
|
|
145
|
+
if (!output.success) {
|
|
146
|
+
throw new Error(output.reason);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
132
149
|
async undeploy(input) {
|
|
133
150
|
let files = [];
|
|
134
151
|
let s3Bucket = '';
|
|
@@ -12,6 +12,7 @@ export interface Infrastructure {
|
|
|
12
12
|
provision(input: ProvisionInput): Promise<ProvisionOutput>;
|
|
13
13
|
resolveEnv(input: ResolveEnvInput): Promise<ResolveEnvOutput>;
|
|
14
14
|
saveEnv(input: SaveEnvInput): Promise<SaveEnvOutput>;
|
|
15
|
+
unbootstrap(input: BootstrapInput): Promise<void>;
|
|
15
16
|
undeploy(input: UndeployInput): Promise<UndeployOutput>;
|
|
16
17
|
}
|
|
17
18
|
export type BootstrapInput = {
|
|
@@ -10,6 +10,7 @@ export declare class LocalInfrastructure implements Infrastructure {
|
|
|
10
10
|
value: string;
|
|
11
11
|
}>;
|
|
12
12
|
saveEnv(input: SaveEnvInput): Promise<SaveEnvOutput>;
|
|
13
|
+
unbootstrap(): Promise<void>;
|
|
13
14
|
undeploy(input: UndeployInput): Promise<UndeployOutput>;
|
|
14
15
|
private download;
|
|
15
16
|
private isNotEmpty;
|
|
@@ -64,6 +64,9 @@ export class LocalInfrastructure {
|
|
|
64
64
|
console.log(`Saving env to ${input.id}`);
|
|
65
65
|
return { success: true };
|
|
66
66
|
}
|
|
67
|
+
async unbootstrap() {
|
|
68
|
+
console.log('Unbootstrapping local infrastructure');
|
|
69
|
+
}
|
|
67
70
|
async undeploy(input) {
|
|
68
71
|
input.parameters = {
|
|
69
72
|
...input.parameters,
|
package/oclif.manifest.json
CHANGED
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"aliases": [],
|
|
53
53
|
"args": {
|
|
54
54
|
"infrastructureType": {
|
|
55
|
-
"description": "infrastructure to bootstrap. Options are local, aws
|
|
55
|
+
"description": "infrastructure to bootstrap. Options are local, aws",
|
|
56
56
|
"name": "infrastructureType",
|
|
57
57
|
"required": true
|
|
58
58
|
}
|
|
@@ -374,6 +374,45 @@
|
|
|
374
374
|
"index.js"
|
|
375
375
|
]
|
|
376
376
|
},
|
|
377
|
+
"unbootstrap": {
|
|
378
|
+
"aliases": [],
|
|
379
|
+
"args": {
|
|
380
|
+
"infrastructureType": {
|
|
381
|
+
"description": "infrastructure to unbootstrap. Options are local, aws",
|
|
382
|
+
"name": "infrastructureType",
|
|
383
|
+
"required": true
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"description": "Uninstall hereya resources deployed with bootstrap command.",
|
|
387
|
+
"examples": [
|
|
388
|
+
"<%= config.bin %> <%= command.id %> aws",
|
|
389
|
+
"<%= config.bin %> <%= command.id %> local"
|
|
390
|
+
],
|
|
391
|
+
"flags": {
|
|
392
|
+
"force": {
|
|
393
|
+
"char": "f",
|
|
394
|
+
"description": "try to delete hereya resources even if not deployed",
|
|
395
|
+
"name": "force",
|
|
396
|
+
"allowNo": false,
|
|
397
|
+
"type": "boolean"
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
"hasDynamicHelp": false,
|
|
401
|
+
"hiddenAliases": [],
|
|
402
|
+
"id": "unbootstrap",
|
|
403
|
+
"pluginAlias": "hereya-cli",
|
|
404
|
+
"pluginName": "hereya-cli",
|
|
405
|
+
"pluginType": "core",
|
|
406
|
+
"strict": true,
|
|
407
|
+
"enableJsonFlag": false,
|
|
408
|
+
"isESM": true,
|
|
409
|
+
"relativePath": [
|
|
410
|
+
"dist",
|
|
411
|
+
"commands",
|
|
412
|
+
"unbootstrap",
|
|
413
|
+
"index.js"
|
|
414
|
+
]
|
|
415
|
+
},
|
|
377
416
|
"undeploy": {
|
|
378
417
|
"aliases": [],
|
|
379
418
|
"args": {},
|
|
@@ -744,5 +783,5 @@
|
|
|
744
783
|
]
|
|
745
784
|
}
|
|
746
785
|
},
|
|
747
|
-
"version": "0.
|
|
786
|
+
"version": "0.7.0"
|
|
748
787
|
}
|