@storm-software/config-tools 1.171.1 → 1.171.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/README.md +1 -1
- package/dist/chunk-5HQ3YF27.js +40 -0
- package/dist/chunk-7DVU4MO6.cjs +138 -0
- package/dist/chunk-L2QCQ7U7.cjs +40 -0
- package/dist/chunk-OBUIME4H.js +138 -0
- package/package.json +2 -2
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 -->
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadStormWorkspaceConfig,
|
|
3
|
+
tryLoadStormWorkspaceConfig
|
|
4
|
+
} from "./chunk-OBUIME4H.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
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
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 _chunk6LO4SCE6cjs = require('./chunk-6LO4SCE6.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkF7MZXFL2cjs = require('./chunk-F7MZXFL2.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkBMDGKEGPcjs = require('./chunk-BMDGKEGP.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkDX767CQScjs = require('./chunk-DX767CQS.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunk4PAEA5KVcjs = require('./chunk-4PAEA5KV.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.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 = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, );
|
|
35
|
+
}
|
|
36
|
+
const configEnv = _chunk6LO4SCE6cjs.getConfigEnv.call(void 0, );
|
|
37
|
+
const configFile = await _chunkBMDGKEGPcjs.getConfigFile.call(void 0, _workspaceRoot);
|
|
38
|
+
if (!configFile) {
|
|
39
|
+
if (!skipLogs) {
|
|
40
|
+
_chunkDX767CQScjs.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 _chunk4PAEA5KVcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
|
|
50
|
+
result = _chunk4PAEA5KVcjs.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 = _chunk6LO4SCE6cjs.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
|
+
_chunkF7MZXFL2cjs.setConfigEnv.call(void 0, config);
|
|
92
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
93
|
+
_chunkDX767CQScjs.writeTrace.call(void 0,
|
|
94
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
95
|
+
${_chunkDX767CQScjs.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
|
+
_chunkF7MZXFL2cjs.setConfigEnv.call(void 0, config);
|
|
114
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
115
|
+
_chunkDX767CQScjs.writeTrace.call(void 0,
|
|
116
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
117
|
+
${_chunkDX767CQScjs.formatLogMessage.call(void 0, config)}`,
|
|
118
|
+
config
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return config;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
if (!skipLogs) {
|
|
124
|
+
_chunkDX767CQScjs.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;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk7DVU4MO6cjs = require('./chunk-7DVU4MO6.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
|
|
8
|
+
|
|
9
|
+
// src/get-config.ts
|
|
10
|
+
var getConfig = (workspaceRoot, skipLogs = false) => {
|
|
11
|
+
return _chunk7DVU4MO6cjs.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 _chunk7DVU4MO6cjs.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;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigEnv,
|
|
3
|
+
getExtensionEnv
|
|
4
|
+
} from "./chunk-Z3RQ7QQH.js";
|
|
5
|
+
import {
|
|
6
|
+
setConfigEnv
|
|
7
|
+
} from "./chunk-TRI5HQQN.js";
|
|
8
|
+
import {
|
|
9
|
+
getConfigFile
|
|
10
|
+
} from "./chunk-XT2XO7TR.js";
|
|
11
|
+
import {
|
|
12
|
+
formatLogMessage,
|
|
13
|
+
writeTrace,
|
|
14
|
+
writeWarning
|
|
15
|
+
} from "./chunk-OUYYXBZX.js";
|
|
16
|
+
import {
|
|
17
|
+
applyDefaultConfig,
|
|
18
|
+
getPackageJsonConfig
|
|
19
|
+
} from "./chunk-4KZ3BMNG.js";
|
|
20
|
+
import {
|
|
21
|
+
findWorkspaceRoot
|
|
22
|
+
} from "./chunk-VLWSWYG7.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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/config-tools",
|
|
3
|
-
"version": "1.171.
|
|
3
|
+
"version": "1.171.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.",
|
|
6
6
|
"repository": {
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
],
|
|
220
220
|
"dependencies": {
|
|
221
221
|
"@ltd/j-toml": "1.38.0",
|
|
222
|
-
"@storm-software/config": "^1.121.
|
|
222
|
+
"@storm-software/config": "^1.121.3",
|
|
223
223
|
"c12": "^2.0.0-beta.2",
|
|
224
224
|
"chalk": "^4.1.2",
|
|
225
225
|
"commander": "^12.1.0",
|