@storm-software/config-tools 1.172.10 → 1.173.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.
Files changed (37) hide show
  1. package/bin/config.cjs +4 -0
  2. package/bin/config.js +4 -0
  3. package/dist/{chunk-26BPJW3I.js → chunk-62YJAX4N.js} +2 -2
  4. package/dist/{chunk-6LO4SCE6.cjs → chunk-AH2DDCPN.cjs} +1 -0
  5. package/dist/{chunk-F7MZXFL2.cjs → chunk-CPWR3CZZ.cjs} +3 -0
  6. package/dist/{chunk-2CVNUZFW.cjs → chunk-FO5MOLUY.cjs} +6 -6
  7. package/dist/{chunk-QWVC3UD5.cjs → chunk-ROLVAV5Z.cjs} +3 -3
  8. package/dist/{chunk-Z3RQ7QQH.js → chunk-XHJCRUWP.js} +1 -0
  9. package/dist/{chunk-TRI5HQQN.js → chunk-XPPM3PBH.js} +3 -0
  10. package/dist/{chunk-BLOV7XHL.js → chunk-YTUBIKWS.js} +1 -1
  11. package/dist/create-storm-config.cjs +4 -4
  12. package/dist/create-storm-config.js +3 -3
  13. package/dist/env/get-env.cjs +2 -2
  14. package/dist/env/get-env.js +1 -1
  15. package/dist/env/index.cjs +3 -3
  16. package/dist/env/index.js +2 -2
  17. package/dist/env/set-env.cjs +2 -2
  18. package/dist/env/set-env.js +1 -1
  19. package/dist/get-config.cjs +5 -5
  20. package/dist/get-config.js +4 -4
  21. package/dist/index.cjs +5 -5
  22. package/dist/index.js +4 -4
  23. package/package.json +2 -2
  24. package/dist/chunk-2VPBY2UN.cjs +0 -40
  25. package/dist/chunk-33DQVYXE.js +0 -55
  26. package/dist/chunk-4XFCYYH4.js +0 -40
  27. package/dist/chunk-5YPGRGBJ.js +0 -158
  28. package/dist/chunk-DHN65RU7.js +0 -47
  29. package/dist/chunk-GBW7G3RC.cjs +0 -158
  30. package/dist/chunk-IHGFD6VV.cjs +0 -138
  31. package/dist/chunk-IYUFTISY.cjs +0 -47
  32. package/dist/chunk-LCIW6KMU.cjs +0 -55
  33. package/dist/chunk-LQ3N3RRC.js +0 -138
  34. package/dist/chunk-N4GOLNNI.cjs +0 -40
  35. package/dist/chunk-NUOCEMFW.js +0 -40
  36. package/dist/chunk-WZTNSSMY.cjs +0 -92
  37. package/dist/chunk-ZSWS4URS.js +0 -92
