hereya-cli 0.44.0 → 0.45.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.44.0 linux-x64 node-v22.17.1
23
+ hereya-cli/0.45.0 linux-x64 node-v22.17.1
24
24
  $ hereya --help [COMMAND]
25
25
  USAGE
26
26
  $ hereya COMMAND
@@ -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.44.0/src/commands/add/index.ts)_
93
+ _See code: [src/commands/add/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/bootstrap/index.ts)_
118
+ _See code: [src/commands/bootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/config/export-backend/index.ts)_
140
+ _See code: [src/commands/config/export-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/config/get-backend/index.ts)_
157
+ _See code: [src/commands/config/get-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/config/import-backend/index.ts)_
177
+ _See code: [src/commands/config/import-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/config/use-backend/index.ts)_
199
+ _See code: [src/commands/config/use-backend/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/deploy/index.ts)_
224
+ _See code: [src/commands/deploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/down/index.ts)_
251
+ _See code: [src/commands/down/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/env/index.ts)_
282
+ _See code: [src/commands/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/env/set/index.ts)_
309
+ _See code: [src/commands/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.0/src/commands/env/set/index.ts)_
310
310
 
311
311
  ## `hereya help [COMMAND]`
312
312
 
@@ -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.44.0/src/commands/import/index.ts)_
366
+ _See code: [src/commands/import/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/init/index.ts)_
392
+ _See code: [src/commands/init/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/login/index.ts)_
421
+ _See code: [src/commands/login/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/logout/index.ts)_
438
+ _See code: [src/commands/logout/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/remove/index.ts)_
465
+ _See code: [src/commands/remove/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/run/index.ts)_
491
+ _See code: [src/commands/run/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/unbootstrap/index.ts)_
516
+ _See code: [src/commands/unbootstrap/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/undeploy/index.ts)_
541
+ _See code: [src/commands/undeploy/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/up/index.ts)_
568
+ _See code: [src/commands/up/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/workspace/create/index.ts)_
592
+ _See code: [src/commands/workspace/create/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/workspace/delete/index.ts)_
612
+ _See code: [src/commands/workspace/delete/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/workspace/env/index.ts)_
638
+ _See code: [src/commands/workspace/env/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/workspace/env/set/index.ts)_
662
+ _See code: [src/commands/workspace/env/set/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/workspace/env/unset/index.ts)_
683
+ _See code: [src/commands/workspace/env/unset/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/workspace/install/index.ts)_
710
+ _See code: [src/commands/workspace/install/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/workspace/list/index.ts)_
727
+ _See code: [src/commands/workspace/list/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/workspace/set-profile/index.ts)_
750
+ _See code: [src/commands/workspace/set-profile/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.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.44.0/src/commands/workspace/uninstall/index.ts)_
777
+ _See code: [src/commands/workspace/uninstall/index.ts](https://github.com/hereya/hereya-cli/blob/v0.45.0/src/commands/workspace/uninstall/index.ts)_
778
778
  <!-- commandsstop -->
@@ -54,9 +54,12 @@ export default class Deploy extends Command {
54
54
  },
55
55
  {
56
56
  async task(ctx) {
57
+ const backend = await getBackend();
58
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace);
57
59
  const envManager = getEnvManager();
58
60
  const getProjectEnvOutput = await envManager.getProjectEnv({
59
61
  markSecret: true,
62
+ profile,
60
63
  projectRootDir,
61
64
  workspace: ctx.workspace,
62
65
  });
@@ -275,9 +278,12 @@ export default class Deploy extends Command {
275
278
  {
276
279
  skip: (ctx) => ctx.deployPackages.length === 0,
277
280
  async task(ctx, task) {
281
+ const backend = await getBackend();
282
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace);
278
283
  const envManager = getEnvManager();
279
284
  const getProjectEnvOutput = await envManager.getProjectEnv({
280
285
  markSecret: true,
286
+ profile,
281
287
  projectRootDir,
282
288
  workspace: ctx.workspace,
283
289
  });
@@ -1,7 +1,9 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
+ import { getBackend } from '../../backend/index.js';
2
3
  import { getConfigManager } from '../../lib/config/index.js';
3
4
  import { logEnv } from '../../lib/env-utils.js';
4
5
  import { getEnvManager } from '../../lib/env/index.js';
6
+ import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
5
7
  export default class Env extends Command {
6
8
  static args = {
7
9
  name: Args.string({ description: 'name of the env to display', required: false }),
@@ -46,8 +48,11 @@ export default class Env extends Command {
46
48
  if (!workspace) {
47
49
  this.error('you must specify a workspace to print the env vars for');
48
50
  }
51
+ const backend = await getBackend();
52
+ const profile = await getProfileFromWorkspace(backend, workspace);
49
53
  const envManager = getEnvManager();
50
54
  const getProjectEnvOutput = await envManager.getProjectEnv({
55
+ profile,
51
56
  projectRootDir,
52
57
  workspace,
53
58
  });
@@ -1,6 +1,8 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
+ import { getBackend } from '../../backend/index.js';
2
3
  import { getConfigManager } from '../../lib/config/index.js';
3
4
  import { getEnvManager } from '../../lib/env/index.js';
5
+ import { getProfileFromWorkspace } from '../../lib/profile-utils.js';
4
6
  import { runShell } from '../../lib/shell.js';
5
7
  export default class Run extends Command {
6
8
  static args = {
@@ -40,8 +42,11 @@ export default class Run extends Command {
40
42
  if (!workspace) {
41
43
  this.error('you must specify a workspace to run the command in');
42
44
  }
45
+ const backend = await getBackend();
46
+ const profile = await getProfileFromWorkspace(backend, workspace);
43
47
  const envManager = getEnvManager();
44
48
  const getProjectEnvOutput = await envManager.getProjectEnv({
49
+ profile,
45
50
  projectRootDir,
46
51
  workspace,
47
52
  });
@@ -55,9 +55,12 @@ export default class Undeploy extends Command {
55
55
  },
56
56
  {
57
57
  async task(ctx) {
58
+ const backend = await getBackend();
59
+ const profile = await getProfileFromWorkspace(backend, ctx.workspace);
58
60
  const envManager = getEnvManager();
59
61
  const getProjectEnvOutput = await envManager.getProjectEnv({
60
62
  markSecret: true,
63
+ profile,
61
64
  projectRootDir,
62
65
  workspace: ctx.workspace,
63
66
  });
@@ -4,8 +4,10 @@ export declare class EnvManager {
4
4
  getProjectEnv(input: GetProjectEnvInput): Promise<GetProjectEnvOutput>;
5
5
  getStaticEnvDir(projectRootDir?: string): Promise<string>;
6
6
  removeProjectEnv(input: RemoveEnvInput): Promise<void>;
7
+ private extractProfileSections;
7
8
  private getEnvPath;
8
9
  private getUserEnvPaths;
10
+ private loadFirstDocument;
9
11
  }
10
12
  export declare const envManager: EnvManager;
11
13
  export declare function getEnvManager(): EnvManager;
@@ -20,6 +22,7 @@ export type AddEnvInput = {
20
22
  export type RemoveEnvInput = AddEnvInput;
21
23
  export type GetProjectEnvInput = {
22
24
  markSecret?: boolean;
25
+ profile: string;
23
26
  projectRootDir?: string;
24
27
  workspace: string;
25
28
  };
@@ -1,7 +1,8 @@
1
+ import fs from 'node:fs/promises';
1
2
  import path from 'node:path';
2
3
  import { getExecutor } from '../../executor/index.js';
3
4
  import { getAnyPath } from '../filesystem.js';
4
- import { load, save } from '../yaml-utils.js';
5
+ import { load, parseYaml, save } from '../yaml-utils.js';
5
6
  export class EnvManager {
6
7
  async addProjectEnv(input) {
7
8
  const envPath = await this.getEnvPath(input);
@@ -25,10 +26,24 @@ export class EnvManager {
25
26
  if (found) {
26
27
  resolvedEnv = await executor.resolveEnvValues({ env, markSecret: input.markSecret });
27
28
  }
28
- const userEnvs = await this.getUserEnvPaths(input).then((paths) => Promise.all(paths.map((path) => load(path))));
29
+ const userEnvPaths = await this.getUserEnvPaths(input.profile, input.projectRootDir);
29
30
  let userMergedEnv = {};
30
- for (const { data } of userEnvs) {
31
- userMergedEnv = { ...userMergedEnv, ...data };
31
+ // First load the base env.yaml (first document only)
32
+ if (userEnvPaths[0]) {
33
+ const baseEnv = await this.loadFirstDocument(userEnvPaths[0]);
34
+ if (baseEnv) {
35
+ userMergedEnv = { ...userMergedEnv, ...baseEnv };
36
+ }
37
+ }
38
+ // Then merge profile-specific env file
39
+ const profileFileEnv = await load(userEnvPaths[1]);
40
+ if (profileFileEnv.data) {
41
+ userMergedEnv = { ...userMergedEnv, ...profileFileEnv.data };
42
+ }
43
+ // Finally, extract and merge profile sections from env.yaml
44
+ const profileSections = await this.extractProfileSections(userEnvPaths[0], input.profile);
45
+ if (profileSections) {
46
+ userMergedEnv = { ...userMergedEnv, ...profileSections };
32
47
  }
33
48
  const finalEnv = { ...resolvedEnv, ...userMergedEnv };
34
49
  return { env: finalEnv, success: true };
@@ -46,16 +61,61 @@ export class EnvManager {
46
61
  const finalEnv = Object.fromEntries(Object.entries(existingEnv).filter(([key]) => !envKeysToRemove.includes(key)));
47
62
  await save(finalEnv, envPath);
48
63
  }
64
+ async extractProfileSections(filePath, targetProfile) {
65
+ if (!filePath)
66
+ return null;
67
+ try {
68
+ // Check if file exists first
69
+ await fs.access(filePath);
70
+ const content = await fs.readFile(filePath, 'utf8');
71
+ const documents = content.split(/^---$/m);
72
+ // Parse all documents in parallel
73
+ const parsedDocs = await Promise.all(documents.slice(1).map(async (doc) => {
74
+ if (!doc.trim())
75
+ return null;
76
+ const { data } = await parseYaml(doc);
77
+ return data;
78
+ }));
79
+ // Find matching profile document
80
+ for (const data of parsedDocs) {
81
+ if (data && data.profile === targetProfile) {
82
+ // Remove the profile field and return the rest
83
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
84
+ const { profile, ...envVars } = data;
85
+ return envVars;
86
+ }
87
+ }
88
+ }
89
+ catch {
90
+ // Ignore errors, return null
91
+ }
92
+ return null;
93
+ }
49
94
  async getEnvPath(input) {
50
95
  return getAnyPath(path.join(input.projectRootDir ?? process.cwd(), '.hereya', `env.${input.workspace}.yaml`), path.join(input.projectRootDir ?? process.cwd(), '.hereya', `env.${input.workspace}.yml`));
51
96
  }
52
- async getUserEnvPaths(input) {
97
+ async getUserEnvPaths(profile, projectRootDir) {
53
98
  const paths = await Promise.all([
54
- getAnyPath(path.join(await this.getStaticEnvDir(input.projectRootDir), `env.yaml`), path.join(await this.getStaticEnvDir(input.projectRootDir), `env.yml`)),
55
- getAnyPath(path.join(await this.getStaticEnvDir(input.projectRootDir), `env.${input.workspace}.yaml`), path.join(await this.getStaticEnvDir(input.projectRootDir), `env.${input.workspace}.yml`)),
99
+ getAnyPath(path.join(await this.getStaticEnvDir(projectRootDir), `env.yaml`), path.join(await this.getStaticEnvDir(projectRootDir), `env.yml`)),
100
+ getAnyPath(path.join(await this.getStaticEnvDir(projectRootDir), `env.${profile}.yaml`), path.join(await this.getStaticEnvDir(projectRootDir), `env.${profile}.yml`)),
56
101
  ]);
57
102
  return paths;
58
103
  }
104
+ async loadFirstDocument(filePath) {
105
+ try {
106
+ await fs.access(filePath);
107
+ const content = await fs.readFile(filePath, 'utf8');
108
+ // Split by document separator and take only the first document
109
+ const firstDoc = content.split(/^---$/m)[0];
110
+ if (!firstDoc.trim())
111
+ return null;
112
+ const { data } = await parseYaml(firstDoc);
113
+ return data;
114
+ }
115
+ catch {
116
+ return null;
117
+ }
118
+ }
59
119
  }
60
120
  export const envManager = new EnvManager();
61
121
  export function getEnvManager() {
@@ -1317,5 +1317,5 @@
1317
1317
  ]
1318
1318
  }
1319
1319
  },
1320
- "version": "0.44.0"
1320
+ "version": "0.45.0"
1321
1321
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hereya-cli",
3
3
  "description": "Infrastructure as Package",
4
- "version": "0.44.0",
4
+ "version": "0.45.0",
5
5
  "author": "Hereya Developers",
6
6
  "bin": {
7
7
  "hereya": "./bin/run.js"