@storm-software/terraform-tools 0.53.1 → 0.53.3

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-6D4LV6X2.js → chunk-2YZ3MY7Z.js} +3 -3
  4. package/dist/{chunk-FLEOXRFA.js → chunk-BDNXCOYM.js} +2 -2
  5. package/dist/{chunk-ZOKR7XCK.mjs → chunk-CJUII4ME.mjs} +10 -8
  6. package/dist/{chunk-42WVFPO6.mjs → chunk-COZQPQN4.mjs} +103 -50
  7. package/dist/{chunk-ZTLSR2U3.mjs → chunk-FAMG3LBJ.mjs} +1 -1
  8. package/dist/{chunk-D6CRGFE3.mjs → chunk-JMMGQ3VC.mjs} +1 -1
  9. package/dist/{chunk-KBT4UFBN.mjs → chunk-M7TZCVBI.mjs} +1 -1
  10. package/dist/{chunk-TQAFH5OJ.js → chunk-OAZ3OJPI.js} +121 -68
  11. package/dist/{chunk-IMGISWCA.mjs → chunk-ODKOOHVU.mjs} +1 -1
  12. package/dist/{chunk-JEBWKJI3.js → chunk-P4DYHSWV.js} +2 -2
  13. package/dist/{chunk-MJMNVCOX.js → chunk-QYC5T3J3.js} +2 -2
  14. package/dist/{chunk-EMIZUK4F.mjs → chunk-YFYQLHFW.mjs} +1 -1
  15. package/dist/{chunk-WGRRG2DY.js → chunk-YIC7T6TB.js} +151 -149
  16. package/dist/{chunk-GEMICIUF.js → chunk-ZIUAOW5J.js} +2 -2
  17. package/dist/executors.js +6 -6
  18. package/dist/executors.mjs +6 -6
  19. package/dist/generators.js +3 -3
  20. package/dist/generators.mjs +2 -2
  21. package/dist/index.js +8 -8
  22. package/dist/index.mjs +7 -7
  23. package/dist/src/base/index.js +3 -3
  24. package/dist/src/base/index.mjs +2 -2
  25. package/dist/src/base/terraform-executor.d.mts +3 -3
  26. package/dist/src/base/terraform-executor.d.ts +3 -3
  27. package/dist/src/base/terraform-executor.js +3 -3
  28. package/dist/src/base/terraform-executor.mjs +2 -2
  29. package/dist/src/executors/apply/executor.js +4 -4
  30. package/dist/src/executors/apply/executor.mjs +3 -3
  31. package/dist/src/executors/destroy/executor.js +4 -4
  32. package/dist/src/executors/destroy/executor.mjs +3 -3
  33. package/dist/src/executors/output/executor.js +4 -4
  34. package/dist/src/executors/output/executor.mjs +3 -3
  35. package/dist/src/executors/plan/executor.js +4 -4
  36. package/dist/src/executors/plan/executor.mjs +3 -3
  37. package/dist/src/generators/init/init.js +3 -3
  38. package/dist/src/generators/init/init.mjs +2 -2
  39. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 0.53.3 (2025-01-22)
2
+
3
+ ### Miscellaneous
4
+
5
+ - **monorepo:** Update the workspace's `storm.json` config to use the new preset repository ([95067c70](https://github.com/storm-software/storm-ops/commit/95067c70))
6
+
7
+ ### 🧱 Updated Dependencies
8
+
9
+ - Updated workspace-tools to 1.239.6
10
+ - Updated workspace-tools to 1.239.6
11
+
12
+ ## 0.53.2 (2025-01-22)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **build-tools:** Resolved issue with copying asset files into output directory ([1b314e8e](https://github.com/storm-software/storm-ops/commit/1b314e8e))
17
+
18
+ ### 🧱 Updated Dependencies
19
+
20
+ - Updated workspace-tools to 1.239.4
21
+ - Updated workspace-tools to 1.239.4
22
+
1
23
  ## 0.53.1 (2025-01-22)
2
24
 
3
25
  ### Bug Fixes
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.53.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.53.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkTQAFH5OJjs = require('./chunk-TQAFH5OJ.js');
4
+ var _chunkOAZ3OJPIjs = require('./chunk-OAZ3OJPI.js');
5
5
 
6
6
 
7
7
  var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
@@ -9,7 +9,7 @@ var _chunk3GQAWCBQjs = require('./chunk-3GQAWCBQ.js');
9
9
  // src/base/terraform-executor.ts
