hereya-cli 0.29.0 → 0.31.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 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.29.0 linux-x64 node-v22.14.0
23
+ hereya-cli/0.31.0 linux-x64 node-v22.14.0
24
24
  $ hereya --help [COMMAND]
25
25
  USAGE
26
26
  $ hereya COMMAND
@@ -82,7 +82,7 @@ EXAMPLES
82
82
  $ hereya add cloudy/docker_postgres
83
83
  ```
84
84
 
85
- _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/add/index.ts)_
85
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/add/index.ts)_
86
86
 
87
87
  ## `hereya bootstrap INFRASTRUCTURETYPE`
88
88
 
@@ -107,7 +107,7 @@ EXAMPLES
107
107
  $ hereya bootstrap local
108
108
  ```
109
109
 
110
- _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/bootstrap/index.ts)_
110
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/bootstrap/index.ts)_
111
111
 
112
112
  ## `hereya deploy`
113
113
 
@@ -132,7 +132,7 @@ EXAMPLES
132
132
  $ hereya deploy
133
133
  ```
134
134
 
135
- _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/deploy/index.ts)_
135
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/deploy/index.ts)_
136
136
 
137
137
  ## `hereya down`
138
138
 
@@ -159,7 +159,7 @@ EXAMPLES
159
159
  $ hereya down
160
160
  ```
161
161
 
162
- _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/down/index.ts)_
162
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/down/index.ts)_
163
163
 
164
164
  ## `hereya env [NAME]`
165
165
 
@@ -190,7 +190,7 @@ EXAMPLES
190
190
  $ hereya env -w dev -l
191
191
  ```
192
192
 
193
- _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/env/index.ts)_
193
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/env/index.ts)_
194
194
 
195
195
  ## `hereya env set [NAME]`
196
196
 
@@ -217,7 +217,7 @@ EXAMPLES
217
217
  $ hereya env set FOO -v bar -w dev
218
218
  ```
219
219
 
220
- _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/env/set/index.ts)_
220
+ _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/env/set/index.ts)_
221
221
 
222
222
  ## `hereya help [COMMAND]`
223
223
 
@@ -263,7 +263,7 @@ EXAMPLES
263
263
  $ hereya init myProject -w=defaultWorkspace --chdir=./myProject
264
264
  ```
265
265
 
266
- _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/init/index.ts)_
266
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/init/index.ts)_
267
267
 
268
268
  ## `hereya remove PACKAGE`
269
269
 
@@ -290,7 +290,7 @@ EXAMPLES
290
290
  $ hereya remove cloudy/docker_postgres
291
291
  ```
292
292
 
293
- _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/remove/index.ts)_
293
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/remove/index.ts)_
294
294
 
295
295
  ## `hereya run CMD`
296
296
 
@@ -316,7 +316,7 @@ EXAMPLES
316
316
  $ hereya run -w uat -- node index.js
317
317
  ```
318
318
 
319
- _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/run/index.ts)_
319
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/run/index.ts)_
320
320
 
321
321
  ## `hereya unbootstrap INFRASTRUCTURETYPE`
322
322
 
@@ -341,7 +341,7 @@ EXAMPLES
341
341
  $ hereya unbootstrap local
342
342
  ```
343
343
 
344
- _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/unbootstrap/index.ts)_
344
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/unbootstrap/index.ts)_
345
345
 
346
346
  ## `hereya undeploy`
347
347
 
@@ -366,7 +366,7 @@ EXAMPLES
366
366
  $ hereya undeploy
367
367
  ```
368
368
 
369
- _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/undeploy/index.ts)_
369
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/undeploy/index.ts)_
370
370
 
371
371
  ## `hereya up`
372
372
 
@@ -393,7 +393,7 @@ EXAMPLES
393
393
  $ hereya up
394
394
  ```
395
395
 
396
- _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/up/index.ts)_
396
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/up/index.ts)_
397
397
 
398
398
  ## `hereya workspace create NAME`
399
399
 
@@ -416,7 +416,7 @@ EXAMPLES
416
416
  $ hereya workspace create dev
