@storm-software/config-tools 1.176.13 → 1.176.15
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-34OCDM7F.js +47 -0
- package/dist/chunk-66NG3IMH.js +131 -0
- package/dist/chunk-6RRYSEZX.js +82 -0
- package/dist/chunk-B3GCBJWU.js +358 -0
- package/dist/chunk-CGZUIRJC.js +154 -0
- package/dist/chunk-COFLNWWF.cjs +199 -0
- package/dist/chunk-D3VDRI3F.js +33 -0
- package/dist/chunk-FN5I4YDC.js +40 -0
- package/dist/chunk-H23BFVJZ.js +92 -0
- package/dist/chunk-HDZDJM2A.cjs +158 -0
- package/dist/chunk-HGKCHX5V.js +199 -0
- package/dist/chunk-LAMW4XOL.cjs +92 -0
- package/dist/chunk-LFMYCBX4.cjs +33 -0
- package/dist/chunk-N3XDUGRP.cjs +154 -0
- package/dist/chunk-NP5N65JN.cjs +55 -0
- package/dist/chunk-PQFFXKJC.js +158 -0
- package/dist/chunk-QSPWWF3B.cjs +40 -0
- package/dist/chunk-SNUKAQ73.js +81 -0
- package/dist/chunk-V34OFEO4.js +39 -0
- package/dist/chunk-V6LEGHTB.cjs +47 -0
- package/dist/chunk-WAGU7L62.cjs +358 -0
- package/dist/chunk-XGDVC6AM.cjs +39 -0
- package/dist/chunk-XGOYEDHP.cjs +131 -0
- package/dist/chunk-Y73PCV6G.js +55 -0
- package/dist/chunk-ZAEOJ4ND.cjs +82 -0
- package/dist/chunk-ZGSL4YCI.cjs +81 -0
- package/package.json +3 -3
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLogLevelLabel
|
|
3
|
+
} from "./chunk-K4CDYUQR.js";
|
|
4
|
+
import {
|
|
5
|
+
correctPaths
|
|
6
|
+
} from "./chunk-7IMLZPZF.js";
|
|
7
|
+
|
|
8
|
+
// src/env/get-env.ts
|
|
9
|
+
import {
|
|
10
|
+
COLOR_KEYS,
|
|
11
|
+
STORM_DEFAULT_DOCS,
|
|
12
|
+
STORM_DEFAULT_HOMEPAGE,
|
|
13
|
+
STORM_DEFAULT_LICENSING
|
|
14
|
+
} from "@storm-software/config";
|
|
15
|
+
var getExtensionEnv = (extensionName) => {
|
|
16
|
+
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
17
|
+
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
18
|
+
const name = key.replace(prefix, "").split("_").map(
|
|
19
|
+
(i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
|
|
20
|
+
).join("");
|
|
21
|
+
if (name) {
|
|
22
|
+
ret[name] = process.env[key];
|
|
23
|
+
}
|
|
24
|
+
return ret;
|
|
25
|
+
}, {});
|
|
26
|
+
};
|
|
27
|
+
var getConfigEnv = () => {
|
|
28
|
+
const prefix = "STORM_";
|
|
29
|
+
let config = {
|
|
30
|
+
extends: process.env[`${prefix}EXTENDS`] || void 0,
|
|
31
|
+
name: process.env[`${prefix}NAME`] || void 0,
|
|
32
|
+
namespace: process.env[`${prefix}NAMESPACE`] || void 0,
|
|
33
|
+
owner: process.env[`${prefix}OWNER`] || void 0,
|
|
34
|
+
bot: {
|
|
35
|
+
name: process.env[`${prefix}BOT_NAME`] || void 0,
|
|
36
|
+
email: process.env[`${prefix}BOT_EMAIL`] || void 0
|
|
37
|
+
},
|
|
38
|
+
release: {
|
|
39
|
+
banner: process.env[`${prefix}RELEASE_BANNER`] || void 0,
|
|
40
|
+
header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
|
|
41
|
+
footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
|
|
42
|
+
},
|
|
43
|
+
error: {
|
|
44
|
+
codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
|
|
45
|
+
url: process.env[`${prefix}ERROR_URL`] || void 0
|
|
46
|
+
},
|
|
47
|
+
socials: {
|
|
48
|
+
twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
|
|
49
|
+
discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
|
|
50
|
+
telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
|
|
51
|
+
slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
|
|
52
|
+
medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
|
|
53
|
+
github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
|
|
54
|
+
},
|
|
55
|
+
organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
|
|
56
|
+
name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
|
|
57
|
+
description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
|
|
58
|
+
url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
|
|
59
|
+
logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
|
|
60
|
+
icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
|
|
61
|
+
} : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
|
|
62
|
+
packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
|
|
63
|
+
license: process.env[`${prefix}LICENSE`] || void 0,
|
|
64
|
+
homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
|
|
65
|
+
docs: process.env[`${prefix}DOCS`] || void 0,
|
|
66
|
+
portal: process.env[`${prefix}PORTAL`] || void 0,
|
|
67
|
+
licensing: process.env[`${prefix}LICENSING`] || void 0,
|
|
68
|
+
contact: process.env[`${prefix}CONTACT`] || void 0,
|
|
69
|
+
support: process.env[`${prefix}SUPPORT`] || void 0,
|
|
70
|
+
timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
|
|
71
|
+
locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
|
|
72
|
+
configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
|
|
73
|
+
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
|
|
74
|
+
directories: {
|
|
75
|
+
cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
|
|
76
|
+
data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
|
|
77
|
+
config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
|
|
78
|
+
temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
|
|
79
|
+
log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
|
|
80
|
+
build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
|
|
81
|
+
},
|
|
82
|
+
skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
|
|
83
|
+
mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
|
|
84
|
+
// ci:
|
|
85
|
+
// process.env[`${prefix}CI`] !== undefined
|
|
86
|
+
// ? Boolean(
|
|
87
|
+
// process.env[`${prefix}CI`] ??
|
|
88
|
+
// process.env.CI ??
|
|
89
|
+
// process.env.CONTINUOUS_INTEGRATION
|
|
90
|
+
// )
|
|
91
|
+
// : undefined,
|
|
92
|
+
repository: process.env[`${prefix}REPOSITORY`] || void 0,
|
|
93
|
+
branch: process.env[`${prefix}BRANCH`] || void 0,
|
|
94
|
+
preid: process.env[`${prefix}PRE_ID`] || void 0,
|
|
95
|
+
registry: {
|
|
96
|
+
github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
|
|
97
|
+
npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
|
|
98
|
+
cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
|
|
99
|
+
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
100
|
+
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
101
|
+
},
|
|
102
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
103
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
104
|
+
) ? getLogLevelLabel(
|
|
105
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
106
|
+
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
107
|
+
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
108
|
+
};
|
|
109
|
+
const themeNames = Object.keys(process.env).filter(
|
|
110
|
+
(envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
|
|
111
|
+
(colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
|
|
112
|
+
)
|
|
113
|
+
);
|
|
114
|
+
config.colors = themeNames.length > 0 ? themeNames.reduce(
|
|
115
|
+
(ret, themeName) => {
|
|
116
|
+
ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
|
|
117
|
+
return ret;
|
|
118
|
+
},
|
|
119
|
+
{}
|
|
120
|
+
) : getThemeColorConfigEnv(prefix);
|
|
121
|
+
if (config.docs === STORM_DEFAULT_DOCS) {
|
|
122
|
+
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
123
|
+
config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
124
|
+
} else {
|
|
125
|
+
config.docs = `${config.homepage}/docs`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (config.licensing === STORM_DEFAULT_LICENSING) {
|
|
129
|
+
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
130
|
+
config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
|
|
131
|
+
} else {
|
|
132
|
+
config.licensing = `${config.homepage}/docs`;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const serializedConfig = process.env[`${prefix}CONFIG`];
|
|
136
|
+
if (serializedConfig) {
|
|
137
|
+
const parsed = JSON.parse(serializedConfig);
|
|
138
|
+
config = {
|
|
139
|
+
...config,
|
|
140
|
+
...parsed,
|
|
141
|
+
colors: { ...config.colors, ...parsed.colors },
|
|
142
|
+
extensions: { ...config.extensions, ...parsed.extensions }
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return config;
|
|
146
|
+
};
|
|
147
|
+
var getThemeColorConfigEnv = (prefix, theme) => {
|
|
148
|
+
const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
|
|
149
|
+
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
|
|
150
|
+
};
|
|
151
|
+
var getSingleThemeColorConfigEnv = (prefix) => {
|
|
152
|
+
return {
|
|
153
|
+
dark: process.env[`${prefix}DARK`],
|
|
154
|
+
light: process.env[`${prefix}LIGHT`],
|
|
155
|
+
brand: process.env[`${prefix}BRAND`],
|
|
156
|
+
alternate: process.env[`${prefix}ALTERNATE`],
|
|
157
|
+
accent: process.env[`${prefix}ACCENT`],
|
|
158
|
+
link: process.env[`${prefix}LINK`],
|
|
159
|
+
help: process.env[`${prefix}HELP`],
|
|
160
|
+
success: process.env[`${prefix}SUCCESS`],
|
|
161
|
+
info: process.env[`${prefix}INFO`],
|
|
162
|
+
warning: process.env[`${prefix}WARNING`],
|
|
163
|
+
danger: process.env[`${prefix}DANGER`],
|
|
164
|
+
fatal: process.env[`${prefix}FATAL`],
|
|
165
|
+
positive: process.env[`${prefix}POSITIVE`],
|
|
166
|
+
negative: process.env[`${prefix}NEGATIVE`]
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
var getMultiThemeColorConfigEnv = (prefix) => {
|
|
170
|
+
return {
|
|
171
|
+
light: getBaseThemeColorConfigEnv(
|
|
172
|
+
`${prefix}_LIGHT_`
|
|
173
|
+
),
|
|
174
|
+
dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
var getBaseThemeColorConfigEnv = (prefix) => {
|
|
178
|
+
return {
|
|
179
|
+
foreground: process.env[`${prefix}FOREGROUND`],
|
|
180
|
+
background: process.env[`${prefix}BACKGROUND`],
|
|
181
|
+
brand: process.env[`${prefix}BRAND`],
|
|
182
|
+
alternate: process.env[`${prefix}ALTERNATE`],
|
|
183
|
+
accent: process.env[`${prefix}ACCENT`],
|
|
184
|
+
link: process.env[`${prefix}LINK`],
|
|
185
|
+
help: process.env[`${prefix}HELP`],
|
|
186
|
+
success: process.env[`${prefix}SUCCESS`],
|
|
187
|
+
info: process.env[`${prefix}INFO`],
|
|
188
|
+
warning: process.env[`${prefix}WARNING`],
|
|
189
|
+
danger: process.env[`${prefix}DANGER`],
|
|
190
|
+
fatal: process.env[`${prefix}FATAL`],
|
|
191
|
+
positive: process.env[`${prefix}POSITIVE`],
|
|
192
|
+
negative: process.env[`${prefix}NEGATIVE`]
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export {
|
|
197
|
+
getExtensionEnv,
|
|
198
|
+
getConfigEnv
|
|
199
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
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 _chunkHDZDJM2Acjs = require('./chunk-HDZDJM2A.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkZAEOJ4NDcjs = require('./chunk-ZAEOJ4ND.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkM3REM2FUcjs = require('./chunk-M3REM2FU.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 || _chunkZAEOJ4NDcjs.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 : _chunkM3REM2FUcjs.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 : _chunkM3REM2FUcjs.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 : _chunkZAEOJ4NDcjs.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
|
+
_chunkHDZDJM2Acjs.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
|
+
_chunkHDZDJM2Acjs.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;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkHDZDJM2Acjs = require('./chunk-HDZDJM2A.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkIRCFHYKZcjs = require('./chunk-IRCFHYKZ.cjs');
|
|
8
|
+
|
|
9
|
+
// src/logger/create-logger.ts
|
|
10
|
+
var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
|
|
11
|
+
async function createLogger(config) {
|
|
12
|
+
const writeFatal = _chunkHDZDJM2Acjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.FATAL, config, _chalk2.default);
|
|
13
|
+
const writeError = _chunkHDZDJM2Acjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.ERROR, config, _chalk2.default);
|
|
14
|
+
const writeWarning = _chunkHDZDJM2Acjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.WARN, config, _chalk2.default);
|
|
15
|
+
const writeInfo = _chunkHDZDJM2Acjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.INFO, config, _chalk2.default);
|
|
16
|
+
const writeSuccess = _chunkHDZDJM2Acjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.SUCCESS, config, _chalk2.default);
|
|
17
|
+
const writeDebug = _chunkHDZDJM2Acjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.DEBUG, config, _chalk2.default);
|
|
18
|
+
const writeTrace = _chunkHDZDJM2Acjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.DEBUG, config, _chalk2.default);
|
|
19
|
+
return {
|
|
20
|
+
fatal: writeFatal,
|
|
21
|
+
error: writeError,
|
|
22
|
+
warning: writeWarning,
|
|
23
|
+
info: writeInfo,
|
|
24
|
+
success: writeSuccess,
|
|
25
|
+
debug: writeDebug,
|
|
26
|
+
trace: writeTrace,
|
|
27
|
+
getStopwatch: _chunkHDZDJM2Acjs.getStopwatch
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
exports.createLogger = createLogger;
|
|
@@ -0,0 +1,154 @@
|
|
|
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 _chunkCOFLNWWFcjs = require('./chunk-COFLNWWF.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkWAGU7L62cjs = require('./chunk-WAGU7L62.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkLAMW4XOLcjs = require('./chunk-LAMW4XOL.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkHDZDJM2Acjs = require('./chunk-HDZDJM2A.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkXGOYEDHPcjs = require('./chunk-XGOYEDHP.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _chunkZAEOJ4NDcjs = require('./chunk-ZAEOJ4ND.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 = _chunkZAEOJ4NDcjs.findWorkspaceRoot.call(void 0, );
|
|
35
|
+
}
|
|
36
|
+
const configEnv = _chunkCOFLNWWFcjs.getConfigEnv.call(void 0, );
|
|
37
|
+
const configFile = await _chunkLAMW4XOLcjs.getConfigFile.call(void 0, _workspaceRoot);
|
|
38
|
+
if (!configFile) {
|
|
39
|
+
if (!skipLogs) {
|
|
40
|
+
_chunkHDZDJM2Acjs.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 _chunkXGOYEDHPcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
|
|
50
|
+
const configInput = _defu2.default.call(void 0,
|
|
51
|
+
configEnv,
|
|
52
|
+
configFile,
|
|
53
|
+
defaultConfig
|
|
54
|
+
);
|
|
55
|
+
try {
|
|
56
|
+
result = _chunkXGOYEDHPcjs.applyDefaultConfig.call(void 0,
|
|
57
|
+
await _schema.stormWorkspaceConfigSchema.parseAsync(configInput)
|
|
58
|
+
);
|
|
59
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
60
|
+
} catch (error) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Failed to parse Storm Workspace configuration${_optionalChain([error, 'optionalAccess', _3 => _3.message]) ? `: ${error.message}` : ""}
|
|
63
|
+
|
|
64
|
+
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${_chunkHDZDJM2Acjs.formatLogMessage.call(void 0,
|
|
65
|
+
configInput
|
|
66
|
+
)}`,
|
|
67
|
+
{
|
|
68
|
+
cause: error
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
result = _static_cache.data;
|
|
74
|
+
}
|
|
75
|
+
if (schema && extensionName) {
|
|
76
|
+
result.extensions = {
|
|
77
|
+
...result.extensions,
|
|
78
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
_static_cache = {
|
|
82
|
+
timestamp: Date.now(),
|
|
83
|
+
data: result
|
|
84
|
+
};
|
|
85
|
+
return result;
|
|
86
|
+
};
|
|
87
|
+
var createConfigExtension = (extensionName, schema) => {
|
|
88
|
+
const extension_cache_key = { extensionName };
|
|
89
|
+
if (_extension_cache.has(extension_cache_key)) {
|
|
90
|
+
return _extension_cache.get(extension_cache_key);
|
|
91
|
+
}
|
|
92
|
+
let extension = _chunkCOFLNWWFcjs.getExtensionEnv.call(void 0, extensionName);
|
|
93
|
+
if (schema) {
|
|
94
|
+
extension = schema.parse(extension);
|
|
95
|
+
}
|
|
96
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
97
|
+
return extension;
|
|
98
|
+
};
|
|
99
|
+
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
100
|
+
const config = await createStormWorkspaceConfig(
|
|
101
|
+
void 0,
|
|
102
|
+
void 0,
|
|
103
|
+
workspaceRoot,
|
|
104
|
+
skipLogs,
|
|
105
|
+
true
|
|
106
|
+
);
|
|
107
|
+
_chunkWAGU7L62cjs.setConfigEnv.call(void 0, config);
|
|
108
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
109
|
+
_chunkHDZDJM2Acjs.writeTrace.call(void 0,
|
|
110
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
111
|
+
${_chunkHDZDJM2Acjs.formatLogMessage.call(void 0, config)}`,
|
|
112
|
+
config
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return config;
|
|
116
|
+
};
|
|
117
|
+
var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
|
|
118
|
+
try {
|
|
119
|
+
const config = await createStormWorkspaceConfig(
|
|
120
|
+
void 0,
|
|
121
|
+
void 0,
|
|
122
|
+
workspaceRoot,
|
|
123
|
+
skipLogs,
|
|
124
|
+
useDefault
|
|
125
|
+
);
|
|
126
|
+
if (!config) {
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
_chunkWAGU7L62cjs.setConfigEnv.call(void 0, config);
|
|
130
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
131
|
+
_chunkHDZDJM2Acjs.writeTrace.call(void 0,
|
|
132
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
133
|
+
${_chunkHDZDJM2Acjs.formatLogMessage.call(void 0, config)}`,
|
|
134
|
+
config
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
return config;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
if (!skipLogs) {
|
|
140
|
+
_chunkHDZDJM2Acjs.writeWarning.call(void 0,
|
|
141
|
+
`\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
|
|
142
|
+
{ logLevel: "all" }
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkHDZDJM2Acjs = require('./chunk-HDZDJM2A.cjs');
|
|
7
|
+
|
|
8
|
+
// src/utilities/process-handler.ts
|
|
9
|
+
var exitWithError = (config) => {
|
|
10
|
+
_chunkHDZDJM2Acjs.writeFatal.call(void 0, "Exiting script with an error status...", config);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
};
|
|
13
|
+
var exitWithSuccess = (config) => {
|
|
14
|
+
_chunkHDZDJM2Acjs.writeSuccess.call(void 0, "Script completed successfully. Exiting...", config);
|
|
15
|
+
process.exit(0);
|
|
16
|
+
};
|
|
17
|
+
var handleProcess = (config) => {
|
|
18
|
+
_chunkHDZDJM2Acjs.writeTrace.call(void 0,
|
|
19
|
+
`Using the following arguments to process the script: ${process.argv.join(", ")}`,
|
|
20
|
+
config
|
|
21
|
+
);
|
|
22
|
+
process.on("unhandledRejection", (error) => {
|
|
23
|
+
_chunkHDZDJM2Acjs.writeError.call(void 0,
|
|
24
|
+
`An Unhandled Rejection occurred while running the program: ${error}`,
|
|
25
|
+
config
|
|
26
|
+
);
|
|
27
|
+
exitWithError(config);
|
|
28
|
+
});
|
|
29
|
+
process.on("uncaughtException", (error) => {
|
|
30
|
+
_chunkHDZDJM2Acjs.writeError.call(void 0,
|
|
31
|
+
`An Uncaught Exception occurred while running the program: ${error.message}
|
|
32
|
+
Stacktrace: ${error.stack}`,
|
|
33
|
+
config
|
|
34
|
+
);
|
|
35
|
+
exitWithError(config);
|
|
36
|
+
});
|
|
37
|
+
process.on("SIGTERM", (signal) => {
|
|
38
|
+
_chunkHDZDJM2Acjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
|
|
39
|
+
exitWithError(config);
|
|
40
|
+
});
|
|
41
|
+
process.on("SIGINT", (signal) => {
|
|
42
|
+
_chunkHDZDJM2Acjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
|
|
43
|
+
exitWithError(config);
|
|
44
|
+
});
|
|
45
|
+
process.on("SIGHUP", (signal) => {
|
|
46
|
+
_chunkHDZDJM2Acjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
|
|
47
|
+
exitWithError(config);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
exports.exitWithError = exitWithError; exports.exitWithSuccess = exitWithSuccess; exports.handleProcess = handleProcess;
|