hereya-cli 0.11.0 → 0.12.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.11.0 linux-x64 node-v22.12.0
23
+ hereya-cli/0.12.0 linux-x64 node-v22.12.0
24
24
  $ hereya --help [COMMAND]
25
25
  USAGE
26
26
  $ hereya COMMAND
@@ -72,7 +72,7 @@ EXAMPLES
72
72
  $ hereya add cloudy/docker_postgres
73
73
  ```
74
74
 
75
- _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/add/index.ts)_
75
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/add/index.ts)_
76
76
 
77
77
  ## `hereya bootstrap INFRASTRUCTURETYPE`
78
78
 
@@ -97,7 +97,7 @@ EXAMPLES
97
97
  $ hereya bootstrap local
98
98
  ```
99
99
 
100
- _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/bootstrap/index.ts)_
100
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/bootstrap/index.ts)_
101
101
 
102
102
  ## `hereya deploy`
103
103
 
@@ -118,7 +118,7 @@ EXAMPLES
118
118
  $ hereya deploy
119
119
  ```
120
120
 
121
- _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/deploy/index.ts)_
121
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/deploy/index.ts)_
122
122
 
123
123
  ## `hereya down`
124
124
 
@@ -140,7 +140,7 @@ EXAMPLES
140
140
  $ hereya down
141
141
  ```
142
142
 
143
- _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/down/index.ts)_
143
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/down/index.ts)_
144
144
 
145
145
  ## `hereya env [NAME]`
146
146
 
@@ -171,7 +171,7 @@ EXAMPLES
171
171
  $ hereya env -w dev -l
172
172
  ```
173
173
 
174
- _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/env/index.ts)_
174
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/env/index.ts)_
175
175
 
176
176
  ## `hereya help [COMMAND]`
177
177
 
@@ -217,7 +217,7 @@ EXAMPLES
217
217
  $ hereya init myProject -w=defaultWorkspace --chdir=./myProject
218
218
  ```
219
219
 
220
- _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/init/index.ts)_
220
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/init/index.ts)_
221
221
 
222
222
  ## `hereya remove PACKAGE`
223
223
 
@@ -240,7 +240,7 @@ EXAMPLES
240
240
  $ hereya remove cloudy/docker_postgres
241
241
  ```
242
242
 
243
- _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/remove/index.ts)_
243
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/remove/index.ts)_
244
244
 
245
245
  ## `hereya run CMD`
246
246
 
@@ -266,7 +266,7 @@ EXAMPLES
266
266
  $ hereya run -w uat -- node index.js
267
267
  ```
268
268
 
269
- _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/run/index.ts)_
269
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/run/index.ts)_
270
270
 
271
271
  ## `hereya unbootstrap INFRASTRUCTURETYPE`
272
272
 
@@ -291,7 +291,7 @@ EXAMPLES
291
291
  $ hereya unbootstrap local
292
292
  ```
293
293
 
294
- _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/unbootstrap/index.ts)_
294
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/unbootstrap/index.ts)_
295
295
 
296
296
  ## `hereya undeploy`
297
297
 
@@ -312,7 +312,7 @@ EXAMPLES
312
312
  $ hereya undeploy
313
313
  ```
314
314
 
315
- _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/undeploy/index.ts)_
315
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/undeploy/index.ts)_
316
316
 
317
317
  ## `hereya up`
318
318
 
@@ -334,7 +334,7 @@ EXAMPLES
334
334
  $ hereya up
335
335
  ```
336
336
 
337
- _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/up/index.ts)_
337
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/up/index.ts)_
338
338
 
339
339
  ## `hereya workspace create NAME`
340
340
 
@@ -354,7 +354,7 @@ EXAMPLES
354
354
  $ hereya workspace create dev
355
355
  ```
356
356
 
357
- _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/workspace/create/index.ts)_
357
+ _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/workspace/create/index.ts)_
358
358
 
359
359
  ## `hereya workspace delete NAME`
360
360
 
@@ -374,7 +374,7 @@ EXAMPLES
374
374
  $ hereya workspace delete dev
375
375
  ```
376
376
 
377
- _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/workspace/delete/index.ts)_
377
+ _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/workspace/delete/index.ts)_
378
378
 
379
379
  ## `hereya workspace env [NAME]`
380
380
 
@@ -400,7 +400,7 @@ EXAMPLES
400
400
  $ hereya workspace env myEnv -w dev
401
401
  ```
402
402
 
403
- _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/workspace/env/index.ts)_
403
+ _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/workspace/env/index.ts)_
404
404
 
405
405
  ## `hereya workspace env set`
406
406
 
@@ -424,7 +424,7 @@ EXAMPLES
424
424
  $ hereya workspace env set -w my-workspace -n myVar -v my-value -i aws -s
425
425
  ```
426
426
 
427
- _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/workspace/env/set/index.ts)_
427
+ _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/workspace/env/set/index.ts)_
428
428
 
429
429
  ## `hereya workspace env unset`
430
430
 
@@ -445,7 +445,7 @@ EXAMPLES
445
445
  $ hereya workspace env unset -w my-workspace -n myVar
446
446
  ```