417
417
  ```
418
418
 
419
- _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/workspace/create/index.ts)_
419
+ _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/workspace/create/index.ts)_
420
420
 
421
421
  ## `hereya workspace delete NAME`
422
422
 
@@ -436,7 +436,7 @@ EXAMPLES
436
436
  $ hereya workspace delete dev
437
437
  ```
438
438
 
439
- _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/workspace/delete/index.ts)_
439
+ _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/workspace/delete/index.ts)_
440
440
 
441
441
  ## `hereya workspace env [NAME]`
442
442
 
@@ -462,7 +462,7 @@ EXAMPLES
462
462
  $ hereya workspace env myEnv -w dev
463
463
  ```
464
464
 
465
- _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/workspace/env/index.ts)_
465
+ _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/workspace/env/index.ts)_
466
466
 
467
467
  ## `hereya workspace env set`
468
468
 
@@ -486,7 +486,7 @@ EXAMPLES
486
486
  $ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
487
487
  ```
488
488
 
489
- _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/workspace/env/set/index.ts)_
489
+ _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/workspace/env/set/index.ts)_
490
490
 
491
491
  ## `hereya workspace env unset`
492
492
 
@@ -507,7 +507,7 @@ EXAMPLES
507
507
  $ hereya workspace env unset -w my-workspace -n myVar
508
508
  ```
509
509
 
510
- _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/workspace/env/unset/index.ts)_
510
+ _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/workspace/env/unset/index.ts)_
511
511
 
512
512
  ## `hereya workspace install PACKAGE`
513
513
 
@@ -534,7 +534,7 @@ EXAMPLES
534
534
  $ hereya workspace install hereya/aws-cognito
535
535
  ```
536
536
 
537
- _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/workspace/install/index.ts)_
537
+ _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/workspace/install/index.ts)_
538
538
 
539
539
  ## `hereya workspace list`
540
540
 
@@ -551,7 +551,7 @@ EXAMPLES
551
551
  $ hereya workspace list
552
552
  ```
553
553
 
554
- _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/workspace/list/index.ts)_
554
+ _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/workspace/list/index.ts)_
555
555
 
556
556
  ## `hereya workspace uninstall PACKAGE`
557
557
 
@@ -578,5 +578,5 @@ EXAMPLES
578
578
  $ hereya workspace uninstall hereya/aws-cognito
579
579
  ```
580
580
 
581
- _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.29.0/src/commands/workspace/uninstall/index.ts)_
581
+ _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.31.0/src/commands/workspace/uninstall/index.ts)_
582
582
  <!-- commandsstop -->
@@ -35,20 +35,20 @@ export declare const WorkspaceSchema: z.ZodObject<{
35
35
  name: string;
36
36
  id: string;
37
37
  env?: Record<string, string> | undefined;
38
- mirrorOf?: string | undefined;
39
38
  packages?: Record<string, {
40
39
  version: string;
41
40
  parameters?: Record<string, any> | undefined;
42
41
  }> | undefined;
42
+ mirrorOf?: string | undefined;
43
43
  }, {
44
44
  name: string;
45
45
  id: string;
46
46
  env?: Record<string, string> | undefined;
47
- mirrorOf?: string | undefined;
48
47
  packages?: Record<string, {
49
48
  version: string;
50
49
  parameters?: Record<string, any> | undefined;
51
50
  }> | undefined;
51
+ mirrorOf?: string | undefined;
52
52
  }>;
53
53
  export type Workspace = z.infer<typeof WorkspaceSchema>;
54
54
  export type AddPackageToWorkspaceInput = {
@@ -147,14 +147,14 @@ export class LocalBackend {
147
147
  };
148
148
  }
