@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.
- package/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/dist/{chunk-6D4LV6X2.js → chunk-2YZ3MY7Z.js} +3 -3
- package/dist/{chunk-FLEOXRFA.js → chunk-BDNXCOYM.js} +2 -2
- package/dist/{chunk-ZOKR7XCK.mjs → chunk-CJUII4ME.mjs} +10 -8
- package/dist/{chunk-42WVFPO6.mjs → chunk-COZQPQN4.mjs} +103 -50
- package/dist/{chunk-ZTLSR2U3.mjs → chunk-FAMG3LBJ.mjs} +1 -1
- package/dist/{chunk-D6CRGFE3.mjs → chunk-JMMGQ3VC.mjs} +1 -1
- package/dist/{chunk-KBT4UFBN.mjs → chunk-M7TZCVBI.mjs} +1 -1
- package/dist/{chunk-TQAFH5OJ.js → chunk-OAZ3OJPI.js} +121 -68
- package/dist/{chunk-IMGISWCA.mjs → chunk-ODKOOHVU.mjs} +1 -1
- package/dist/{chunk-JEBWKJI3.js → chunk-P4DYHSWV.js} +2 -2
- package/dist/{chunk-MJMNVCOX.js → chunk-QYC5T3J3.js} +2 -2
- package/dist/{chunk-EMIZUK4F.mjs → chunk-YFYQLHFW.mjs} +1 -1
- package/dist/{chunk-WGRRG2DY.js → chunk-YIC7T6TB.js} +151 -149
- package/dist/{chunk-GEMICIUF.js → chunk-ZIUAOW5J.js} +2 -2
- package/dist/executors.js +6 -6
- package/dist/executors.mjs +6 -6
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +2 -2
- package/dist/index.js +8 -8
- package/dist/index.mjs +7 -7
- package/dist/src/base/index.js +3 -3
- package/dist/src/base/index.mjs +2 -2
- package/dist/src/base/terraform-executor.d.mts +3 -3
- package/dist/src/base/terraform-executor.d.ts +3 -3
- package/dist/src/base/terraform-executor.js +3 -3
- package/dist/src/base/terraform-executor.mjs +2 -2
- package/dist/src/executors/apply/executor.js +4 -4
- package/dist/src/executors/apply/executor.mjs +3 -3
- package/dist/src/executors/destroy/executor.js +4 -4
- package/dist/src/executors/destroy/executor.mjs +3 -3
- package/dist/src/executors/output/executor.js +4 -4
- package/dist/src/executors/output/executor.mjs +3 -3
- package/dist/src/executors/plan/executor.js +4 -4
- package/dist/src/executors/plan/executor.mjs +3 -3
- package/dist/src/generators/init/init.js +3 -3
- package/dist/src/generators/init/init.mjs +2 -2
- 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
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
3
|
+
var _chunk2YZ3MY7Zjs = require('./chunk-2YZ3MY7Z.js');
|
|
4
4
|
|
|
5
5
|
// src/executors/apply/executor.ts
|
|
6
|
-
var executor_default =
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
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().
|
|
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
|
|
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 =
|
|
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
|
|
364
|
-
|
|
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
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
1115
|
-
let
|
|
1116
|
-
if (_static_cache?.data
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
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
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1149
|
+
if (schema && extensionName) {
|
|
1150
|
+
result.extensions = {
|
|
1151
|
+
...result.extensions,
|
|
1152
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
1153
|
+
};
|
|
1129
1154
|
}
|
|
1130
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
1302
|
+
getConfig,
|
|
1250
1303
|
withRunExecutor
|
|
1251
1304
|
};
|