447
447
 
448
- _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/workspace/env/unset/index.ts)_
448
+ _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/workspace/env/unset/index.ts)_
449
449
 
450
450
  ## `hereya workspace install PACKAGE`
451
451
 
@@ -471,7 +471,7 @@ EXAMPLES
471
471
  $ hereya workspace install hereya/aws-cognito
472
472
  ```
473
473
 
474
- _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/workspace/install/index.ts)_
474
+ _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/workspace/install/index.ts)_
475
475
 
476
476
  ## `hereya workspace uninstall PACKAGE`
477
477
 
@@ -497,5 +497,5 @@ EXAMPLES
497
497
  $ hereya workspace uninstall hereya/aws-cognito
498
498
  ```
499
499
 
500
- _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.11.0/src/commands/workspace/uninstall/index.ts)_
500
+ _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.12.0/src/commands/workspace/uninstall/index.ts)_
501
501
  <!-- commandsstop -->
@@ -4,7 +4,10 @@ export interface Iac {
4
4
  }
5
5
  export declare enum IacType {
6
6
  cdk = "cdk",
7
- terraform = "terraform"
7
+ opentf = "opentf",
8
+ opentofu = "opentofu",
9
+ terraform = "terraform",
10
+ tofu = "tofu"
8
11
  }
9
12
  export type ApplyInput = {
10
13
  env: {
@@ -1,5 +1,8 @@
1
1
  export var IacType;
2
2
  (function (IacType) {
3
3
  IacType["cdk"] = "cdk";
4
+ IacType["opentf"] = "opentf";
5
+ IacType["opentofu"] = "opentofu";
4
6
  IacType["terraform"] = "terraform";
7
+ IacType["tofu"] = "tofu";
5
8
  })(IacType || (IacType = {}));
package/dist/iac/index.js CHANGED
@@ -8,6 +8,15 @@ export function getIac({ type }) {
8
8
  case IacType.terraform: {
9
9
  return { iac: terraform, supported: true };
10
10
  }
11
+ case IacType.opentofu: {
12
+ return { iac: terraform, supported: true };
13
+ }
14
+ case IacType.opentf: {
15
+ return { iac: terraform, supported: true };
16
+ }
17
+ case IacType.tofu: {
18
+ return { iac: terraform, supported: true };
19
+ }
11
20
  case IacType.cdk: {
12
21
  return { iac: cdk, supported: true };
13
22
  }
@@ -2,8 +2,9 @@ import { ApplyInput, ApplyOutput, DestroyInput, DestroyOutput, Iac } from './com
2
2
  export declare class Terraform implements Iac {
3
3
  apply(input: ApplyInput): Promise<ApplyOutput>;
4
4
  destroy(input: DestroyInput): Promise<DestroyOutput>;
5
- private downloadTerraform;
5
+ downloadTerraform(): Promise<boolean>;
6
6
  private getEnv;
7
7
  private getTerraformBinary;
8
+ private getWithRedirect;
8
9
  private terraformBinPath;
9
10
  }
@@ -114,20 +114,20 @@ export class Terraform {
114
114
  }
115
115
  async downloadTerraform() {
116
116
  const TERRAFORM_DOWNLOAD_URLS = new Map([
117
- ['darwin_arm64', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_darwin_arm64.zip'],
118
- ['darwin_x64', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_darwin_amd64.zip'],
119
- ['freebsd_arm', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_freebsd_arm.zip'],
120
- ['freebsd_ia32', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_freebsd_386.zip'],
121
- ['freebsd_x64', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_freebsd_amd64.zip'],
122
- ['linux_arm', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_arm.zip'],
123
- ['linux_arm64', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_arm64.zip'],
124
- ['linux_ia32', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_386.zip'],
125
- ['linux_x64', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_amd64.zip'],
126
- ['openbsd_ia32', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_openbsd_386.zip'],
127
- ['openbsd_x64', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_openbsd_amd64.zip'],
128
- ['sunos_x64', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_solaris_amd64.zip'],
129
- ['win32_ia32', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_windows_386.zip'],
130
- ['win32_x64', 'https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_windows_amd64.zip'],
117
+ ['darwin_arm64', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_darwin_arm64.zip'],
118
+ ['darwin_x64', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_darwin_amd64.zip'],
119
+ ['freebsd_arm', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_freebsd_arm.zip'],
120
+ ['freebsd_ia32', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_freebsd_386.zip'],
121
+ ['freebsd_x64', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_freebsd_amd64.zip'],
122
+ ['linux_arm', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_linux_arm.zip'],
123
+ ['linux_arm64', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_linux_arm64.zip'],
124
+ ['linux_ia32', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_linux_386.zip'],
125
+ ['linux_x64', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_linux_amd64.zip'],
126
+ ['openbsd_ia32', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_openbsd_386.zip'],
127
+ ['openbsd_x64', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_openbsd_amd64.zip'],
128
+ ['sunos_x64', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_solaris_amd64.zip'],
129
+ ['win32_ia32', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_windows_386.zip'],
130
+ ['win32_x64', 'https://github.com/opentofu/opentofu/releases/download/v1.9.0/tofu_1.9.0_windows_amd64.zip'],
131
131
  ]);
132
132
  const tfPath = this.terraformBinPath();
133
133
  try {
@@ -155,8 +155,7 @@ export class Terraform {
155
155
  }
156
156
  }
157
157
  await new Promise((resolve, reject) => {
158
- https
159
- .get(url, async (response) => {
158
+ this.getWithRedirect(url, async (response) => {
160
159
  try {
161
160
  await pipeline(response, decompress({ path: path.dirname(tfPath) }));
162
161
  await fs.promises.chmod(tfPath, '0755');
@@ -165,8 +164,7 @@ export class Terraform {
165
164
  throw new Error(`could not download terraform: ${error}`);
166
165
  }
167
166
  resolve(null);
168
- })
169
- .on('error', (error) => reject(error));
167
+ }, reject);
170
168
  });
171
169
  return true;
172
170
  }
@@ -192,7 +190,22 @@ export class Terraform {
192
190
  await this.downloadTerraform();
193
191
  return this.terraformBinPath();
194
192
  }
193
+ async getWithRedirect(url, handler, reject) {
194
+ https
195
+ .get(url, (response) => {
196
+ if (response.statusCode === 302) {
197
+ const { location } = response.headers;
198
+ if (location) {
199
+ this.getWithRedirect(location, handler, reject);
200
+ }
201
+ }
202
+ else {
203
+ handler(response);
204
+ }
205
+ })
206
+ .on('error', (error) => reject(error));
207
+ }
195
208
  terraformBinPath() {
196
- return path.join(os.homedir(), '.hereya', 'iac', 'terraform', os.platform() === 'win32' ? 'terraform.exe' : 'terraform');
209
+ return path.join(os.homedir(), '.hereya', 'iac', 'terraform', 'tofu_1', os.platform() === 'win32' ? 'tofu.exe' : 'tofu');
197
210
  }
198
211
  }
@@ -535,6 +535,37 @@
535
535
  "index.js"
536
536
  ]
537
537
  },
538
+ "workspace:delete": {
539
+ "aliases": [],
540
+ "args": {
541
+ "name": {
542
+ "description": "name of the workspace to delete",
543
+ "name": "name",
544
+ "required": true
545
+ }
546
+ },
547
+ "description": "Delete a workspace if it exists.",
548
+ "examples": [
549
+ "<%= config.bin %> <%= command.id %> dev"
550
+ ],
551
+ "flags": {},
552
+ "hasDynamicHelp": false,
553
+ "hiddenAliases": [],
554
+ "id": "workspace:delete",
555
+ "pluginAlias": "hereya-cli",
556
+ "pluginName": "hereya-cli",
557
+ "pluginType": "core",
558
+ "strict": true,
559
+ "enableJsonFlag": false,
560
+ "isESM": true,
561
+ "relativePath": [
562
+ "dist",
563
+ "commands",
564
+ "workspace",
565
+ "delete",
566
+ "index.js"
567
+ ]
568
+ },
538
569
  "workspace:env": {
539
570
  "aliases": [],
540
571
  "args": {
@@ -585,37 +616,6 @@
585
616
  "index.js"
586
617
  ]
587
618
  },
588
- "workspace:delete": {
589
- "aliases": [],
590
- "args": {
591
- "name": {
592
- "description": "name of the workspace to delete",
593
- "name": "name",
594
- "required": true
595
- }
596
- },
597
- "description": "Delete a workspace if it exists.",
598
- "examples": [
599
- "<%= config.bin %> <%= command.id %> dev"
600
- ],
601
- "flags": {},
602
- "hasDynamicHelp": false,
603
- "hiddenAliases": [],
604
- "id": "workspace:delete",
605
- "pluginAlias": "hereya-cli",
606
- "pluginName": "hereya-cli",
607
- "pluginType": "core",
608
- "strict": true,
609
- "enableJsonFlag": false,
610
- "isESM": true,
611
- "relativePath": [
612
- "dist",
613
- "commands",
614
- "workspace",
615
- "delete",
616
- "index.js"
617
- ]
618
- },
619
619
  "workspace:install": {
620
620
  "aliases": [],
621
621
  "args": {
@@ -848,5 +848,5 @@
848
848
  ]
849
849
  }
850
850
  },
851
- "version": "0.11.0"
851
+ "version": "0.12.0"
852
852
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hereya-cli",
3
3
  "description": "Infrastructure as Package",
4
- "version": "0.11.0",
4
+ "version": "0.12.0",
5
5
  "author": "Hereya Developers",
6
6
  "bin": {
7
7
  "hereya": "./bin/run.js"