149
149
  async getProvisioningId(input) {
150
- const lookupStorepath = await getAnyPath(path.join(os.homedir(), '.hereya', `provisioning.yaml`), path.join(os.homedir(), '.hereya', `provisioning.yml`));
151
- const { data, found } = await load(lookupStorepath);
152
- if (!found || !data[input.logicalId]) {
153
- data[input.logicalId] = `p-${randomUUID()}`;
154
- await save(data, lookupStorepath);
150
+ const idFilePath = await getAnyPath(path.join(os.homedir(), '.hereya', 'provisioning', `${input.logicalId}.yaml`), path.join(os.homedir(), '.hereya', 'provisioning', `${input.logicalId}.yml`));
151
+ const { data, found } = await load(idFilePath);
152
+ if (!found || !data.id) {
153
+ data.id = `p-${randomUUID()}`;
154
+ await save(data, idFilePath);
155
155
  }
156
156
  return {
157
- id: data[input.logicalId],
157
+ id: data.id,
158
158
  success: true,
159
159
  };
160
160
  }
@@ -3,11 +3,10 @@ import { DeleteParameterCommand, GetParameterCommand, PutParameterCommand, SSMCl
3
3
  import { GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts';
4
4
  import { randomUUID } from 'node:crypto';
5
5
  import fs from 'node:fs/promises';
6
- import os from 'node:os';
7
- import path from 'node:path';
8
6
  import { getIac } from '../iac/index.js';
9
7
  import { downloadPackage } from '../lib/package/index.js';
10
8
  import { runShell } from '../lib/shell.js';
9
+ import { getPackageDownloadPath } from './common.js';
11
10
  import { destroyPackage, provisionPackage } from './index.js';
12
11
  export class AwsInfrastructure {
13
12
  configKey = '/hereya-bootstrap/config';
@@ -41,7 +40,7 @@ export class AwsInfrastructure {
41
40
  return this.provision(input);
42
41
  }
43
42
  async destroy(input) {
44
- const destPath = path.join(os.homedir(), '.hereya', input.id, input.canonicalName);
43
+ const destPath = await getPackageDownloadPath(input);
45
44
  const downloadPath = await downloadPackage(input.pkgUrl, destPath);
46
45
  const region = process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION;
47
46
  const infraConfig = {
@@ -75,7 +74,7 @@ export class AwsInfrastructure {
75
74
  return { env: output.env, success: true };
76
75
  }
77
76
  async provision(input) {
78
- const destPath = path.join(os.homedir(), '.hereya', input.id, input.canonicalName);
77
+ const destPath = await getPackageDownloadPath(input);
79
78
  const downloadPath = await downloadPackage(input.pkgUrl, destPath);
80
79
  const config = await this.getConfig();
81
80
  const terraformStateBucketRegion = config.terraformStateBucketRegion || process.env.AWS_REGION || process.env.AWS_DEFAULT_REGION;
@@ -18,6 +18,9 @@ export interface Infrastructure {
18
18
  undeploy(input: UndeployInput): Promise<UndeployOutput>;
19
19
  unstoreEnv(input: UnstoreEnvInput): Promise<UnstoreEnvOutput>;
20
20
  }
21
+ export declare function getPackageDownloadPath(input: {
22
+ id: string;
23
+ }): Promise<string>;
21
24
  export type BootstrapInput = {
22
25
  force?: boolean;
23
26
  };
@@ -1,3 +1,5 @@
1
+ import os from 'node:os';
2
+ import path from 'node:path';
1
3
  export var InfrastructureType;
2
4
  (function (InfrastructureType) {
3
5
  InfrastructureType["aws"] = "aws";
@@ -5,3 +7,6 @@ export var InfrastructureType;
5
7
  InfrastructureType["gcp"] = "gcp";
6
8
  InfrastructureType["local"] = "local";
7
9
  })(InfrastructureType || (InfrastructureType = {}));
10
+ export async function getPackageDownloadPath(input) {
11
+ return path.join(os.homedir(), '.hereya', 'packages', input.id);
12
+ }
@@ -1,8 +1,7 @@
1
1
  import * as fs from 'node:fs/promises';
2
- import * as os from 'node:os';
3
- import path from 'node:path';
4
2
  import { getIac } from '../iac/index.js';
5
3
  import { downloadPackage } from '../lib/package/index.js';
4
+ import { getPackageDownloadPath, } from './common.js';
6
5
  export class LocalInfrastructure {
7
6
  async bootstrap() {
8
7
  console.log('Bootstrapping local infrastructure');
@@ -16,8 +15,7 @@ export class LocalInfrastructure {
16
15
  return this.provision(input);
17
16
  }
18
17
  async destroy(input) {
19
- // noinspection DuplicatedCode
20
- const destPath = path.join(os.homedir(), '.hereya', 'provisioning', input.id, input.canonicalName);
18
+ const destPath = await getPackageDownloadPath(input);
21
19
  const downloadPath = await downloadPackage(input.pkgUrl, destPath);
22
20
  const iac$ = getIac({ type: input.iacType });
23
21
  if (!iac$.supported) {
@@ -39,8 +37,7 @@ export class LocalInfrastructure {
39
37
  return { env: output.env, success: true };
40
38
  }
41
39
  async provision(input) {
42
- // noinspection DuplicatedCode
43
- const destPath = path.join(os.homedir(), '.hereya', 'provisioning', input.id, input.canonicalName);
40
+ const destPath = await getPackageDownloadPath(input);
44
41
  const downloadPath = await downloadPackage(input.pkgUrl, destPath);
45
42
  const iac$ = getIac({ type: input.iacType });
46
43
  if (!iac$.supported) {
@@ -407,6 +407,45 @@
407
407
  "index.js"
408
408
  ]
409
409
  },
410
+ "unbootstrap": {
411
+ "aliases": [],
412
+ "args": {
413
+ "infrastructureType": {
414
+ "description": "infrastructure to unbootstrap. Options are local, aws",
415
+ "name": "infrastructureType",
416
+ "required": true
417
+ }
418
+ },
419
+ "description": "Uninstall hereya resources deployed with bootstrap command.",
420
+ "examples": [
421
+ "<%= config.bin %> <%= command.id %> aws",
422
+ "<%= config.bin %> <%= command.id %> local"
423
+ ],
424
+ "flags": {
425
+ "force": {
426
+ "char": "f",
427
+ "description": "try to delete hereya resources even if not deployed",
428
+ "name": "force",
429
+ "allowNo": false,
430
+ "type": "boolean"
431
+ }
432
+ },
433
+ "hasDynamicHelp": false,
434
+ "hiddenAliases": [],
435
+ "id": "unbootstrap",
436
+ "pluginAlias": "hereya-cli",
437
+ "pluginName": "hereya-cli",
438
+ "pluginType": "core",
439
+ "strict": true,
440
+ "enableJsonFlag": false,
441
+ "isESM": true,
442
+ "relativePath": [
443
+ "dist",
444
+ "commands",
445
+ "unbootstrap",
446
+ "index.js"
447
+ ]
448
+ },
410
449
  "undeploy": {
411
450
  "aliases": [],
412
451
  "args": {},
@@ -455,45 +494,6 @@
455
494
  "index.js"
456
495
  ]
457
496
  },
458
- "unbootstrap": {
459
- "aliases": [],
460
- "args": {
461
- "infrastructureType": {
462
- "description": "infrastructure to unbootstrap. Options are local, aws",
463
- "name": "infrastructureType",
464
- "required": true
465
- }
466
- },
467
- "description": "Uninstall hereya resources deployed with bootstrap command.",
468
- "examples": [
469
- "<%= config.bin %> <%= command.id %> aws",
470
- "<%= config.bin %> <%= command.id %> local"
471
- ],
472
- "flags": {
473
- "force": {
474
- "char": "f",
475
- "description": "try to delete hereya resources even if not deployed",
476
- "name": "force",
477
- "allowNo": false,
478
- "type": "boolean"
479
- }
480
- },
481
- "hasDynamicHelp": false,
482
- "hiddenAliases": [],
483
- "id": "unbootstrap",
484
- "pluginAlias": "hereya-cli",
485
- "pluginName": "hereya-cli",
486
- "pluginType": "core",
487
- "strict": true,
488
- "enableJsonFlag": false,
489
- "isESM": true,
490
- "relativePath": [
491
- "dist",
492
- "commands",
493
- "unbootstrap",
494
- "index.js"
495
- ]
496
- },
497
497
  "up": {
498
498
  "aliases": [],
499
499
  "args": {},
@@ -1006,5 +1006,5 @@
1006
1006
  ]
1007
1007
  }
1008
1008
  },
1009
- "version": "0.29.0"
1009
+ "version": "0.31.0"
1010
1010
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hereya-cli",
3
3
  "description": "Infrastructure as Package",
4
- "version": "0.29.0",
4
+ "version": "0.31.0",
5
5
  "author": "Hereya Developers",
6
6
  "bin": {
7
7
  "hereya": "./bin/run.js"