@storm-software/config-tools 1.174.0 → 1.174.2

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
@@ -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-1.173.9-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-1.174.1-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 -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/config-tools",
3
- "version": "1.174.0",
3
+ "version": "1.174.2",
4
4
  "type": "module",
5
5
  "description": "A package containing various utilities to support custom workspace configurations and environment management for Storm Software projects, including configuration file handling, environment variable management, and logging utilities.",
6
6
  "repository": {
@@ -211,7 +211,7 @@
211
211
  ],
212
212
  "dependencies": {
213
213
  "@ltd/j-toml": "1.38.0",
214
- "@storm-software/config": "^1.123.0",
214
+ "@storm-software/config": "^1.124.1",
215
215
  "c12": "^2.0.0-beta.2",
216
216
  "chalk": "^4.1.2",
217
217
  "commander": "^12.1.0",
@@ -219,7 +219,7 @@
219
219
  "giget": "^1.2.5",
220
220
  "jiti": "^2.4.2",
221
221
  "sqlite": "^5.1.1",
222
- "zod": "^3.24.0"
222
+ "zod": "^3.25.67"
223
223
  },
224
224
  "devDependencies": { "@types/node": "^22.10.2", "tsup": "8.4.0" },
225
225
  "publishConfig": { "access": "public" },
@@ -1,40 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkXTF5ACDNcjs = require('./chunk-XTF5ACDN.cjs');
5
-
6
-
7
- var _chunkU436743Ucjs = require('./chunk-U436743U.cjs');
8
-
9
- // src/get-config.ts
10
- var getConfig = (workspaceRoot, skipLogs = false) => {
11
- return _chunkXTF5ACDNcjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
12
- };
13
- var getWorkspaceConfig = (skipLogs = true, options = {}) => {
14
- let workspaceRoot = options.workspaceRoot;
15
- if (!workspaceRoot) {
16
- workspaceRoot = _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, options.cwd);
17
- }
18
- return getConfig(workspaceRoot, skipLogs);
19
- };
20
- var tryGetWorkspaceConfig = async (skipLogs = true, options = {}) => {
21
- try {
22
- let workspaceRoot = options.workspaceRoot;
23
- if (!workspaceRoot) {
24
- workspaceRoot = _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, options.cwd);
25
- }
26
- return _chunkXTF5ACDNcjs.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,138 +0,0 @@
1
- import {
2
- getConfigEnv,
3
- getExtensionEnv
4
- } from "./chunk-BWCGUZR7.js";
5
- import {
6
- setConfigEnv
7
- } from "./chunk-NNI6CYBY.js";
8
- import {
9
- getConfigFile
10
- } from "./chunk-73L7WNYI.js";
11
- import {
12
- formatLogMessage,
13
- writeTrace,
14
- writeWarning
15
- } from "./chunk-SMVSQFZ3.js";
16
- import {
17
- applyDefaultConfig,
18
- getPackageJsonConfig
19
- } from "./chunk-SHD7ZUSQ.js";
20
- import {
21
- findWorkspaceRoot
22
- } from "./chunk-PTHGOJU6.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
- import {
2
- loadStormWorkspaceConfig,
3
- tryLoadStormWorkspaceConfig
4
- } from "./chunk-BVJJK74Q.js";
5
- import {
6
- findWorkspaceRoot
7
- } from "./chunk-PTHGOJU6.js";
8
-
9
- // src/get-config.ts
10
- var getConfig = (workspaceRoot, skipLogs = false) => {
11
- return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
12
- };
13
- var getWorkspaceConfig = (skipLogs = true, 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 = true, 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,138 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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
-
4
- var _chunkCIVWRQRNcjs = require('./chunk-CIVWRQRN.cjs');
5
-
6
-
7
- var _chunk6YHEX4VCcjs = require('./chunk-6YHEX4VC.cjs');
8
-
9
-
10
- var _chunkN5TOHWQYcjs = require('./chunk-N5TOHWQY.cjs');
11
-
12
-
13
-
14
-
15
- var _chunkXPQXNNGZcjs = require('./chunk-XPQXNNGZ.cjs');
16
-
17
-
18
-
19
- var _chunkKH5SONKWcjs = require('./chunk-KH5SONKW.cjs');
20
-
21
-
22
- var _chunkU436743Ucjs = require('./chunk-U436743U.cjs');
23
-
24
- // src/create-storm-config.ts
25
- var _schema = require('@storm-software/config/schema');
26
- var _defu = require('defu'); var _defu2 = _interopRequireDefault(_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 (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
32
- let _workspaceRoot = workspaceRoot;
33
- if (!_workspaceRoot) {
34
- _workspaceRoot = _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, );
35
- }
36
- const configEnv = _chunkCIVWRQRNcjs.getConfigEnv.call(void 0, );
37
- const configFile = await _chunkN5TOHWQYcjs.getConfigFile.call(void 0, _workspaceRoot);
38
- if (!configFile) {
39
- if (!skipLogs) {
40
- _chunkXPQXNNGZcjs.writeWarning.call(void 0,
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 _chunkKH5SONKWcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
50
- result = _chunkKH5SONKWcjs.applyDefaultConfig.call(void 0,
51
- await _schema.stormWorkspaceConfigSchema.parseAsync(
52
- _defu2.default.call(void 0, 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 = _chunkCIVWRQRNcjs.getExtensionEnv.call(void 0, 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
- _chunk6YHEX4VCcjs.setConfigEnv.call(void 0, config);
92
- if (!skipLogs && !config.skipConfigLogging) {
93
- _chunkXPQXNNGZcjs.writeTrace.call(void 0,
94
- `\u2699\uFE0F Using Storm Workspace configuration:
95
- ${_chunkXPQXNNGZcjs.formatLogMessage.call(void 0, 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
- _chunk6YHEX4VCcjs.setConfigEnv.call(void 0, config);
114
- if (!skipLogs && !config.skipConfigLogging) {
115
- _chunkXPQXNNGZcjs.writeTrace.call(void 0,
116
- `\u2699\uFE0F Using Storm Workspace configuration:
117
- ${_chunkXPQXNNGZcjs.formatLogMessage.call(void 0, config)}`,
118
- config
119
- );
120
- }
121
- return config;
122
- } catch (error) {
123
- if (!skipLogs) {
124
- _chunkXPQXNNGZcjs.writeWarning.call(void 0,
125
- `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
126
- { logLevel: "all" }
127
- );
128
- }
129
- return void 0;
130
- }
131
- };
132
-
133
-
134
-
135
-
136
-
137
-
138
- exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;