10
10
  var _shelljs = require('shelljs');
11
11
  var withTerraformExecutor = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0, (command, executorOptions = {}) => async (_options, context) => {
12
- return _chunkTQAFH5OJjs.withRunExecutor.call(void 0, `Terraform \`${command}\` Command Executor`, async (options, context2, config) => {
12
+ return _chunkOAZ3OJPIjs.withRunExecutor.call(void 0, `Terraform \`${command}\` Command Executor`, async (options, context2, config) => {
13
13
  if (!_shelljs.which.call(void 0, "tofu") || !_shelljs.which.call(void 0, "terraform")) {
14
14
  throw new Error("Both OpenTofu and Terraform are not installed. Please install one of the two before running this executor.");
15
15
  }
@@ -21,7 +21,7 @@ var withTerraformExecutor = /* @__PURE__ */ _chunk3GQAWCBQjs.__name.call(void 0,
21
21
  if (typeof jsonBackendConfig === "string") {
22
22
  jsonBackendConfig = JSON.parse(jsonBackendConfig);
23
23
  }
24
- _chunkTQAFH5OJjs.run.call(void 0, config, [
24
+ _chunkOAZ3OJPIjs.run.call(void 0, config, [
25
25
  "terragrunt",
26
26
  command,
27
27
  ...jsonBackendConfig.map((config2) => `-backend-config="${config2.key}=${config2.name}"`),
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk6D4LV6X2js = require('./chunk-6D4LV6X2.js');
3
+ var _chunk2YZ3MY7Zjs = require('./chunk-2YZ3MY7Z.js');
4
4
 
5
5
  // src/executors/apply/executor.ts
6
- var executor_default = _chunk6D4LV6X2js.withTerraformExecutor.call(void 0, "apply");
6
+ var executor_default = _chunk2YZ3MY7Zjs.withTerraformExecutor.call(void 0, "apply");
7
7
 
8
8
 
9
9
 
@@ -4,10 +4,10 @@ import {
4
4
  applyWorkspaceTokens,
5
5
  correctPaths,
6
6
  findWorkspaceRoot,
7
+ getConfig,
7
8
  getStopwatch,
8
9
  isVerbose,
9
10
  joinPaths,
10
- loadStormConfig,
11
11
  run,
12
12
  withRunExecutor,
13
13
  writeDebug,
@@ -17,7 +17,7 @@ import {
17
17
  writeSuccess,
18
18
  writeTrace,
19
19
  writeWarning
20
- } from "./chunk-42WVFPO6.mjs";
20
+ } from "./chunk-COZQPQN4.mjs";
21
21
  import {
22
22
  __dirname,
23
23
  __name,
@@ -300,7 +300,7 @@ import { readFile } from "node:fs/promises";
300
300
  var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot3) => {
301
301
  let rootDir = workspaceRoot3;
302
302
  if (!rootDir) {
303
- const config = await loadStormConfig();
303
+ const config = await getConfig();
304
304
  rootDir = config.workspaceRoot;
305
305
  }
306
306
  const nxJsonPath = joinPaths(rootDir, "nx.json");
@@ -315,7 +315,7 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot3) => {
315
315
  var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson3 = true, includeSrc = false, banner, footer) => {
316
316
  const pendingAssets = Array.from(assets ?? []);
317
317
  pendingAssets.push({
318
- input: projectRoot,
318
+ input: joinPaths(config.workspaceRoot, projectRoot),
319
319
  glob: "*.md",
320
320
  output: "."
321
321
  });
@@ -348,8 +348,10 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
348
348
  if (!buildTarget) {
349
349
  throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${joinPaths(projectRoot, "project.json")}`);
350
350
  }
351
+ writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
352
+ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
351
353
  const result = await copyAssetsBase({
352
- assets,
354
+ assets: pendingAssets,
353
355
  watch: false,
354
356
  outputPath
355
357
  }, {
@@ -1233,7 +1235,7 @@ var resolveOptions = /* @__PURE__ */ __name(async (userOptions) => {
1233
1235
  if (!workspaceRoot3) {
1234
1236
  throw new Error("Cannot find Nx workspace root");
1235
1237
  }
1236
- const config = await loadStormConfig(workspaceRoot3.dir);
1238
+ const config = await getConfig(workspaceRoot3.dir);
1237
1239
  writeDebug(" \u2699\uFE0F Resolving build options", config);
1238
1240
  const stopwatch = getStopwatch("Build options resolution");
1239
1241
  const projectGraph = await createProjectGraphAsync({
@@ -1653,7 +1655,7 @@ var resolveOptions2 = /* @__PURE__ */ __name(async (userOptions) => {
1653
1655
  if (!workspaceRoot3) {
1654
1656
  throw new Error("Cannot find Nx workspace root");
1655
1657
  }
1656
- const config = await loadStormConfig(workspaceRoot3.dir);
1658
+ const config = await getConfig(workspaceRoot3.dir);
1657
1659
  writeDebug(" \u2699\uFE0F Resolving build options", config);
1658
1660
  const stopwatch = getStopwatch("Build options resolution");
1659
1661
  const projectGraph = await createProjectGraphAsync2({
@@ -1999,7 +2001,7 @@ var withRunGenerator = /* @__PURE__ */ __name((name, generatorFn, generatorOptio
1999
2001
  if (!generatorOptions.skipReadingConfig) {
2000
2002
  writeDebug(`Loading the Storm Config from environment variables and storm.config.js file...
2001
2003
  - workspaceRoot: ${workspaceRoot3}`, config);
2002
- config = await loadStormConfig(workspaceRoot3);
2004
+ config = await getConfig(workspaceRoot3);
2003
2005
  }
2004
2006
  if (generatorOptions?.hooks?.applyDefaultOptions) {
2005
2007
  writeDebug("Running the applyDefaultOptions hook...", config);
@@ -138,6 +138,8 @@ var ColorConfigMapSchema = z.union([
138
138
  }),
139
139
  z.record(z.string(), ColorConfigSchema)
140
140
  ]);
141
+ var ExtendsItemSchema = z.string().trim().describe("The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration.");
142
+ var ExtendsSchema = ExtendsItemSchema.or(z.array(ExtendsItemSchema)).describe("The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration.");
141
143
  var WorkspaceBotConfigSchema = z.object({
142
144
  name: z.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
143
145
  email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
@@ -152,11 +154,11 @@ var WorkspaceDirectoryConfigSchema = z.object({
152
154
  }).describe("Various directories used by the workspace to store data, cache, and configuration files");
153
155
  var StormConfigSchema = z.object({
154
156
  $schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
155
- extends: z.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
157
+ extends: ExtendsSchema.optional(),
156
158
  name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
157
159
  namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
158
160
  organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
159
- repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
161
+ repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
160
162
  license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
161
163
  homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
162
164
  docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
@@ -219,7 +221,8 @@ var COLOR_KEYS = [
219
221
  ];
220
222
 
221
223
  // ../config-tools/src/utilities/get-default-config.ts
222
- import { existsSync as existsSync2, readFileSync } from "node:fs";
224
+ import { existsSync as existsSync2 } from "node:fs";
225
+ import { readFile } from "node:fs/promises";
223
226
  import { join as join2 } from "node:path";
224
227
 
225
228
  // ../config-tools/src/utilities/correct-paths.ts
@@ -341,17 +344,15 @@ var DEFAULT_COLOR_CONFIG = {
341
344
  "negative": "#dc2626"
342
345
  }
343
346
  };
344
- var getDefaultConfig = /* @__PURE__ */ __name((root) => {
347
+ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
345
348
  let license = STORM_DEFAULT_LICENSE;
346
349
  let homepage = STORM_DEFAULT_HOMEPAGE;
347
- let name;
348
- let namespace;
349
- let repository;
350
+ let name = void 0;
351
+ let namespace = void 0;
352
+ let repository = void 0;
350
353
  const workspaceRoot = findWorkspaceRoot(root);
351
354
  if (existsSync2(join2(workspaceRoot, "package.json"))) {
352
- const file = readFileSync(join2(workspaceRoot, "package.json"), {
353
- encoding: "utf8"
354
- });
355
+ const file = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
355
356
  if (file) {
356
357
  const packageJson = JSON.parse(file);
357
358
  if (packageJson.name) {
@@ -360,8 +361,12 @@ var getDefaultConfig = /* @__PURE__ */ __name((root) => {
360
361
  if (packageJson.namespace) {
361
362
  namespace = packageJson.namespace;
362
363
  }
363
- if (packageJson.repository?.url) {
364
- repository = packageJson.repository?.url;
364
+ if (packageJson.repository) {
365
+ if (typeof packageJson.repository === "string") {
366
+ repository = packageJson.repository;
367
+ } else if (packageJson.repository.url) {
368
+ repository = packageJson.repository.url;
369
+ }
365
370
  }
366
371
  if (packageJson.license) {
367
372
  license = packageJson.license;
@@ -570,7 +575,6 @@ var writeInfo = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.IN
570
575
  var writeSuccess = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.SUCCESS, config)(message), "writeSuccess");
571
576
  var writeDebug = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.DEBUG, config)(message), "writeDebug");
572
577
  var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
573
- var writeSystem = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ALL, config)(message), "writeSystem");
574
578
  var getStopwatch = /* @__PURE__ */ __name((name) => {
575
579
  const start = process.hrtime();
576
580
  return () => {
@@ -662,19 +666,19 @@ var applyWorkspaceTokens = /* @__PURE__ */ __name(async (options, tokenParams, t
662
666
  // ../config-tools/src/config-file/get-config-file.ts
663
667
  var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
664
668
  const workspacePath = filePath || findWorkspaceRoot(filePath);
665
- let config = await loadConfig({
666
- cwd: workspacePath,
667
- packageJson: true,
668
- name: fileName,
669
- envName: fileName?.toUpperCase(),
670
- jitiOptions: {
671
- debug: false,
672
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
673
- },
674
- ...options
675
- });
676
- if (!config || Object.keys(config).length === 0) {
677
- config = await loadConfig({
669
+ const configs = await Promise.all([
670
+ loadConfig({
671
+ cwd: workspacePath,
672
+ packageJson: true,
673
+ name: fileName,
674
+ envName: fileName?.toUpperCase(),
675
+ jitiOptions: {
676
+ debug: false,
677
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
678
+ },
679
+ ...options
680
+ }),
681
+ loadConfig({
678
682
  cwd: workspacePath,
679
683
  packageJson: true,
680
684
  name: fileName,
@@ -685,9 +689,9 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
685
689
  },
686
690
  configFile: fileName,
687
691
  ...options
688
- });
689
- }
690
- return config;
692
+ })
693
+ ]);
694
+ return defu(configs[0] ?? {}, configs[1] ?? {});
691
695
  }, "getConfigFileByName");
692
696
  var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
693
697
  const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
@@ -695,7 +699,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
695
699
  let config = result.config;
696
700
  const configFile = result.configFile;
697
701
  if (config && configFile && Object.keys(config).length > 0) {
698
- writeSystem(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
702
+ writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
699
703
  logLevel: "all"
700
704
  });
701
705
  }
@@ -703,7 +707,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
703
707
  const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
704
708
  for (const result2 of results) {
705
709
  if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
706
- writeSystem(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
710
+ writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
707
711
  logLevel: "all"
708
712
  });
709
713
  config = defu(result2.config ?? {}, config ?? {});
@@ -721,6 +725,16 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
721
725
  import defu2 from "defu";
722
726
 
723
727
  // ../config-tools/src/env/get-env.ts
728
+ var getExtensionEnv = /* @__PURE__ */ __name((extensionName) => {
729
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
730
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
731
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
732
+ if (name) {
733
+ ret[name] = process.env[key];
734
+ }
735
+ return ret;
736
+ }, {});
737
+ }, "getExtensionEnv");
724
738
  var getConfigEnv = /* @__PURE__ */ __name(() => {
725
739
  const prefix = "STORM_";
726
740
  let config = {
@@ -880,7 +894,7 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
880
894
  var setConfigEnv = /* @__PURE__ */ __name((config) => {
881
895
  const prefix = "STORM_";
882
896
  if (config.extends) {
883
- process.env[`${prefix}EXTENDS`] = config.extends;
897
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
884
898
  }
885
899
  if (config.name) {
886
900
  process.env[`${prefix}NAME`] = config.name;
@@ -1110,30 +1124,69 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
1110
1124
  }, "setBaseThemeColorConfigEnv");
1111
1125
 
1112
1126
  // ../config-tools/src/create-storm-config.ts
1127
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
1113
1128
  var _static_cache = void 0;
1114
- var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
1115
- let config = {};
1116
- if (_static_cache?.data && _static_cache?.timestamp && _static_cache.timestamp >= Date.now() + 3e4) {
1117
- writeTrace(`Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
1118
- return _static_cache.data;
1119
- }
1120
- let _workspaceRoot = workspaceRoot;
1121
- if (!_workspaceRoot) {
1122
- _workspaceRoot = findWorkspaceRoot();
1129
+ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, workspaceRoot, skipLogs = false) => {
1130
+ let result;
1131
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1132
+ let _workspaceRoot = workspaceRoot;
1133
+ if (!_workspaceRoot) {
1134
+ _workspaceRoot = findWorkspaceRoot();
1135
+ }
1136
+ const configEnv = getConfigEnv();
1137
+ const defaultConfig = await getDefaultConfig(_workspaceRoot);
1138
+ const configFile = await getConfigFile(_workspaceRoot);
1139
+ if (!configFile && !skipLogs) {
1140
+ writeWarning("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
1141
+ logLevel: "all"
1142
+ });
1143
+ }
1144
+ result = await StormConfigSchema.parseAsync(defu2(configEnv, configFile, defaultConfig));
1145
+ result.workspaceRoot ??= _workspaceRoot;
1146
+ } else {
1147
+ result = _static_cache.data;
1123
1148
  }
1124
- const configFile = await getConfigFile(_workspaceRoot);
1125
- if (!configFile) {
1126
- writeWarning("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
1127
- logLevel: "all"
1128
- });
1149
+ if (schema && extensionName) {
1150
+ result.extensions = {
1151
+ ...result.extensions,
1152
+ [extensionName]: createConfigExtension(extensionName, schema)
1153
+ };
1129
1154
  }
1130
- config = defu2(getConfigEnv(), configFile, getDefaultConfig(_workspaceRoot));
1155
+ _static_cache = {
1156
+ timestamp: Date.now(),
1157
+ data: result
1158
+ };
1159
+ return result;
1160
+ }, "createStormConfig");
1161
+ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
1162
+ const extension_cache_key = {
1163
+ extensionName
1164
+ };
1165
+ if (_extension_cache.has(extension_cache_key)) {
1166
+ return _extension_cache.get(extension_cache_key);
1167
+ }
1168
+ let extension = getExtensionEnv(extensionName);
1169
+ if (schema) {
1170
+ extension = schema.parse(extension);
1171
+ }
1172
+ _extension_cache.set(extension_cache_key, extension);
1173
+ return extension;
1174
+ }, "createConfigExtension");
1175
+ var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
1176
+ const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
1131
1177
  setConfigEnv(config);
1132
- writeTrace(`\u2699\uFE0F Using Storm configuration:
1178
+ if (!skipLogs) {
1179
+ writeTrace(`\u2699\uFE0F Using Storm configuration:
1133
1180
  ${formatLogMessage(config)}`, config);
1181
+ }
1134
1182
  return config;
1135
1183
  }, "loadStormConfig");
1136
1184
 
1185
+ // ../config-tools/src/get-config.ts
1186
+ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
1187
+ return loadStormConfig(workspaceRoot, skipLogs);
1188
+ }, "getConfig");
1189
+
1137
1190
  // ../workspace-tools/src/base/base-executor.ts
1138
1191
  import { defu as defu3 } from "defu";
1139
1192
  var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions = {}) => async (_options, context) => {
@@ -1159,7 +1212,7 @@ var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions
1159
1212
  - sourceRoot: ${sourceRoot}
1160
1213
  - projectName: ${projectName}
1161
1214
  `, config);
1162
- config = await loadStormConfig(workspaceRoot);
1215
+ config = await getConfig(workspaceRoot);
1163
1216
  }
1164
1217
  if (executorOptions?.hooks?.applyDefaultOptions) {
1165
1218
  writeDebug("Running the applyDefaultOptions hook...", config);
@@ -1246,6 +1299,6 @@ export {
1246
1299
  applyWorkspaceBaseTokens,
1247
1300
  applyWorkspaceTokens,
1248
1301
  run,
1249
- loadStormConfig,
1302
+ getConfig,
1250
1303
  withRunExecutor
1251
1304
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTerraformExecutor
3
- } from "./chunk-EMIZUK4F.mjs";
3
+ } from "./chunk-YFYQLHFW.mjs";
4
4
 
5
5
  // src/executors/plan/executor.ts
6
6
  var executor_default = withTerraformExecutor("plan");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTerraformExecutor
3
- } from "./chunk-EMIZUK4F.mjs";
3
+ } from "./chunk-YFYQLHFW.mjs";
4
4
 
5
5
  // src/executors/output/executor.ts
6
6
  var executor_default = withTerraformExecutor("output");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withTerraformExecutor
3
- } from "./chunk-EMIZUK4F.mjs";
3
+ } from "./chunk-YFYQLHFW.mjs";
4
4
 
5
5
  // src/executors/destroy/executor.ts
6
6
  var executor_default = withTerraformExecutor("destroy");