@storm-software/config-tools 1.171.3 → 1.171.4
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-5XVUNKW6.cjs +334 -0
- package/dist/{chunk-L2QCQ7U7.cjs → chunk-BF3O7ON5.cjs} +3 -3
- package/dist/chunk-BKQBZMGO.js +193 -0
- package/dist/chunk-DGCHLT3G.js +47 -0
- package/dist/chunk-E5XT5FVB.cjs +193 -0
- package/dist/chunk-FICRNYND.js +158 -0
- package/dist/{chunk-OBUIME4H.js → chunk-HYLJGZJL.js} +4 -4
- package/dist/chunk-JP33UHF2.cjs +158 -0
- package/dist/chunk-MFZ5PISG.cjs +40 -0
- package/dist/{chunk-7DVU4MO6.cjs → chunk-NUSRFW2L.cjs} +15 -15
- package/dist/chunk-OMZZPRFS.js +55 -0
- package/dist/chunk-T4YF5J4D.js +92 -0
- package/dist/chunk-TCSDVRRN.js +334 -0
- package/dist/chunk-VV7JCH26.cjs +92 -0
- package/dist/{chunk-5HQ3YF27.js → chunk-X5KVMDMC.js} +1 -1
- package/dist/chunk-XU52ZWXV.cjs +47 -0
- package/dist/chunk-YKHRNVKI.cjs +55 -0
- package/dist/chunk-ZBGGXYLG.js +40 -0
- package/dist/config-file/get-config-file.cjs +11 -11
- package/dist/config-file/get-config-file.js +10 -10
- package/dist/config-file/index.cjs +11 -11
- package/dist/config-file/index.js +10 -10
- package/dist/create-storm-config.cjs +14 -14
- package/dist/create-storm-config.js +13 -13
- package/dist/env/get-env.cjs +3 -3
- package/dist/env/get-env.js +2 -2
- package/dist/env/index.cjs +4 -4
- package/dist/env/index.js +6 -6
- package/dist/env/set-env.cjs +3 -3
- package/dist/env/set-env.js +2 -2
- package/dist/get-config.cjs +15 -15
- package/dist/get-config.js +14 -14
- package/dist/index.cjs +27 -27
- package/dist/index.js +42 -42
- package/dist/logger/console.cjs +5 -5
- package/dist/logger/console.js +4 -4
- package/dist/logger/create-logger.cjs +6 -6
- package/dist/logger/create-logger.js +5 -5
- package/dist/logger/index.cjs +11 -11
- package/dist/logger/index.js +11 -11
- package/dist/utilities/index.cjs +15 -15
- package/dist/utilities/index.js +19 -19
- package/dist/utilities/process-handler.cjs +6 -6
- package/dist/utilities/process-handler.js +5 -5
- package/dist/utilities/toml.cjs +7 -7
- package/dist/utilities/toml.js +6 -6
- package/package.json +2 -2
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeError,
|
|
3
|
+
writeFatal,
|
|
4
|
+
writeSuccess,
|
|
5
|
+
writeTrace
|
|
6
|
+
} from "./chunk-FICRNYND.js";
|
|
7
|
+
|
|
8
|
+
// src/utilities/process-handler.ts
|
|
9
|
+
var exitWithError = (config) => {
|
|
10
|
+
writeFatal("Exiting script with an error status...", config);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
};
|
|
13
|
+
var exitWithSuccess = (config) => {
|
|
14
|
+
writeSuccess("Script completed successfully. Exiting...", config);
|
|
15
|
+
process.exit(0);
|
|
16
|
+
};
|
|
17
|
+
var handleProcess = (config) => {
|
|
18
|
+
writeTrace(
|
|
19
|
+
`Using the following arguments to process the script: ${process.argv.join(", ")}`,
|
|
20
|
+
config
|
|
21
|
+
);
|
|
22
|
+
process.on("unhandledRejection", (error) => {
|
|
23
|
+
writeError(
|
|
24
|
+
`An Unhandled Rejection occurred while running the program: ${error}`,
|
|
25
|
+
config
|
|
26
|
+
);
|
|
27
|
+
exitWithError(config);
|
|
28
|
+
});
|
|
29
|
+
process.on("uncaughtException", (error) => {
|
|
30
|
+
writeError(
|
|
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
|
+
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
39
|
+
exitWithError(config);
|
|
40
|
+
});
|
|
41
|
+
process.on("SIGINT", (signal) => {
|
|
42
|
+
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
43
|
+
exitWithError(config);
|
|
44
|
+
});
|
|
45
|
+
process.on("SIGHUP", (signal) => {
|
|
46
|
+
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
47
|
+
exitWithError(config);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
exitWithError,
|
|
53
|
+
exitWithSuccess,
|
|
54
|
+
handleProcess
|
|
55
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeTrace
|
|
3
|
+
} from "./chunk-FICRNYND.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
|
+
};
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getLogLevel
|
|
3
|
+
} from "./chunk-4XRV4CVP.js";
|
|
4
|
+
import {
|
|
5
|
+
correctPaths
|
|
6
|
+
} from "./chunk-FRR2ZRWD.js";
|
|
7
|
+
import {
|
|
8
|
+
LogLevel
|
|
9
|
+
} from "./chunk-3QAWRU2B.js";
|
|
10
|
+
|
|
11
|
+
// src/env/set-env.ts
|
|
12
|
+
var setExtensionEnv = (extensionName, extension) => {
|
|
13
|
+
for (const key of Object.keys(extension ?? {})) {
|
|
14
|
+
if (extension[key]) {
|
|
15
|
+
const result = key?.replace(
|
|
16
|
+
/([A-Z])+/g,
|
|
17
|
+
(input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
|
|
18
|
+
).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
19
|
+
let extensionKey;
|
|
20
|
+
if (result.length === 0) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (result.length === 1) {
|
|
24
|
+
extensionKey = result[0]?.toUpperCase() ?? "";
|
|
25
|
+
} else {
|
|
26
|
+
extensionKey = result.reduce((ret, part) => {
|
|
27
|
+
return `${ret}_${part.toLowerCase()}`;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var setConfigEnv = (config) => {
|
|
35
|
+
const prefix = "STORM_";
|
|
36
|
+
if (config.extends) {
|
|
37
|
+
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
38
|
+
}
|
|
39
|
+
if (config.name) {
|
|
40
|
+
process.env[`${prefix}NAME`] = config.name;
|
|
41
|
+
}
|
|
42
|
+
if (config.namespace) {
|
|
43
|
+
process.env[`${prefix}NAMESPACE`] = config.namespace;
|
|
44
|
+
}
|
|
45
|
+
if (config.owner) {
|
|
46
|
+
process.env[`${prefix}OWNER`] = config.owner;
|
|
47
|
+
}
|
|
48
|
+
if (config.bot) {
|
|
49
|
+
process.env[`${prefix}BOT_NAME`] = config.bot.name;
|
|
50
|
+
process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
|
|
51
|
+
}
|
|
52
|
+
if (config.error) {
|
|
53
|
+
process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
|
|
54
|
+
process.env[`${prefix}ERROR_URL`] = config.error.url;
|
|
55
|
+
}
|
|
56
|
+
if (config.release) {
|
|
57
|
+
process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
|
|
58
|
+
process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
|
|
59
|
+
process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
|
|
60
|
+
}
|
|
61
|
+
if (config.account) {
|
|
62
|
+
if (config.account.twitter) {
|
|
63
|
+
process.env[`${prefix}ACCOUNT_TWITTER`] = config.account.twitter;
|
|
64
|
+
}
|
|
65
|
+
if (config.account.discord) {
|
|
66
|
+
process.env[`${prefix}ACCOUNT_DISCORD`] = config.account.discord;
|
|
67
|
+
}
|
|
68
|
+
if (config.account.telegram) {
|
|
69
|
+
process.env[`${prefix}ACCOUNT_TELEGRAM`] = config.account.telegram;
|
|
70
|
+
}
|
|
71
|
+
if (config.account.slack) {
|
|
72
|
+
process.env[`${prefix}ACCOUNT_SLACK`] = config.account.slack;
|
|
73
|
+
}
|
|
74
|
+
if (config.account.medium) {
|
|
75
|
+
process.env[`${prefix}ACCOUNT_MEDIUM`] = config.account.medium;
|
|
76
|
+
}
|
|
77
|
+
if (config.account.github) {
|
|
78
|
+
process.env[`${prefix}ACCOUNT_GITHUB`] = config.account.github;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (config.organization) {
|
|
82
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization;
|
|
83
|
+
}
|
|
84
|
+
if (config.packageManager) {
|
|
85
|
+
process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
|
|
86
|
+
}
|
|
87
|
+
if (config.license) {
|
|
88
|
+
process.env[`${prefix}LICENSE`] = config.license;
|
|
89
|
+
}
|
|
90
|
+
if (config.homepage) {
|
|
91
|
+
process.env[`${prefix}HOMEPAGE`] = config.homepage;
|
|
92
|
+
}
|
|
93
|
+
if (config.docs) {
|
|
94
|
+
process.env[`${prefix}DOCS`] = config.docs;
|
|
95
|
+
}
|
|
96
|
+
if (config.licensing) {
|
|
97
|
+
process.env[`${prefix}LICENSING`] = config.licensing;
|
|
98
|
+
}
|
|
99
|
+
if (config.contact) {
|
|
100
|
+
process.env[`${prefix}CONTACT`] = config.contact;
|
|
101
|
+
}
|
|
102
|
+
if (config.support) {
|
|
103
|
+
process.env[`${prefix}SUPPORT`] = config.support;
|
|
104
|
+
}
|
|
105
|
+
if (config.timezone) {
|
|
106
|
+
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
107
|
+
process.env.TZ = config.timezone;
|
|
108
|
+
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
109
|
+
}
|
|
110
|
+
if (config.locale) {
|
|
111
|
+
process.env[`${prefix}LOCALE`] = config.locale;
|
|
112
|
+
process.env.LOCALE = config.locale;
|
|
113
|
+
process.env.DEFAULT_LOCALE = config.locale;
|
|
114
|
+
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
115
|
+
}
|
|
116
|
+
if (config.configFile) {
|
|
117
|
+
process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
|
|
118
|
+
}
|
|
119
|
+
if (config.workspaceRoot) {
|
|
120
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
|
|
121
|
+
process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
|
|
122
|
+
process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
|
|
123
|
+
}
|
|
124
|
+
if (config.directories) {
|
|
125
|
+
if (!config.skipCache && config.directories.cache) {
|
|
126
|
+
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
127
|
+
config.directories.cache
|
|
128
|
+
);
|
|
129
|
+
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
130
|
+
}
|
|
131
|
+
if (config.directories.data) {
|
|
132
|
+
process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
|
|
133
|
+
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
134
|
+
}
|
|
135
|
+
if (config.directories.config) {
|
|
136
|
+
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
137
|
+
config.directories.config
|
|
138
|
+
);
|
|
139
|
+
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
140
|
+
}
|
|
141
|
+
if (config.directories.temp) {
|
|
142
|
+
process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
|
|
143
|
+
process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
|
|
144
|
+
}
|
|
145
|
+
if (config.directories.log) {
|
|
146
|
+
process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
|
|
147
|
+
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
148
|
+
}
|
|
149
|
+
if (config.directories.build) {
|
|
150
|
+
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
151
|
+
config.directories.build
|
|
152
|
+
);
|
|
153
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (config.skipCache !== void 0) {
|
|
157
|
+
process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
|
|
158
|
+
if (config.skipCache) {
|
|
159
|
+
process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
|
|
160
|
+
process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (config.mode) {
|
|
164
|
+
process.env[`${prefix}MODE`] = config.mode;
|
|
165
|
+
process.env.NODE_ENV = config.mode;
|
|
166
|
+
process.env.ENVIRONMENT = config.mode;
|
|
167
|
+
}
|
|
168
|
+
if (config.colors?.base?.light || config.colors?.base?.dark) {
|
|
169
|
+
for (const key of Object.keys(config.colors)) {
|
|
170
|
+
setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
setThemeColorConfigEnv(
|
|
174
|
+
`${prefix}COLOR_`,
|
|
175
|
+
config.colors
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
if (config.repository) {
|
|
179
|
+
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
180
|
+
}
|
|
181
|
+
if (config.branch) {
|
|
182
|
+
process.env[`${prefix}BRANCH`] = config.branch;
|
|
183
|
+
}
|
|
184
|
+
if (config.preid) {
|
|
185
|
+
process.env[`${prefix}PRE_ID`] = String(config.preid);
|
|
186
|
+
}
|
|
187
|
+
if (config.externalPackagePatterns) {
|
|
188
|
+
process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(
|
|
189
|
+
config.externalPackagePatterns
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
if (config.registry) {
|
|
193
|
+
if (config.registry.github) {
|
|
194
|
+
process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
|
|
195
|
+
}
|
|
196
|
+
if (config.registry.npm) {
|
|
197
|
+
process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
|
|
198
|
+
}
|
|
199
|
+
if (config.registry.cargo) {
|
|
200
|
+
process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
|
|
201
|
+
}
|
|
202
|
+
if (config.registry.cyclone) {
|
|
203
|
+
process.env[`${prefix}REGISTRY_CYCLONE`] = String(
|
|
204
|
+
config.registry.cyclone
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
if (config.registry.container) {
|
|
208
|
+
process.env[`${prefix}REGISTRY_CONTAINER`] = String(
|
|
209
|
+
config.registry.container
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (config.logLevel) {
|
|
214
|
+
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
215
|
+
process.env.LOG_LEVEL = String(config.logLevel);
|
|
216
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
217
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
218
|
+
);
|
|
219
|
+
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
220
|
+
}
|
|
221
|
+
if (config.skipConfigLogging !== void 0) {
|
|
222
|
+
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
223
|
+
config.skipConfigLogging
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
227
|
+
for (const key of Object.keys(config.extensions ?? {})) {
|
|
228
|
+
if (config.extensions[key] && Object.keys(config.extensions[key])) {
|
|
229
|
+
setExtensionEnv(key, config.extensions[key]);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
var setThemeColorConfigEnv = (prefix, config) => {
|
|
234
|
+
return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
|
|
235
|
+
};
|
|
236
|
+
var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
237
|
+
if (config.dark) {
|
|
238
|
+
process.env[`${prefix}DARK`] = config.dark;
|
|
239
|
+
}
|
|
240
|
+
if (config.light) {
|
|
241
|
+
process.env[`${prefix}LIGHT`] = config.light;
|
|
242
|
+
}
|
|
243
|
+
if (config.brand) {
|
|
244
|
+
process.env[`${prefix}BRAND`] = config.brand;
|
|
245
|
+
}
|
|
246
|
+
if (config.alternate) {
|
|
247
|
+
process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
248
|
+
}
|
|
249
|
+
if (config.accent) {
|
|
250
|
+
process.env[`${prefix}ACCENT`] = config.accent;
|
|
251
|
+
}
|
|
252
|
+
if (config.link) {
|
|
253
|
+
process.env[`${prefix}LINK`] = config.link;
|
|
254
|
+
}
|
|
255
|
+
if (config.help) {
|
|
256
|
+
process.env[`${prefix}HELP`] = config.help;
|
|
257
|
+
}
|
|
258
|
+
if (config.success) {
|
|
259
|
+
process.env[`${prefix}SUCCESS`] = config.success;
|
|
260
|
+
}
|
|
261
|
+
if (config.info) {
|
|
262
|
+
process.env[`${prefix}INFO`] = config.info;
|
|
263
|
+
}
|
|
264
|
+
if (config.warning) {
|
|
265
|
+
process.env[`${prefix}WARNING`] = config.warning;
|
|
266
|
+
}
|
|
267
|
+
if (config.danger) {
|
|
268
|
+
process.env[`${prefix}DANGER`] = config.danger;
|
|
269
|
+
}
|
|
270
|
+
if (config.fatal) {
|
|
271
|
+
process.env[`${prefix}FATAL`] = config.fatal;
|
|
272
|
+
}
|
|
273
|
+
if (config.positive) {
|
|
274
|
+
process.env[`${prefix}POSITIVE`] = config.positive;
|
|
275
|
+
}
|
|
276
|
+
if (config.negative) {
|
|
277
|
+
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
var setMultiThemeColorConfigEnv = (prefix, config) => {
|
|
281
|
+
return {
|
|
282
|
+
light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
|
|
283
|
+
dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
287
|
+
if (config.foreground) {
|
|
288
|
+
process.env[`${prefix}FOREGROUND`] = config.foreground;
|
|
289
|
+
}
|
|
290
|
+
if (config.background) {
|
|
291
|
+
process.env[`${prefix}BACKGROUND`] = config.background;
|
|
292
|
+
}
|
|
293
|
+
if (config.brand) {
|
|
294
|
+
process.env[`${prefix}BRAND`] = config.brand;
|
|
295
|
+
}
|
|
296
|
+
if (config.alternate) {
|
|
297
|
+
process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
298
|
+
}
|
|
299
|
+
if (config.accent) {
|
|
300
|
+
process.env[`${prefix}ACCENT`] = config.accent;
|
|
301
|
+
}
|
|
302
|
+
if (config.link) {
|
|
303
|
+
process.env[`${prefix}LINK`] = config.link;
|
|
304
|
+
}
|
|
305
|
+
if (config.help) {
|
|
306
|
+
process.env[`${prefix}HELP`] = config.help;
|
|
307
|
+
}
|
|
308
|
+
if (config.success) {
|
|
309
|
+
process.env[`${prefix}SUCCESS`] = config.success;
|
|
310
|
+
}
|
|
311
|
+
if (config.info) {
|
|
312
|
+
process.env[`${prefix}INFO`] = config.info;
|
|
313
|
+
}
|
|
314
|
+
if (config.warning) {
|
|
315
|
+
process.env[`${prefix}WARNING`] = config.warning;
|
|
316
|
+
}
|
|
317
|
+
if (config.danger) {
|
|
318
|
+
process.env[`${prefix}DANGER`] = config.danger;
|
|
319
|
+
}
|
|
320
|
+
if (config.fatal) {
|
|
321
|
+
process.env[`${prefix}FATAL`] = config.fatal;
|
|
322
|
+
}
|
|
323
|
+
if (config.positive) {
|
|
324
|
+
process.env[`${prefix}POSITIVE`] = config.positive;
|
|
325
|
+
}
|
|
326
|
+
if (config.negative) {
|
|
327
|
+
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export {
|
|
332
|
+
setExtensionEnv,
|
|
333
|
+
setConfigEnv
|
|
334
|
+
};
|
|
@@ -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 _chunkJP33UHF2cjs = require('./chunk-JP33UHF2.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
|
+
_chunkJP33UHF2cjs.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
|
+
_chunkJP33UHF2cjs.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,47 @@
|
|
|
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
|
+
var _chunkJP33UHF2cjs = require('./chunk-JP33UHF2.cjs');
|
|
4
|
+
|
|
5
|
+
// src/utilities/toml.ts
|
|
6
|
+
var _jtoml = require('@ltd/j-toml'); var _jtoml2 = _interopRequireDefault(_jtoml);
|
|
7
|
+
function parseCargoTomlWithTree(tree, projectRoot, projectName) {
|
|
8
|
+
const cargoTomlString = _optionalChain([tree, 'access', _ => _.read, 'call', _2 => _2(`${projectRoot}/Cargo.toml`), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
|
|
9
|
+
if (!cargoTomlString) {
|
|
10
|
+
_chunkJP33UHF2cjs.writeError.call(void 0, `Cannot find a Cargo.toml file in the ${projectName}`);
|
|
11
|
+
throw new Error();
|
|
12
|
+
}
|
|
13
|
+
return parseCargoToml(cargoTomlString);
|
|
14
|
+
}
|
|
15
|
+
function parseCargoToml(cargoString) {
|
|
16
|
+
if (!cargoString) {
|
|
17
|
+
throw new Error("Cargo.toml is empty");
|
|
18
|
+
}
|
|
19
|
+
return _jtoml2.default.parse(cargoString, {
|
|
20
|
+
x: { comment: true }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function stringifyCargoToml(cargoToml) {
|
|
24
|
+
const tomlString = _jtoml2.default.stringify(cargoToml, {
|
|
25
|
+
newlineAround: "section"
|
|
26
|
+
});
|
|
27
|
+
if (Array.isArray(tomlString)) {
|
|
28
|
+
return tomlString.join("\n");
|
|
29
|
+
}
|
|
30
|
+
return tomlString;
|
|
31
|
+
}
|
|
32
|
+
function modifyCargoTable(toml, section, key, value) {
|
|
33
|
+
toml[section] ??= _jtoml2.default.Section({});
|
|
34
|
+
toml[section][key] = typeof value === "object" && !Array.isArray(value) ? _jtoml2.default.inline(value) : typeof value === "function" ? value() : value;
|
|
35
|
+
}
|
|
36
|
+
function modifyCargoNestedTable(toml, section, key, value) {
|
|
37
|
+
toml[section] ??= {};
|
|
38
|
+
toml[section][key] = _jtoml2.default.Section(value);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
exports.parseCargoTomlWithTree = parseCargoTomlWithTree; exports.parseCargoToml = parseCargoToml; exports.stringifyCargoToml = stringifyCargoToml; exports.modifyCargoTable = modifyCargoTable; exports.modifyCargoNestedTable = modifyCargoNestedTable;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkJP33UHF2cjs = require('./chunk-JP33UHF2.cjs');
|
|
7
|
+
|
|
8
|
+
// src/utilities/process-handler.ts
|
|
9
|
+
var exitWithError = (config) => {
|
|
10
|
+
_chunkJP33UHF2cjs.writeFatal.call(void 0, "Exiting script with an error status...", config);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
};
|
|
13
|
+
var exitWithSuccess = (config) => {
|
|
14
|
+
_chunkJP33UHF2cjs.writeSuccess.call(void 0, "Script completed successfully. Exiting...", config);
|
|
15
|
+
process.exit(0);
|
|
16
|
+
};
|
|
17
|
+
var handleProcess = (config) => {
|
|
18
|
+
_chunkJP33UHF2cjs.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
|
+
_chunkJP33UHF2cjs.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
|
+
_chunkJP33UHF2cjs.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
|
+
_chunkJP33UHF2cjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
|
|
39
|
+
exitWithError(config);
|
|
40
|
+
});
|
|
41
|
+
process.on("SIGINT", (signal) => {
|
|
42
|
+
_chunkJP33UHF2cjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
|
|
43
|
+
exitWithError(config);
|
|
44
|
+
});
|
|
45
|
+
process.on("SIGHUP", (signal) => {
|
|
46
|
+
_chunkJP33UHF2cjs.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;
|