@@ -1,138 +0,0 @@
1
- import {
2
- getConfigFile
3
- } from "./chunk-ZSWS4URS.js";
4
- import {
5
- formatLogMessage,
6
- writeTrace,
7
- writeWarning
8
- } from "./chunk-5YPGRGBJ.js";
9
- import {
10
- applyDefaultConfig,
11
- getPackageJsonConfig
12
- } from "./chunk-4KZ3BMNG.js";
13
- import {
14
- findWorkspaceRoot
15
- } from "./chunk-VLWSWYG7.js";
16
- import {
17
- getConfigEnv,
18
- getExtensionEnv
19
- } from "./chunk-Z3RQ7QQH.js";
20
- import {
21
- setConfigEnv
22
- } from "./chunk-TRI5HQQN.js";
23
-
24
- // src/create-storm-config.ts
25
- import { stormWorkspaceConfigSchema } from "@storm-software/config/schema";
26
- import defu from "defu";
27
- var _extension_cache = /* @__PURE__ */ new WeakMap();
28
- var _static_cache = void 0;
29
- var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
30
- let result;
31
- if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
32
- let _workspaceRoot = workspaceRoot;
33
- if (!_workspaceRoot) {
34
- _workspaceRoot = findWorkspaceRoot();
35
- }
36
- const configEnv = getConfigEnv();
37
- const configFile = await getConfigFile(_workspaceRoot);
38
- if (!configFile) {
39
- if (!skipLogs) {
40
- writeWarning(
41
- "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
42
- { logLevel: "all" }
43
- );
44
- }
45
- if (useDefault === false) {
46
- return void 0;
47
- }
48
- }
49
- const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
50
- result = applyDefaultConfig(
51
- await stormWorkspaceConfigSchema.parseAsync(
52
- defu(configEnv, configFile, defaultConfig)
53
- )
54
- );
55
- result.workspaceRoot ??= _workspaceRoot;
56
- } else {
57
- result = _static_cache.data;
58
- }
59
- if (schema && extensionName) {
60
- result.extensions = {
61
- ...result.extensions,
62
- [extensionName]: createConfigExtension(extensionName, schema)
63
- };
64
- }
65
- _static_cache = {
66
- timestamp: Date.now(),
67
- data: result
68
- };
69
- return result;
70
- };
71
- var createConfigExtension = (extensionName, schema) => {
72
- const extension_cache_key = { extensionName };
73
- if (_extension_cache.has(extension_cache_key)) {
74
- return _extension_cache.get(extension_cache_key);
75
- }
76
- let extension = getExtensionEnv(extensionName);
77
- if (schema) {
78
- extension = schema.parse(extension);
79
- }
80
- _extension_cache.set(extension_cache_key, extension);
81
- return extension;
82
- };
83
- var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
84
- const config = await createStormWorkspaceConfig(
85
- void 0,
86
- void 0,
87
- workspaceRoot,
88
- skipLogs,
89
- true
90
- );
91
- setConfigEnv(config);
92
- if (!skipLogs && !config.skipConfigLogging) {
93
- writeTrace(
94
- `\u2699\uFE0F Using Storm Workspace configuration:
95
- ${formatLogMessage(config)}`,
96
- config
97
- );
98
- }
99
- return config;
100
- };
101
- var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
102
- try {
103
- const config = await createStormWorkspaceConfig(
104
- void 0,
105
- void 0,
106
- workspaceRoot,
107
- skipLogs,
108
- useDefault
109
- );
110
- if (!config) {
111
- return void 0;
112
- }
113
- setConfigEnv(config);
114
- if (!skipLogs && !config.skipConfigLogging) {
115
- writeTrace(
116
- `\u2699\uFE0F Using Storm Workspace configuration:
117
- ${formatLogMessage(config)}`,
118
- config
119
- );
120
- }
121
- return config;
122
- } catch (error) {
123
- if (!skipLogs) {
124
- writeWarning(
125
- `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
126
- { logLevel: "all" }
127
- );
128
- }
129
- return void 0;
130
- }
131
- };
132
-
133
- export {
134
- createStormWorkspaceConfig,
135
- createConfigExtension,
136
- loadStormWorkspaceConfig,
137
- tryLoadStormWorkspaceConfig
138
- };
@@ -1,40 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkIHGFD6VVcjs = require('./chunk-IHGFD6VV.cjs');
5
-
6
-
7
- var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
8
-
9
- // src/get-config.ts
10
- var getConfig = (workspaceRoot, skipLogs = false) => {
11
- return _chunkIHGFD6VVcjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
12
- };
13
- var getWorkspaceConfig = (skipLogs = false, options = {}) => {
14
- let workspaceRoot = options.workspaceRoot;
15
- if (!workspaceRoot) {
16
- workspaceRoot = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, options.cwd);
17
- }
18
- return getConfig(workspaceRoot, skipLogs);
19
- };
20
- var tryGetWorkspaceConfig = async (skipLogs = false, options = {}) => {
21
- try {
22
- let workspaceRoot = options.workspaceRoot;
23
- if (!workspaceRoot) {
24
- workspaceRoot = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, options.cwd);
25
- }
26
- return _chunkIHGFD6VVcjs.tryLoadStormWorkspaceConfig.call(void 0,
27
- workspaceRoot,
28
- skipLogs,
29
- options.useDefault
30
- );
31
- } catch (e) {
32
- return void 0;
33
- }
34
- };
35
-
36
-
37
-
38
-
39
-
40
- exports.getConfig = getConfig; exports.getWorkspaceConfig = getWorkspaceConfig; exports.tryGetWorkspaceConfig = tryGetWorkspaceConfig;
@@ -1,40 +0,0 @@
1
- import {
2
- loadStormWorkspaceConfig,
3
- tryLoadStormWorkspaceConfig
4
- } from "./chunk-26BPJW3I.js";
5
- import {
6
- findWorkspaceRoot
7
- } from "./chunk-VLWSWYG7.js";
8
-
9
- // src/get-config.ts
10
- var getConfig = (workspaceRoot, skipLogs = false) => {
11
- return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
12
- };
13
- var getWorkspaceConfig = (skipLogs = false, options = {}) => {
14
- let workspaceRoot = options.workspaceRoot;
15
- if (!workspaceRoot) {
16
- workspaceRoot = findWorkspaceRoot(options.cwd);
17
- }
18
- return getConfig(workspaceRoot, skipLogs);
19
- };
20
- var tryGetWorkspaceConfig = async (skipLogs = false, options = {}) => {
21
- try {
22
- let workspaceRoot = options.workspaceRoot;
23
- if (!workspaceRoot) {
24
- workspaceRoot = findWorkspaceRoot(options.cwd);
25
- }
26
- return tryLoadStormWorkspaceConfig(
27
- workspaceRoot,
28
- skipLogs,
29
- options.useDefault
30
- );
31
- } catch {
32
- return void 0;
33
- }
34
- };
35
-
36
- export {
37
- getConfig,
38
- getWorkspaceConfig,
39
- tryGetWorkspaceConfig
40
- };
@@ -1,92 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkGBW7G3RCcjs = require('./chunk-GBW7G3RC.cjs');
4
-
5
-
6
- var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
7
-
8
-
9
- var _chunk4JREL2GQcjs = require('./chunk-4JREL2GQ.cjs');
10
-
11
- // src/config-file/get-config-file.ts
12
- var _c12 = require('c12');
13
- var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
14
- var getConfigFileByName = async (fileName, filePath, options = {}) => {
15
- const workspacePath = filePath || _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, filePath);
16
- const configs = await Promise.all([
17
- _c12.loadConfig.call(void 0, {
18
- cwd: workspacePath,
19
- packageJson: true,
20
- name: fileName,
21
- envName: _optionalChain([fileName, 'optionalAccess', _ => _.toUpperCase, 'call', _2 => _2()]),
22
- jitiOptions: {
23
- debug: false,
24
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunk4JREL2GQcjs.joinPaths.call(void 0,
25
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
26
- "jiti"
27
- )
28
- },
29
- ...options
30
- }),
31
- _c12.loadConfig.call(void 0, {
32
- cwd: workspacePath,
33
- packageJson: true,
34
- name: fileName,
35
- envName: _optionalChain([fileName, 'optionalAccess', _3 => _3.toUpperCase, 'call', _4 => _4()]),
36
- jitiOptions: {
37
- debug: false,
38
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunk4JREL2GQcjs.joinPaths.call(void 0,
39
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
40
- "jiti"
41
- )
42
- },
43
- configFile: fileName,
44
- ...options
45
- })
46
- ]);
47
- return _defu2.default.call(void 0, _nullishCoalesce(configs[0], () => ( {})), _nullishCoalesce(configs[1], () => ( {})));
48
- };
49
- var getConfigFile = async (filePath, additionalFileNames = []) => {
50
- const workspacePath = filePath ? filePath : _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, filePath);
51
- const result = await getConfigFileByName("storm-workspace", workspacePath);
52
- let config = result.config;
53
- const configFile = result.configFile;
54
- if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
55
- _chunkGBW7G3RCcjs.writeTrace.call(void 0,
56
- `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
57
- {
58
- logLevel: "all"
59
- }
60
- );
61
- }
62
- if (additionalFileNames && additionalFileNames.length > 0) {
63
- const results = await Promise.all(
64
- additionalFileNames.map(
65
- (fileName) => getConfigFileByName(fileName, workspacePath)
66
- )
67
- );
68
- for (const result2 of results) {
69
- if (_optionalChain([result2, 'optionalAccess', _5 => _5.config]) && _optionalChain([result2, 'optionalAccess', _6 => _6.configFile]) && Object.keys(result2.config).length > 0) {
70
- if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
71
- _chunkGBW7G3RCcjs.writeTrace.call(void 0,
72
- `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
73
- {
74
- logLevel: "all"
75
- }
76
- );
77
- }
78
- config = _defu2.default.call(void 0, _nullishCoalesce(result2.config, () => ( {})), _nullishCoalesce(config, () => ( {})));
79
- }
80
- }
81
- }
82
- if (!config || Object.keys(config).length === 0) {
83
- return void 0;
84
- }
85
- config.configFile = configFile;
86
- return config;
87
- };
88
-
89
-
90
-
91
-
92
- exports.getConfigFileByName = getConfigFileByName; exports.getConfigFile = getConfigFile;
@@ -1,92 +0,0 @@
1
- import {
2
- writeTrace
3
- } from "./chunk-5YPGRGBJ.js";
4
- import {
5
- findWorkspaceRoot
6
- } from "./chunk-VLWSWYG7.js";
7
- import {
8
- joinPaths
9
- } from "./chunk-FRR2ZRWD.js";
10
-
11
- // src/config-file/get-config-file.ts
12
- import { loadConfig } from "c12";
13
- import defu from "defu";
14
- var getConfigFileByName = async (fileName, filePath, options = {}) => {
15
- const workspacePath = filePath || findWorkspaceRoot(filePath);
16
- const configs = await Promise.all([
17
- loadConfig({
18
- cwd: workspacePath,
19
- packageJson: true,
20
- name: fileName,
21
- envName: fileName?.toUpperCase(),
22
- jitiOptions: {
23
- debug: false,
24
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
25
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
26
- "jiti"
27
- )
28
- },
29
- ...options
30
- }),
31
- loadConfig({
32
- cwd: workspacePath,
33
- packageJson: true,
34
- name: fileName,
35
- envName: fileName?.toUpperCase(),
36
- jitiOptions: {
37
- debug: false,
38
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
39
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
40
- "jiti"
41
- )
42
- },
43
- configFile: fileName,
44
- ...options
45
- })
46
- ]);
47
- return defu(configs[0] ?? {}, configs[1] ?? {});
48
- };
49
- var getConfigFile = async (filePath, additionalFileNames = []) => {
50
- const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
51
- const result = await getConfigFileByName("storm-workspace", workspacePath);
52
- let config = result.config;
53
- const configFile = result.configFile;
54
- if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
55
- writeTrace(
56
- `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
57
- {
58
- logLevel: "all"
59
- }
60
- );
61
- }
62
- if (additionalFileNames && additionalFileNames.length > 0) {
63
- const results = await Promise.all(
64
- additionalFileNames.map(
65
- (fileName) => getConfigFileByName(fileName, workspacePath)
66
- )
67
- );
68
- for (const result2 of results) {
69
- if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
70
- if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
71
- writeTrace(
72
- `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
73
- {
74
- logLevel: "all"
75
- }
76
- );
77
- }
78
- config = defu(result2.config ?? {}, config ?? {});
79
- }
80
- }
81
- }
82
- if (!config || Object.keys(config).length === 0) {
83
- return void 0;
84
- }
85
- config.configFile = configFile;
86
- return config;
87
- };
88
-
89
- export {
90
- getConfigFileByName,
91
- getConfigFile
92
- };