@storm-software/unbuild 0.49.59 → 0.49.66
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/bin/unbuild.cjs +392 -312
- package/bin/unbuild.js +392 -312
- package/dist/build.cjs +7 -7
- package/dist/build.js +6 -6
- package/dist/{chunk-QNJHN6NF.cjs → chunk-5LYLEQEH.cjs} +3 -3
- package/dist/{chunk-CPOQ3QRP.js → chunk-5MW4VNSZ.js} +669 -34
- package/dist/{chunk-3QBGMWVL.js → chunk-H4F245VJ.js} +1 -1
- package/dist/chunk-KRY2I44J.cjs +317 -0
- package/dist/{chunk-U2JTX5UH.js → chunk-NRCPBIXP.js} +1 -1
- package/dist/{chunk-SLMCYERU.js → chunk-OOFI7BOW.js} +1 -1
- package/dist/{chunk-KCEFJ3KA.js → chunk-QQE3PPKS.js} +1 -1
- package/dist/{chunk-WVBB4LDX.cjs → chunk-QRSVSWU2.cjs} +2 -2
- package/dist/{chunk-3UNJMX5X.cjs → chunk-ULVTNQE3.cjs} +3 -3
- package/dist/{chunk-ETV4W5W2.cjs → chunk-UM5MAKNS.cjs} +765 -130
- package/dist/chunk-VKJOPPWJ.js +317 -0
- package/dist/{chunk-37HUZIZ5.cjs → chunk-XYM4DLHB.cjs} +2 -2
- package/dist/clean.cjs +3 -3
- package/dist/clean.js +2 -2
- package/dist/index.cjs +7 -7
- package/dist/index.js +6 -6
- package/dist/plugins/analyze.cjs +3 -3
- package/dist/plugins/analyze.js +2 -2
- package/dist/plugins/on-error.cjs +3 -3
- package/dist/plugins/on-error.js +2 -2
- package/dist/plugins/tsc.cjs +3 -3
- package/dist/plugins/tsc.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-2RC3F2SN.cjs +0 -886
- package/dist/chunk-QX4UI7BX.js +0 -886
|
@@ -1,16 +1,16 @@
|
|
|
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; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5LYLEQEHcjs = require('./chunk-5LYLEQEH.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkXYM4DLHBcjs = require('./chunk-XYM4DLHB.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkULVTNQE3cjs = require('./chunk-ULVTNQE3.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkQRSVSWU2cjs = require('./chunk-QRSVSWU2.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -24,17 +24,7 @@ var _chunkWVBB4LDXcjs = require('./chunk-WVBB4LDX.cjs');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var _chunk2RC3F2SNcjs = require('./chunk-2RC3F2SN.cjs');
|
|
27
|
+
var _chunkKRY2I44Jcjs = require('./chunk-KRY2I44J.cjs');
|
|
38
28
|
|
|
39
29
|
// src/build.ts
|
|
40
30
|
|
|
@@ -60,6 +50,133 @@ var _resolve2 = require('resolve'); var _resolve3 = _interopRequireDefault(_reso
|
|
|
60
50
|
|
|
61
51
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
62
52
|
var _copyassetshandler = require('@nx/js/src/utils/assets/copy-assets-handler');
|
|
53
|
+
|
|
54
|
+
// ../config-tools/src/utilities/correct-paths.ts
|
|
55
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
56
|
+
function normalizeWindowsPath(input = "") {
|
|
57
|
+
if (!input) {
|
|
58
|
+
return input;
|
|
59
|
+
}
|
|
60
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
61
|
+
}
|
|
62
|
+
var _UNC_REGEX = /^[/\\]{2}/;
|
|
63
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
64
|
+
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
65
|
+
var correctPaths = function(path2) {
|
|
66
|
+
if (!path2 || path2.length === 0) {
|
|
67
|
+
return ".";
|
|
68
|
+
}
|
|
69
|
+
path2 = normalizeWindowsPath(path2);
|
|
70
|
+
const isUNCPath = path2.match(_UNC_REGEX);
|
|
71
|
+
const isPathAbsolute = isAbsolute(path2);
|
|
72
|
+
const trailingSeparator = path2[path2.length - 1] === "/";
|
|
73
|
+
path2 = normalizeString(path2, !isPathAbsolute);
|
|
74
|
+
if (path2.length === 0) {
|
|
75
|
+
if (isPathAbsolute) {
|
|
76
|
+
return "/";
|
|
77
|
+
}
|
|
78
|
+
return trailingSeparator ? "./" : ".";
|
|
79
|
+
}
|
|
80
|
+
if (trailingSeparator) {
|
|
81
|
+
path2 += "/";
|
|
82
|
+
}
|
|
83
|
+
if (_DRIVE_LETTER_RE.test(path2)) {
|
|
84
|
+
path2 += "/";
|
|
85
|
+
}
|
|
86
|
+
if (isUNCPath) {
|
|
87
|
+
if (!isPathAbsolute) {
|
|
88
|
+
return `//./${path2}`;
|
|
89
|
+
}
|
|
90
|
+
return `//${path2}`;
|
|
91
|
+
}
|
|
92
|
+
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
93
|
+
};
|
|
94
|
+
var joinPaths = function(...segments) {
|
|
95
|
+
let path2 = "";
|
|
96
|
+
for (const seg of segments) {
|
|
97
|
+
if (!seg) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (path2.length > 0) {
|
|
101
|
+
const pathTrailing = path2[path2.length - 1] === "/";
|
|
102
|
+
const segLeading = seg[0] === "/";
|
|
103
|
+
const both = pathTrailing && segLeading;
|
|
104
|
+
if (both) {
|
|
105
|
+
path2 += seg.slice(1);
|
|
106
|
+
} else {
|
|
107
|
+
path2 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
path2 += seg;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return correctPaths(path2);
|
|
114
|
+
};
|
|
115
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
116
|
+
let res = "";
|
|
117
|
+
let lastSegmentLength = 0;
|
|
118
|
+
let lastSlash = -1;
|
|
119
|
+
let dots = 0;
|
|
120
|
+
let char = null;
|
|
121
|
+
for (let index = 0; index <= path2.length; ++index) {
|
|
122
|
+
if (index < path2.length) {
|
|
123
|
+
char = path2[index];
|
|
124
|
+
} else if (char === "/") {
|
|
125
|
+
break;
|
|
126
|
+
} else {
|
|
127
|
+
char = "/";
|
|
128
|
+
}
|
|
129
|
+
if (char === "/") {
|
|
130
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
131
|
+
} else if (dots === 2) {
|
|
132
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
133
|
+
if (res.length > 2) {
|
|
134
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
135
|
+
if (lastSlashIndex === -1) {
|
|
136
|
+
res = "";
|
|
137
|
+
lastSegmentLength = 0;
|
|
138
|
+
} else {
|
|
139
|
+
res = res.slice(0, lastSlashIndex);
|
|
140
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
141
|
+
}
|
|
142
|
+
lastSlash = index;
|
|
143
|
+
dots = 0;
|
|
144
|
+
continue;
|
|
145
|
+
} else if (res.length > 0) {
|
|
146
|
+
res = "";
|
|
147
|
+
lastSegmentLength = 0;
|
|
148
|
+
lastSlash = index;
|
|
149
|
+
dots = 0;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (allowAboveRoot) {
|
|
154
|
+
res += res.length > 0 ? "/.." : "..";
|
|
155
|
+
lastSegmentLength = 2;
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
if (res.length > 0) {
|
|
159
|
+
res += `/${path2.slice(lastSlash + 1, index)}`;
|
|
160
|
+
} else {
|
|
161
|
+
res = path2.slice(lastSlash + 1, index);
|
|
162
|
+
}
|
|
163
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
164
|
+
}
|
|
165
|
+
lastSlash = index;
|
|
166
|
+
dots = 0;
|
|
167
|
+
} else if (char === "." && dots !== -1) {
|
|
168
|
+
++dots;
|
|
169
|
+
} else {
|
|
170
|
+
dots = -1;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return res;
|
|
174
|
+
}
|
|
175
|
+
var isAbsolute = function(p) {
|
|
176
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// ../build-tools/src/utilities/copy-assets.ts
|
|
63
180
|
var _glob = require('glob');
|
|
64
181
|
var _promises = require('fs/promises');
|
|
65
182
|
var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
@@ -88,9 +205,9 @@ var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, gen
|
|
|
88
205
|
output: "src/"
|
|
89
206
|
});
|
|
90
207
|
}
|
|
91
|
-
|
|
208
|
+
_chunkKRY2I44Jcjs.writeTrace.call(void 0,
|
|
92
209
|
`\u{1F4DD} Copying the following assets to the output directory:
|
|
93
|
-
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${
|
|
210
|
+
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
|
|
94
211
|
config
|
|
95
212
|
);
|
|
96
213
|
const assetHandler = new (0, _copyassetshandler.CopyAssetsHandler)({
|
|
@@ -100,20 +217,20 @@ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${p
|
|
|
100
217
|
assets: pendingAssets
|
|
101
218
|
});
|
|
102
219
|
await assetHandler.processAllAssetsOnce();
|
|
103
|
-
|
|
220
|
+
_chunkKRY2I44Jcjs.writeTrace.call(void 0, "Completed copying assets to the output directory", config);
|
|
104
221
|
if (includeSrc === true) {
|
|
105
|
-
|
|
106
|
-
`\u{1F4DD} Adding banner and writing source files: ${
|
|
222
|
+
_chunkKRY2I44Jcjs.writeDebug.call(void 0,
|
|
223
|
+
`\u{1F4DD} Adding banner and writing source files: ${joinPaths(
|
|
107
224
|
outputPath,
|
|
108
225
|
"src"
|
|
109
226
|
)}`,
|
|
110
227
|
config
|
|
111
228
|
);
|
|
112
229
|
const files = await _glob.glob.call(void 0, [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
230
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
231
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
232
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
233
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
117
234
|
]);
|
|
118
235
|
await Promise.allSettled(
|
|
119
236
|
files.map(
|
|
@@ -133,6 +250,102 @@ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `//
|
|
|
133
250
|
// ../build-tools/src/utilities/generate-package-json.ts
|
|
134
251
|
|
|
135
252
|
|
|
253
|
+
// ../config-tools/src/utilities/find-up.ts
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
257
|
+
var depth = 0;
|
|
258
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
259
|
+
const _startPath = _nullishCoalesce(startPath, () => ( process.cwd()));
|
|
260
|
+
if (endDirectoryNames.some(
|
|
261
|
+
(endDirName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endDirName))
|
|
262
|
+
)) {
|
|
263
|
+
return _startPath;
|
|
264
|
+
}
|
|
265
|
+
if (endFileNames.some(
|
|
266
|
+
(endFileName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endFileName))
|
|
267
|
+
)) {
|
|
268
|
+
return _startPath;
|
|
269
|
+
}
|
|
270
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
271
|
+
const parent = _path.join.call(void 0, _startPath, "..");
|
|
272
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
273
|
+
}
|
|
274
|
+
return void 0;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// ../config-tools/src/utilities/find-workspace-root.ts
|
|
278
|
+
var rootFiles = [
|
|
279
|
+
"storm-workspace.json",
|
|
280
|
+
"storm-workspace.yaml",
|
|
281
|
+
"storm-workspace.yml",
|
|
282
|
+
"storm-workspace.js",
|
|
283
|
+
"storm-workspace.ts",
|
|
284
|
+
".storm-workspace.json",
|
|
285
|
+
".storm-workspace.yaml",
|
|
286
|
+
".storm-workspace.yml",
|
|
287
|
+
".storm-workspace.js",
|
|
288
|
+
".storm-workspace.ts",
|
|
289
|
+
"lerna.json",
|
|
290
|
+
"nx.json",
|
|
291
|
+
"turbo.json",
|
|
292
|
+
"npm-workspace.json",
|
|
293
|
+
"yarn-workspace.json",
|
|
294
|
+
"pnpm-workspace.json",
|
|
295
|
+
"npm-workspace.yaml",
|
|
296
|
+
"yarn-workspace.yaml",
|
|
297
|
+
"pnpm-workspace.yaml",
|
|
298
|
+
"npm-workspace.yml",
|
|
299
|
+
"yarn-workspace.yml",
|
|
300
|
+
"pnpm-workspace.yml",
|
|
301
|
+
"npm-lock.json",
|
|
302
|
+
"yarn-lock.json",
|
|
303
|
+
"pnpm-lock.json",
|
|
304
|
+
"npm-lock.yaml",
|
|
305
|
+
"yarn-lock.yaml",
|
|
306
|
+
"pnpm-lock.yaml",
|
|
307
|
+
"npm-lock.yml",
|
|
308
|
+
"yarn-lock.yml",
|
|
309
|
+
"pnpm-lock.yml",
|
|
310
|
+
"bun.lockb"
|
|
311
|
+
];
|
|
312
|
+
var rootDirectories = [
|
|
313
|
+
".storm-workspace",
|
|
314
|
+
".nx",
|
|
315
|
+
".github",
|
|
316
|
+
".vscode",
|
|
317
|
+
".verdaccio"
|
|
318
|
+
];
|
|
319
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
320
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
321
|
+
return correctPaths(
|
|
322
|
+
_nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH))
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
return correctPaths(
|
|
326
|
+
findFolderUp(
|
|
327
|
+
_nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())),
|
|
328
|
+
rootFiles,
|
|
329
|
+
rootDirectories
|
|
330
|
+
)
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
334
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
335
|
+
if (!result) {
|
|
336
|
+
throw new Error(
|
|
337
|
+
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
338
|
+
${rootFiles.join(
|
|
339
|
+
"\n"
|
|
340
|
+
)}
|
|
341
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
return result;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// ../build-tools/src/utilities/generate-package-json.ts
|
|
348
|
+
|
|
136
349
|
|
|
137
350
|
|
|
138
351
|
|
|
@@ -168,7 +381,7 @@ var addPackageDependencies = async (workspaceRoot, projectRoot, projectName, pac
|
|
|
168
381
|
)) {
|
|
169
382
|
const projectNode = project.node;
|
|
170
383
|
if (projectNode.data.root) {
|
|
171
|
-
const projectPackageJsonPath =
|
|
384
|
+
const projectPackageJsonPath = joinPaths(
|
|
172
385
|
workspaceRoot,
|
|
173
386
|
projectNode.data.root,
|
|
174
387
|
"package.json"
|
|
@@ -186,11 +399,11 @@ var addPackageDependencies = async (workspaceRoot, projectRoot, projectName, pac
|
|
|
186
399
|
}
|
|
187
400
|
}
|
|
188
401
|
if (localPackages.length > 0) {
|
|
189
|
-
|
|
402
|
+
_chunkKRY2I44Jcjs.writeTrace.call(void 0,
|
|
190
403
|
`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
|
|
191
404
|
);
|
|
192
405
|
const projectJsonFile = await _promises.readFile.call(void 0,
|
|
193
|
-
|
|
406
|
+
joinPaths(projectRoot, "project.json"),
|
|
194
407
|
"utf8"
|
|
195
408
|
);
|
|
196
409
|
const projectJson = JSON.parse(projectJsonFile);
|
|
@@ -203,7 +416,7 @@ var addPackageDependencies = async (workspaceRoot, projectRoot, projectName, pac
|
|
|
203
416
|
}
|
|
204
417
|
const implicitDependencies = _optionalChain([projectConfigurations, 'access', _9 => _9.projects, 'optionalAccess', _10 => _10[projectName2], 'access', _11 => _11.implicitDependencies, 'optionalAccess', _12 => _12.reduce, 'call', _13 => _13((ret, dep) => {
|
|
205
418
|
if (_optionalChain([projectConfigurations, 'access', _14 => _14.projects, 'optionalAccess', _15 => _15[dep]])) {
|
|
206
|
-
const depPackageJsonPath =
|
|
419
|
+
const depPackageJsonPath = joinPaths(
|
|
207
420
|
workspaceRoot,
|
|
208
421
|
projectConfigurations.projects[dep].root,
|
|
209
422
|
"package.json"
|
|
@@ -234,14 +447,14 @@ var addPackageDependencies = async (workspaceRoot, projectRoot, projectName, pac
|
|
|
234
447
|
return ret;
|
|
235
448
|
}, _nullishCoalesce(packageJson.devDependencies, () => ( {})));
|
|
236
449
|
} else {
|
|
237
|
-
|
|
450
|
+
_chunkKRY2I44Jcjs.writeTrace.call(void 0, "\u{1F4E6} No local packages dependencies to add to package.json");
|
|
238
451
|
}
|
|
239
452
|
return packageJson;
|
|
240
453
|
};
|
|
241
454
|
var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
242
|
-
const workspaceRoot = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot :
|
|
455
|
+
const workspaceRoot = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
|
|
243
456
|
const workspacePackageJsonContent = await _promises.readFile.call(void 0,
|
|
244
|
-
|
|
457
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
245
458
|
"utf8"
|
|
246
459
|
);
|
|
247
460
|
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
@@ -252,7 +465,7 @@ var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceR
|
|
|
252
465
|
if (distSrc.startsWith("/")) {
|
|
253
466
|
distSrc = distSrc.substring(1);
|
|
254
467
|
}
|
|
255
|
-
packageJson.source ??= `${
|
|
468
|
+
packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
256
469
|
}
|
|
257
470
|
packageJson.files ??= ["dist/**/*"];
|
|
258
471
|
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
@@ -277,24 +490,407 @@ var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceR
|
|
|
277
490
|
packageJson.contributors = [packageJson.author];
|
|
278
491
|
}
|
|
279
492
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
280
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot :
|
|
493
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
|
|
281
494
|
return packageJson;
|
|
282
495
|
};
|
|
283
496
|
|
|
284
497
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
285
498
|
var _c12 = require('c12');
|
|
286
499
|
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
|
|
500
|
+
|
|
501
|
+
// ../config/src/constants.ts
|
|
502
|
+
var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
|
|
503
|
+
var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
|
|
504
|
+
var STORM_DEFAULT_CONTACT = "https://stormsoftware.com/contact";
|
|
505
|
+
var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
|
|
506
|
+
var STORM_DEFAULT_LICENSE = "Apache-2.0";
|
|
507
|
+
var STORM_DEFAULT_SOCIAL_TWITTER = "StormSoftwareHQ";
|
|
508
|
+
var STORM_DEFAULT_SOCIAL_DISCORD = "https://discord.gg/MQ6YVzakM5";
|
|
509
|
+
var STORM_DEFAULT_SOCIAL_TELEGRAM = "https://t.me/storm_software";
|
|
510
|
+
var STORM_DEFAULT_SOCIAL_SLACK = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
|
|
511
|
+
var STORM_DEFAULT_SOCIAL_MEDIUM = "https://medium.com/storm-software";
|
|
512
|
+
var STORM_DEFAULT_SOCIAL_GITHUB = "https://github.com/storm-software";
|
|
513
|
+
var STORM_DEFAULT_RELEASE_FOOTER = `
|
|
514
|
+
Storm Software is an open source software development organization with the mission is to make software development more accessible. Our ideal future is one where anyone can create software without years of prior development experience serving as a barrier to entry. We hope to achieve this via LLMs, Generative AI, and intuitive, high-level data modeling/programming languages.
|
|
515
|
+
|
|
516
|
+
Join us on [Discord](${STORM_DEFAULT_SOCIAL_DISCORD}) to chat with the team, receive release notifications, ask questions, and get involved.
|
|
517
|
+
|
|
518
|
+
If this sounds interesting, and you would like to help us in creating the next generation of development tools, please reach out on our [website](${STORM_DEFAULT_CONTACT}) or join our [Slack](${STORM_DEFAULT_SOCIAL_SLACK}) channel!
|
|
519
|
+
`;
|
|
520
|
+
var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
|
|
521
|
+
|
|
522
|
+
// ../config/src/schema.ts
|
|
523
|
+
var _zod = require('zod'); var z = _interopRequireWildcard(_zod);
|
|
524
|
+
var ColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7);
|
|
525
|
+
var DarkColorSchema = ColorSchema.default("#151718").describe(
|
|
526
|
+
"The dark background color of the workspace"
|
|
527
|
+
);
|
|
528
|
+
var LightColorSchema = ColorSchema.default("#cbd5e1").describe(
|
|
529
|
+
"The light background color of the workspace"
|
|
530
|
+
);
|
|
531
|
+
var BrandColorSchema = ColorSchema.default("#1fb2a6").describe(
|
|
532
|
+
"The primary brand specific color of the workspace"
|
|
533
|
+
);
|
|
534
|
+
var AlternateColorSchema = ColorSchema.optional().describe(
|
|
535
|
+
"The alternate brand specific color of the workspace"
|
|
536
|
+
);
|
|
537
|
+
var AccentColorSchema = ColorSchema.optional().describe(
|
|
538
|
+
"The secondary brand specific color of the workspace"
|
|
539
|
+
);
|
|
540
|
+
var LinkColorSchema = ColorSchema.default("#3fa6ff").describe(
|
|
541
|
+
"The color used to display hyperlink text"
|
|
542
|
+
);
|
|
543
|
+
var HelpColorSchema = ColorSchema.default("#818cf8").describe(
|
|
544
|
+
"The second brand specific color of the workspace"
|
|
545
|
+
);
|
|
546
|
+
var SuccessColorSchema = ColorSchema.default("#45b27e").describe(
|
|
547
|
+
"The success color of the workspace"
|
|
548
|
+
);
|
|
549
|
+
var InfoColorSchema = ColorSchema.default("#38bdf8").describe(
|
|
550
|
+
"The informational color of the workspace"
|
|
551
|
+
);
|
|
552
|
+
var WarningColorSchema = ColorSchema.default("#f3d371").describe(
|
|
553
|
+
"The warning color of the workspace"
|
|
554
|
+
);
|
|
555
|
+
var DangerColorSchema = ColorSchema.default("#d8314a").describe(
|
|
556
|
+
"The danger color of the workspace"
|
|
557
|
+
);
|
|
558
|
+
var FatalColorSchema = ColorSchema.optional().describe(
|
|
559
|
+
"The fatal color of the workspace"
|
|
560
|
+
);
|
|
561
|
+
var PositiveColorSchema = ColorSchema.default("#4ade80").describe(
|
|
562
|
+
"The positive number color of the workspace"
|
|
563
|
+
);
|
|
564
|
+
var NegativeColorSchema = ColorSchema.default("#ef4444").describe(
|
|
565
|
+
"The negative number color of the workspace"
|
|
566
|
+
);
|
|
567
|
+
var GradientStopsSchema = z.array(ColorSchema).optional().describe(
|
|
568
|
+
"The color stops for the base gradient color pattern used in the workspace"
|
|
569
|
+
);
|
|
570
|
+
var DarkThemeColorConfigSchema = z.object({
|
|
571
|
+
foreground: LightColorSchema,
|
|
572
|
+
background: DarkColorSchema,
|
|
573
|
+
brand: BrandColorSchema,
|
|
574
|
+
alternate: AlternateColorSchema,
|
|
575
|
+
accent: AccentColorSchema,
|
|
576
|
+
link: LinkColorSchema,
|
|
577
|
+
help: HelpColorSchema,
|
|
578
|
+
success: SuccessColorSchema,
|
|
579
|
+
info: InfoColorSchema,
|
|
580
|
+
warning: WarningColorSchema,
|
|
581
|
+
danger: DangerColorSchema,
|
|
582
|
+
fatal: FatalColorSchema,
|
|
583
|
+
positive: PositiveColorSchema,
|
|
584
|
+
negative: NegativeColorSchema,
|
|
585
|
+
gradient: GradientStopsSchema
|
|
586
|
+
});
|
|
587
|
+
var LightThemeColorConfigSchema = z.object({
|
|
588
|
+
foreground: DarkColorSchema,
|
|
589
|
+
background: LightColorSchema,
|
|
590
|
+
brand: BrandColorSchema,
|
|
591
|
+
alternate: AlternateColorSchema,
|
|
592
|
+
accent: AccentColorSchema,
|
|
593
|
+
link: LinkColorSchema,
|
|
594
|
+
help: HelpColorSchema,
|
|
595
|
+
success: SuccessColorSchema,
|
|
596
|
+
info: InfoColorSchema,
|
|
597
|
+
warning: WarningColorSchema,
|
|
598
|
+
danger: DangerColorSchema,
|
|
599
|
+
fatal: FatalColorSchema,
|
|
600
|
+
positive: PositiveColorSchema,
|
|
601
|
+
negative: NegativeColorSchema,
|
|
602
|
+
gradient: GradientStopsSchema
|
|
603
|
+
});
|
|
604
|
+
var MultiThemeColorConfigSchema = z.object({
|
|
605
|
+
dark: DarkThemeColorConfigSchema,
|
|
606
|
+
light: LightThemeColorConfigSchema
|
|
607
|
+
});
|
|
608
|
+
var SingleThemeColorConfigSchema = z.object({
|
|
609
|
+
dark: DarkColorSchema,
|
|
610
|
+
light: LightColorSchema,
|
|
611
|
+
brand: BrandColorSchema,
|
|
612
|
+
alternate: AlternateColorSchema,
|
|
613
|
+
accent: AccentColorSchema,
|
|
614
|
+
link: LinkColorSchema,
|
|
615
|
+
help: HelpColorSchema,
|
|
616
|
+
success: SuccessColorSchema,
|
|
617
|
+
info: InfoColorSchema,
|
|
618
|
+
warning: WarningColorSchema,
|
|
619
|
+
danger: DangerColorSchema,
|
|
620
|
+
fatal: FatalColorSchema,
|
|
621
|
+
positive: PositiveColorSchema,
|
|
622
|
+
negative: NegativeColorSchema,
|
|
623
|
+
gradient: GradientStopsSchema
|
|
624
|
+
});
|
|
625
|
+
var RegistryUrlConfigSchema = z.url().optional().describe("A remote registry URL used to publish distributable packages");
|
|
626
|
+
var RegistryConfigSchema = z.object({
|
|
627
|
+
github: RegistryUrlConfigSchema,
|
|
628
|
+
npm: RegistryUrlConfigSchema,
|
|
629
|
+
cargo: RegistryUrlConfigSchema,
|
|
630
|
+
cyclone: RegistryUrlConfigSchema,
|
|
631
|
+
container: RegistryUrlConfigSchema
|
|
632
|
+
}).default({}).describe("A list of remote registry URLs used by Storm Software");
|
|
633
|
+
var ColorConfigSchema = SingleThemeColorConfigSchema.or(
|
|
634
|
+
MultiThemeColorConfigSchema
|
|
635
|
+
).describe("Colors used for various workspace elements");
|
|
636
|
+
var ColorConfigMapSchema = z.record(
|
|
637
|
+
z.union([z.literal("base"), z.string()]),
|
|
638
|
+
ColorConfigSchema
|
|
639
|
+
);
|
|
640
|
+
var ExtendsItemSchema = z.string().trim().describe(
|
|
641
|
+
"The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
|
|
642
|
+
);
|
|
643
|
+
var ExtendsSchema = ExtendsItemSchema.or(
|
|
644
|
+
z.array(ExtendsItemSchema)
|
|
645
|
+
).describe(
|
|
646
|
+
"The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
|
|
647
|
+
);
|
|
648
|
+
var WorkspaceBotConfigSchema = z.object({
|
|
649
|
+
name: z.string().trim().default("stormie-bot").describe(
|
|
650
|
+
"The workspace bot user's name (this is the bot that will be used to perform various tasks)"
|
|
651
|
+
),
|
|
652
|
+
email: z.email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
653
|
+
}).describe(
|
|
654
|
+
"The workspace's bot user's config used to automated various operations tasks"
|
|
655
|
+
);
|
|
656
|
+
var WorkspaceReleaseConfigSchema = z.object({
|
|
657
|
+
banner: z.string().trim().optional().describe(
|
|
658
|
+
"A URL to a banner image used to display the workspace's release"
|
|
659
|
+
),
|
|
660
|
+
header: z.string().trim().optional().describe(
|
|
661
|
+
"A header message appended to the start of the workspace's release notes"
|
|
662
|
+
),
|
|
663
|
+
footer: z.string().trim().optional().describe(
|
|
664
|
+
"A footer message appended to the end of the workspace's release notes"
|
|
665
|
+
)
|
|
666
|
+
}).describe("The workspace's release config used during the release process");
|
|
667
|
+
var WorkspaceSocialsConfigSchema = z.object({
|
|
668
|
+
twitter: z.string().trim().default(STORM_DEFAULT_SOCIAL_TWITTER).describe("A Twitter/X account associated with the organization/project"),
|
|
669
|
+
discord: z.string().trim().default(STORM_DEFAULT_SOCIAL_DISCORD).describe("A Discord account associated with the organization/project"),
|
|
670
|
+
telegram: z.string().trim().default(STORM_DEFAULT_SOCIAL_TELEGRAM).describe("A Telegram account associated with the organization/project"),
|
|
671
|
+
slack: z.string().trim().default(STORM_DEFAULT_SOCIAL_SLACK).describe("A Slack account associated with the organization/project"),
|
|
672
|
+
medium: z.string().trim().default(STORM_DEFAULT_SOCIAL_MEDIUM).describe("A Medium account associated with the organization/project"),
|
|
673
|
+
github: z.string().trim().default(STORM_DEFAULT_SOCIAL_GITHUB).describe("A GitHub account associated with the organization/project")
|
|
674
|
+
}).describe(
|
|
675
|
+
"The workspace's account config used to store various social media links"
|
|
676
|
+
);
|
|
677
|
+
var WorkspaceDirectoryConfigSchema = z.object({
|
|
678
|
+
cache: z.string().trim().optional().describe(
|
|
679
|
+
"The directory used to store the environment's cached file data"
|
|
680
|
+
),
|
|
681
|
+
data: z.string().trim().optional().describe("The directory used to store the environment's data files"),
|
|
682
|
+
config: z.string().trim().optional().describe(
|
|
683
|
+
"The directory used to store the environment's configuration files"
|
|
684
|
+
),
|
|
685
|
+
temp: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
686
|
+
log: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
687
|
+
build: z.string().trim().default("dist").describe(
|
|
688
|
+
"The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
|
|
689
|
+
)
|
|
690
|
+
}).describe(
|
|
691
|
+
"Various directories used by the workspace to store data, cache, and configuration files"
|
|
692
|
+
);
|
|
693
|
+
var errorConfigSchema = z.object({
|
|
694
|
+
codesFile: z.string().trim().default(STORM_DEFAULT_ERROR_CODES_FILE).describe("The path to the workspace's error codes JSON file"),
|
|
695
|
+
url: z.url().optional().describe(
|
|
696
|
+
"A URL to a page that looks up the workspace's error messages given a specific error code"
|
|
697
|
+
)
|
|
698
|
+
}).describe("The workspace's error config used during the error process");
|
|
699
|
+
var organizationConfigSchema = z.object({
|
|
700
|
+
name: z.string().trim().describe("The name of the organization"),
|
|
701
|
+
description: z.string().trim().optional().describe("A description of the organization"),
|
|
702
|
+
logo: z.url().optional().describe("A URL to the organization's logo image"),
|
|
703
|
+
icon: z.url().optional().describe("A URL to the organization's icon image"),
|
|
704
|
+
url: z.url().optional().describe(
|
|
705
|
+
"A URL to a page that provides more information about the organization"
|
|
706
|
+
)
|
|
707
|
+
}).describe("The workspace's organization details");
|
|
708
|
+
var stormWorkspaceConfigSchema = z.object({
|
|
709
|
+
$schema: z.string().trim().default(
|
|
710
|
+
"https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
|
|
711
|
+
).describe(
|
|
712
|
+
"The URL or file path to the JSON schema file that describes the Storm configuration file"
|
|
713
|
+
),
|
|
714
|
+
extends: ExtendsSchema.optional(),
|
|
715
|
+
name: z.string().trim().toLowerCase().optional().describe(
|
|
716
|
+
"The name of the service/package/scope using this configuration"
|
|
717
|
+
),
|
|
718
|
+
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
719
|
+
organization: organizationConfigSchema.or(z.string().trim().describe("The organization of the workspace")).optional().describe(
|
|
720
|
+
"The organization of the workspace. This can be a string or an object containing the organization's details"
|
|
721
|
+
),
|
|
722
|
+
repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
723
|
+
license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
|
|
724
|
+
homepage: z.url().optional().describe("The homepage of the workspace"),
|
|
725
|
+
docs: z.url().optional().describe("The documentation site for the workspace"),
|
|
726
|
+
portal: z.url().optional().describe("The development portal site for the workspace"),
|
|
727
|
+
licensing: z.url().optional().describe("The licensing site for the workspace"),
|
|
728
|
+
contact: z.url().optional().describe("The contact site for the workspace"),
|
|
729
|
+
support: z.url().optional().describe(
|
|
730
|
+
"The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
|
|
731
|
+
),
|
|
732
|
+
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
733
|
+
preid: z.string().optional().describe("A tag specifying the version pre-release identifier"),
|
|
734
|
+
owner: z.string().trim().default("@storm-software/admin").describe("The owner of the package"),
|
|
735
|
+
bot: WorkspaceBotConfigSchema,
|
|
736
|
+
release: WorkspaceReleaseConfigSchema,
|
|
737
|
+
socials: WorkspaceSocialsConfigSchema,
|
|
738
|
+
error: errorConfigSchema,
|
|
739
|
+
mode: z.string().trim().default("production").describe("The current runtime environment mode for the package"),
|
|
740
|
+
workspaceRoot: z.string().trim().describe("The root directory of the workspace"),
|
|
741
|
+
skipCache: z.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
|
|
742
|
+
directories: WorkspaceDirectoryConfigSchema,
|
|
743
|
+
packageManager: z.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe(
|
|
744
|
+
"The JavaScript/TypeScript package manager used by the repository"
|
|
745
|
+
),
|
|
746
|
+
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
747
|
+
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
748
|
+
logLevel: z.enum([
|
|
749
|
+
"silent",
|
|
750
|
+
"fatal",
|
|
751
|
+
"error",
|
|
752
|
+
"warn",
|
|
753
|
+
"success",
|
|
754
|
+
"info",
|
|
755
|
+
"debug",
|
|
756
|
+
"trace",
|
|
757
|
+
"all"
|
|
758
|
+
]).default("info").describe(
|
|
759
|
+
"The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
|
|
760
|
+
),
|
|
761
|
+
skipConfigLogging: z.boolean().optional().describe(
|
|
762
|
+
"Should the logging of the current Storm Workspace configuration be skipped?"
|
|
763
|
+
),
|
|
764
|
+
registry: RegistryConfigSchema,
|
|
765
|
+
configFile: z.string().trim().nullable().default(null).describe(
|
|
766
|
+
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
767
|
+
),
|
|
768
|
+
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe(
|
|
769
|
+
"Storm theme config values used for styling various package elements"
|
|
770
|
+
),
|
|
771
|
+
extensions: z.record(z.string(), z.any()).optional().default({}).describe("Configuration of each used extension")
|
|
772
|
+
}).describe(
|
|
773
|
+
"Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
|
|
774
|
+
);
|
|
775
|
+
|
|
776
|
+
// ../config/src/types.ts
|
|
777
|
+
var COLOR_KEYS = [
|
|
778
|
+
"dark",
|
|
779
|
+
"light",
|
|
780
|
+
"base",
|
|
781
|
+
"brand",
|
|
782
|
+
"alternate",
|
|
783
|
+
"accent",
|
|
784
|
+
"link",
|
|
785
|
+
"success",
|
|
786
|
+
"help",
|
|
787
|
+
"info",
|
|
788
|
+
"warning",
|
|
789
|
+
"danger",
|
|
790
|
+
"fatal",
|
|
791
|
+
"positive",
|
|
792
|
+
"negative"
|
|
793
|
+
];
|
|
794
|
+
|
|
795
|
+
// ../config-tools/src/utilities/get-default-config.ts
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
async function getPackageJsonConfig(root) {
|
|
800
|
+
let license = STORM_DEFAULT_LICENSE;
|
|
801
|
+
let homepage = void 0;
|
|
802
|
+
let support = void 0;
|
|
803
|
+
let name = void 0;
|
|
804
|
+
let namespace = void 0;
|
|
805
|
+
let repository = void 0;
|
|
806
|
+
const workspaceRoot = findWorkspaceRoot(root);
|
|
807
|
+
if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
|
|
808
|
+
const file = await _promises.readFile.call(void 0,
|
|
809
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
810
|
+
"utf8"
|
|
811
|
+
);
|
|
812
|
+
if (file) {
|
|
813
|
+
const packageJson = JSON.parse(file);
|
|
814
|
+
if (packageJson.name) {
|
|
815
|
+
name = packageJson.name;
|
|
816
|
+
}
|
|
817
|
+
if (packageJson.namespace) {
|
|
818
|
+
namespace = packageJson.namespace;
|
|
819
|
+
}
|
|
820
|
+
if (packageJson.repository) {
|
|
821
|
+
if (typeof packageJson.repository === "string") {
|
|
822
|
+
repository = packageJson.repository;
|
|
823
|
+
} else if (packageJson.repository.url) {
|
|
824
|
+
repository = packageJson.repository.url;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
if (packageJson.license) {
|
|
828
|
+
license = packageJson.license;
|
|
829
|
+
}
|
|
830
|
+
if (packageJson.homepage) {
|
|
831
|
+
homepage = packageJson.homepage;
|
|
832
|
+
}
|
|
833
|
+
if (packageJson.bugs) {
|
|
834
|
+
if (typeof packageJson.bugs === "string") {
|
|
835
|
+
support = packageJson.bugs;
|
|
836
|
+
} else if (packageJson.bugs.url) {
|
|
837
|
+
support = packageJson.bugs.url;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return {
|
|
843
|
+
workspaceRoot,
|
|
844
|
+
name,
|
|
845
|
+
namespace,
|
|
846
|
+
repository,
|
|
847
|
+
license,
|
|
848
|
+
homepage,
|
|
849
|
+
support
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
function applyDefaultConfig(config) {
|
|
853
|
+
if (!config.support && config.contact) {
|
|
854
|
+
config.support = config.contact;
|
|
855
|
+
}
|
|
856
|
+
if (!config.contact && config.support) {
|
|
857
|
+
config.contact = config.support;
|
|
858
|
+
}
|
|
859
|
+
if (config.homepage) {
|
|
860
|
+
if (!config.docs) {
|
|
861
|
+
config.docs = `${config.homepage}/docs`;
|
|
862
|
+
}
|
|
863
|
+
if (!config.license) {
|
|
864
|
+
config.license = `${config.homepage}/license`;
|
|
865
|
+
}
|
|
866
|
+
if (!config.support) {
|
|
867
|
+
config.support = `${config.homepage}/support`;
|
|
868
|
+
}
|
|
869
|
+
if (!config.contact) {
|
|
870
|
+
config.contact = `${config.homepage}/contact`;
|
|
871
|
+
}
|
|
872
|
+
if (!_optionalChain([config, 'access', _24 => _24.error, 'optionalAccess', _25 => _25.codesFile]) || !_optionalChain([config, 'optionalAccess', _26 => _26.error, 'optionalAccess', _27 => _27.url])) {
|
|
873
|
+
config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
|
|
874
|
+
if (config.homepage) {
|
|
875
|
+
config.error.url ??= `${config.homepage}/errors`;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
return config;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// ../config-tools/src/config-file/get-config-file.ts
|
|
287
883
|
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
288
|
-
const workspacePath = filePath ||
|
|
884
|
+
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
289
885
|
const configs = await Promise.all([
|
|
290
886
|
_c12.loadConfig.call(void 0, {
|
|
291
887
|
cwd: workspacePath,
|
|
292
888
|
packageJson: true,
|
|
293
889
|
name: fileName,
|
|
294
|
-
envName: _optionalChain([fileName, 'optionalAccess',
|
|
890
|
+
envName: _optionalChain([fileName, 'optionalAccess', _28 => _28.toUpperCase, 'call', _29 => _29()]),
|
|
295
891
|
jitiOptions: {
|
|
296
892
|
debug: false,
|
|
297
|
-
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false :
|
|
893
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
298
894
|
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
299
895
|
"jiti"
|
|
300
896
|
)
|
|
@@ -305,10 +901,10 @@ var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
|
305
901
|
cwd: workspacePath,
|
|
306
902
|
packageJson: true,
|
|
307
903
|
name: fileName,
|
|
308
|
-
envName: _optionalChain([fileName, 'optionalAccess',
|
|
904
|
+
envName: _optionalChain([fileName, 'optionalAccess', _30 => _30.toUpperCase, 'call', _31 => _31()]),
|
|
309
905
|
jitiOptions: {
|
|
310
906
|
debug: false,
|
|
311
|
-
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false :
|
|
907
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
312
908
|
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
313
909
|
"jiti"
|
|
314
910
|
)
|
|
@@ -320,12 +916,12 @@ var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
|
320
916
|
return _defu2.default.call(void 0, _nullishCoalesce(configs[0], () => ( {})), _nullishCoalesce(configs[1], () => ( {})));
|
|
321
917
|
};
|
|
322
918
|
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
323
|
-
const workspacePath = filePath ? filePath :
|
|
919
|
+
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
324
920
|
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
325
921
|
let config = result.config;
|
|
326
922
|
const configFile = result.configFile;
|
|
327
923
|
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
328
|
-
|
|
924
|
+
_chunkKRY2I44Jcjs.writeTrace.call(void 0,
|
|
329
925
|
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
|
|
330
926
|
{
|
|
331
927
|
logLevel: "all"
|
|
@@ -339,9 +935,9 @@ var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
|
339
935
|
)
|
|
340
936
|
);
|
|
341
937
|
for (const result2 of results) {
|
|
342
|
-
if (_optionalChain([result2, 'optionalAccess',
|
|
938
|
+
if (_optionalChain([result2, 'optionalAccess', _32 => _32.config]) && _optionalChain([result2, 'optionalAccess', _33 => _33.configFile]) && Object.keys(result2.config).length > 0) {
|
|
343
939
|
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
344
|
-
|
|
940
|
+
_chunkKRY2I44Jcjs.writeTrace.call(void 0,
|
|
345
941
|
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
|
|
346
942
|
{
|
|
347
943
|
logLevel: "all"
|
|
@@ -420,15 +1016,15 @@ var getConfigEnv = () => {
|
|
|
420
1016
|
support: process.env[`${prefix}SUPPORT`] || void 0,
|
|
421
1017
|
timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
|
|
422
1018
|
locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
|
|
423
|
-
configFile: process.env[`${prefix}CONFIG_FILE`] ?
|
|
424
|
-
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ?
|
|
1019
|
+
configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
|
|
1020
|
+
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
|
|
425
1021
|
directories: {
|
|
426
|
-
cache: process.env[`${prefix}CACHE_DIR`] ?
|
|
427
|
-
data: process.env[`${prefix}DATA_DIR`] ?
|
|
428
|
-
config: process.env[`${prefix}CONFIG_DIR`] ?
|
|
429
|
-
temp: process.env[`${prefix}TEMP_DIR`] ?
|
|
430
|
-
log: process.env[`${prefix}LOG_DIR`] ?
|
|
431
|
-
build: process.env[`${prefix}BUILD_DIR`] ?
|
|
1022
|
+
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,
|
|
1023
|
+
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,
|
|
1024
|
+
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,
|
|
1025
|
+
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,
|
|
1026
|
+
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,
|
|
1027
|
+
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
|
|
432
1028
|
},
|
|
433
1029
|
skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
|
|
434
1030
|
mode: (_nullishCoalesce(_nullishCoalesce(process.env[`${prefix}MODE`], () => ( process.env.NODE_ENV)), () => ( process.env.ENVIRONMENT))) || void 0,
|
|
@@ -452,13 +1048,13 @@ var getConfigEnv = () => {
|
|
|
452
1048
|
},
|
|
453
1049
|
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
454
1050
|
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
455
|
-
) ?
|
|
1051
|
+
) ? _chunkKRY2I44Jcjs.getLogLevelLabel.call(void 0,
|
|
456
1052
|
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
457
1053
|
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
458
1054
|
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
459
1055
|
};
|
|
460
1056
|
const themeNames = Object.keys(process.env).filter(
|
|
461
|
-
(envKey) => envKey.startsWith(`${prefix}COLOR_`) &&
|
|
1057
|
+
(envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
|
|
462
1058
|
(colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
|
|
463
1059
|
)
|
|
464
1060
|
);
|
|
@@ -469,16 +1065,16 @@ var getConfigEnv = () => {
|
|
|
469
1065
|
},
|
|
470
1066
|
{}
|
|
471
1067
|
) : getThemeColorConfigEnv(prefix);
|
|
472
|
-
if (config.docs ===
|
|
473
|
-
if (config.homepage ===
|
|
474
|
-
config.docs = `${
|
|
1068
|
+
if (config.docs === STORM_DEFAULT_DOCS) {
|
|
1069
|
+
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
1070
|
+
config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
475
1071
|
} else {
|
|
476
1072
|
config.docs = `${config.homepage}/docs`;
|
|
477
1073
|
}
|
|
478
1074
|
}
|
|
479
|
-
if (config.licensing ===
|
|
480
|
-
if (config.homepage ===
|
|
481
|
-
config.licensing = `${
|
|
1075
|
+
if (config.licensing === STORM_DEFAULT_LICENSING) {
|
|
1076
|
+
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
1077
|
+
config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
|
|
482
1078
|
} else {
|
|
483
1079
|
config.licensing = `${config.homepage}/docs`;
|
|
484
1080
|
}
|
|
@@ -500,6 +1096,19 @@ var getThemeColorConfigEnv = (prefix, theme) => {
|
|
|
500
1096
|
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
|
|
501
1097
|
};
|
|
502
1098
|
var getSingleThemeColorConfigEnv = (prefix) => {
|
|
1099
|
+
const gradient = [];
|
|
1100
|
+
if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
|
|
1101
|
+
gradient.push(
|
|
1102
|
+
process.env[`${prefix}GRADIENT_START`],
|
|
1103
|
+
process.env[`${prefix}GRADIENT_END`]
|
|
1104
|
+
);
|
|
1105
|
+
} else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
|
|
1106
|
+
let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
|
|
1107
|
+
while (process.env[`${prefix}GRADIENT_${index}`]) {
|
|
1108
|
+
gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
|
|
1109
|
+
index++;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
503
1112
|
return {
|
|
504
1113
|
dark: process.env[`${prefix}DARK`],
|
|
505
1114
|
light: process.env[`${prefix}LIGHT`],
|
|
@@ -514,7 +1123,8 @@ var getSingleThemeColorConfigEnv = (prefix) => {
|
|
|
514
1123
|
danger: process.env[`${prefix}DANGER`],
|
|
515
1124
|
fatal: process.env[`${prefix}FATAL`],
|
|
516
1125
|
positive: process.env[`${prefix}POSITIVE`],
|
|
517
|
-
negative: process.env[`${prefix}NEGATIVE`]
|
|
1126
|
+
negative: process.env[`${prefix}NEGATIVE`],
|
|
1127
|
+
gradient
|
|
518
1128
|
};
|
|
519
1129
|
};
|
|
520
1130
|
var getMultiThemeColorConfigEnv = (prefix) => {
|
|
@@ -526,6 +1136,19 @@ var getMultiThemeColorConfigEnv = (prefix) => {
|
|
|
526
1136
|
};
|
|
527
1137
|
};
|
|
528
1138
|
var getBaseThemeColorConfigEnv = (prefix) => {
|
|
1139
|
+
const gradient = [];
|
|
1140
|
+
if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
|
|
1141
|
+
gradient.push(
|
|
1142
|
+
process.env[`${prefix}GRADIENT_START`],
|
|
1143
|
+
process.env[`${prefix}GRADIENT_END`]
|
|
1144
|
+
);
|
|
1145
|
+
} else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
|
|
1146
|
+
let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
|
|
1147
|
+
while (process.env[`${prefix}GRADIENT_${index}`]) {
|
|
1148
|
+
gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
|
|
1149
|
+
index++;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
529
1152
|
return {
|
|
530
1153
|
foreground: process.env[`${prefix}FOREGROUND`],
|
|
531
1154
|
background: process.env[`${prefix}BACKGROUND`],
|
|
@@ -540,7 +1163,8 @@ var getBaseThemeColorConfigEnv = (prefix) => {
|
|
|
540
1163
|
danger: process.env[`${prefix}DANGER`],
|
|
541
1164
|
fatal: process.env[`${prefix}FATAL`],
|
|
542
1165
|
positive: process.env[`${prefix}POSITIVE`],
|
|
543
|
-
negative: process.env[`${prefix}NEGATIVE`]
|
|
1166
|
+
negative: process.env[`${prefix}NEGATIVE`],
|
|
1167
|
+
gradient
|
|
544
1168
|
};
|
|
545
1169
|
};
|
|
546
1170
|
|
|
@@ -548,16 +1172,16 @@ var getBaseThemeColorConfigEnv = (prefix) => {
|
|
|
548
1172
|
var setExtensionEnv = (extensionName, extension) => {
|
|
549
1173
|
for (const key of Object.keys(_nullishCoalesce(extension, () => ( {})))) {
|
|
550
1174
|
if (extension[key]) {
|
|
551
|
-
const result = _nullishCoalesce(_optionalChain([key, 'optionalAccess',
|
|
1175
|
+
const result = _nullishCoalesce(_optionalChain([key, 'optionalAccess', _34 => _34.replace, 'call', _35 => _35(
|
|
552
1176
|
/([A-Z])+/g,
|
|
553
|
-
(input) => input ? _optionalChain([input, 'access',
|
|
554
|
-
), 'access',
|
|
1177
|
+
(input) => input ? _optionalChain([input, 'access', _36 => _36[0], 'optionalAccess', _37 => _37.toUpperCase, 'call', _38 => _38()]) + input.slice(1) : ""
|
|
1178
|
+
), 'access', _39 => _39.split, 'call', _40 => _40(/(?=[A-Z])|[.\-\s_]/), 'access', _41 => _41.map, 'call', _42 => _42((x) => x.toLowerCase())]), () => ( []));
|
|
555
1179
|
let extensionKey;
|
|
556
1180
|
if (result.length === 0) {
|
|
557
1181
|
return;
|
|
558
1182
|
}
|
|
559
1183
|
if (result.length === 1) {
|
|
560
|
-
extensionKey = _nullishCoalesce(_optionalChain([result, 'access',
|
|
1184
|
+
extensionKey = _nullishCoalesce(_optionalChain([result, 'access', _43 => _43[0], 'optionalAccess', _44 => _44.toUpperCase, 'call', _45 => _45()]), () => ( ""));
|
|
561
1185
|
} else {
|
|
562
1186
|
extensionKey = result.reduce((ret, part) => {
|
|
563
1187
|
return `${ret}_${part.toLowerCase()}`;
|
|
@@ -671,48 +1295,49 @@ var setConfigEnv = (config) => {
|
|
|
671
1295
|
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
672
1296
|
process.env.TZ = config.timezone;
|
|
673
1297
|
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
1298
|
+
process.env.TIMEZONE = config.timezone;
|
|
674
1299
|
}
|
|
675
1300
|
if (config.locale) {
|
|
676
1301
|
process.env[`${prefix}LOCALE`] = config.locale;
|
|
677
|
-
process.env.LOCALE = config.locale;
|
|
678
1302
|
process.env.DEFAULT_LOCALE = config.locale;
|
|
1303
|
+
process.env.LOCALE = config.locale;
|
|
679
1304
|
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
680
1305
|
}
|
|
681
1306
|
if (config.configFile) {
|
|
682
|
-
process.env[`${prefix}CONFIG_FILE`] =
|
|
1307
|
+
process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
|
|
683
1308
|
}
|
|
684
1309
|
if (config.workspaceRoot) {
|
|
685
|
-
process.env[`${prefix}WORKSPACE_ROOT`] =
|
|
686
|
-
process.env.NX_WORKSPACE_ROOT =
|
|
687
|
-
process.env.NX_WORKSPACE_ROOT_PATH =
|
|
1310
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
|
|
1311
|
+
process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
|
|
1312
|
+
process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
|
|
688
1313
|
}
|
|
689
1314
|
if (config.directories) {
|
|
690
1315
|
if (!config.skipCache && config.directories.cache) {
|
|
691
|
-
process.env[`${prefix}CACHE_DIR`] =
|
|
1316
|
+
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
692
1317
|
config.directories.cache
|
|
693
1318
|
);
|
|
694
1319
|
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
695
1320
|
}
|
|
696
1321
|
if (config.directories.data) {
|
|
697
|
-
process.env[`${prefix}DATA_DIR`] =
|
|
1322
|
+
process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
|
|
698
1323
|
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
699
1324
|
}
|
|
700
1325
|
if (config.directories.config) {
|
|
701
|
-
process.env[`${prefix}CONFIG_DIR`] =
|
|
1326
|
+
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
702
1327
|
config.directories.config
|
|
703
1328
|
);
|
|
704
1329
|
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
705
1330
|
}
|
|
706
1331
|
if (config.directories.temp) {
|
|
707
|
-
process.env[`${prefix}TEMP_DIR`] =
|
|
1332
|
+
process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
|
|
708
1333
|
process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
|
|
709
1334
|
}
|
|
710
1335
|
if (config.directories.log) {
|
|
711
|
-
process.env[`${prefix}LOG_DIR`] =
|
|
1336
|
+
process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
|
|
712
1337
|
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
713
1338
|
}
|
|
714
1339
|
if (config.directories.build) {
|
|
715
|
-
process.env[`${prefix}BUILD_DIR`] =
|
|
1340
|
+
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
716
1341
|
config.directories.build
|
|
717
1342
|
);
|
|
718
1343
|
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
@@ -730,7 +1355,7 @@ var setConfigEnv = (config) => {
|
|
|
730
1355
|
process.env.NODE_ENV = config.mode;
|
|
731
1356
|
process.env.ENVIRONMENT = config.mode;
|
|
732
1357
|
}
|
|
733
|
-
if (_optionalChain([config, 'access',
|
|
1358
|
+
if (_optionalChain([config, 'access', _46 => _46.colors, 'optionalAccess', _47 => _47.base, 'optionalAccess', _48 => _48.light]) || _optionalChain([config, 'access', _49 => _49.colors, 'optionalAccess', _50 => _50.base, 'optionalAccess', _51 => _51.dark])) {
|
|
734
1359
|
for (const key of Object.keys(config.colors)) {
|
|
735
1360
|
setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
|
|
736
1361
|
}
|
|
@@ -774,9 +1399,9 @@ var setConfigEnv = (config) => {
|
|
|
774
1399
|
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
775
1400
|
process.env.LOG_LEVEL = String(config.logLevel);
|
|
776
1401
|
process.env.NX_VERBOSE_LOGGING = String(
|
|
777
|
-
|
|
1402
|
+
_chunkKRY2I44Jcjs.getLogLevel.call(void 0, config.logLevel) >= _chunkKRY2I44Jcjs.LogLevel.DEBUG ? true : false
|
|
778
1403
|
);
|
|
779
|
-
process.env.RUST_BACKTRACE =
|
|
1404
|
+
process.env.RUST_BACKTRACE = _chunkKRY2I44Jcjs.getLogLevel.call(void 0, config.logLevel) >= _chunkKRY2I44Jcjs.LogLevel.DEBUG ? "full" : "none";
|
|
780
1405
|
}
|
|
781
1406
|
if (config.skipConfigLogging !== void 0) {
|
|
782
1407
|
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
@@ -791,7 +1416,7 @@ var setConfigEnv = (config) => {
|
|
|
791
1416
|
}
|
|
792
1417
|
};
|
|
793
1418
|
var setThemeColorConfigEnv = (prefix, config) => {
|
|
794
|
-
return _optionalChain([config, 'optionalAccess',
|
|
1419
|
+
return _optionalChain([config, 'optionalAccess', _52 => _52.light, 'optionalAccess', _53 => _53.brand]) || _optionalChain([config, 'optionalAccess', _54 => _54.dark, 'optionalAccess', _55 => _55.brand]) ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
|
|
795
1420
|
};
|
|
796
1421
|
var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
797
1422
|
if (config.dark) {
|
|
@@ -836,6 +1461,11 @@ var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
|
836
1461
|
if (config.negative) {
|
|
837
1462
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
838
1463
|
}
|
|
1464
|
+
if (config.gradient) {
|
|
1465
|
+
for (let i = 0; i < config.gradient.length; i++) {
|
|
1466
|
+
process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
839
1469
|
};
|
|
840
1470
|
var setMultiThemeColorConfigEnv = (prefix, config) => {
|
|
841
1471
|
return {
|
|
@@ -886,6 +1516,11 @@ var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
|
886
1516
|
if (config.negative) {
|
|
887
1517
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
888
1518
|
}
|
|
1519
|
+
if (config.gradient) {
|
|
1520
|
+
for (let i = 0; i < config.gradient.length; i++) {
|
|
1521
|
+
process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
889
1524
|
};
|
|
890
1525
|
|
|
891
1526
|
// ../config-tools/src/create-storm-config.ts
|
|
@@ -893,16 +1528,16 @@ var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
|
893
1528
|
var _static_cache = void 0;
|
|
894
1529
|
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
|
|
895
1530
|
let result;
|
|
896
|
-
if (!_optionalChain([_static_cache, 'optionalAccess',
|
|
1531
|
+
if (!_optionalChain([_static_cache, 'optionalAccess', _56 => _56.data]) || !_optionalChain([_static_cache, 'optionalAccess', _57 => _57.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
|
|
897
1532
|
let _workspaceRoot = workspaceRoot;
|
|
898
1533
|
if (!_workspaceRoot) {
|
|
899
|
-
_workspaceRoot =
|
|
1534
|
+
_workspaceRoot = findWorkspaceRoot();
|
|
900
1535
|
}
|
|
901
1536
|
const configEnv = getConfigEnv();
|
|
902
1537
|
const configFile = await getConfigFile(_workspaceRoot);
|
|
903
1538
|
if (!configFile) {
|
|
904
1539
|
if (!skipLogs) {
|
|
905
|
-
|
|
1540
|
+
_chunkKRY2I44Jcjs.writeWarning.call(void 0,
|
|
906
1541
|
"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",
|
|
907
1542
|
{ logLevel: "all" }
|
|
908
1543
|
);
|
|
@@ -911,22 +1546,22 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
|
|
|
911
1546
|
return void 0;
|
|
912
1547
|
}
|
|
913
1548
|
}
|
|
914
|
-
const defaultConfig = await
|
|
1549
|
+
const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
|
|
915
1550
|
const configInput = _defu2.default.call(void 0,
|
|
916
1551
|
configEnv,
|
|
917
1552
|
configFile,
|
|
918
1553
|
defaultConfig
|
|
919
1554
|
);
|
|
920
1555
|
try {
|
|
921
|
-
result =
|
|
922
|
-
await
|
|
1556
|
+
result = applyDefaultConfig(
|
|
1557
|
+
await stormWorkspaceConfigSchema.parseAsync(configInput)
|
|
923
1558
|
);
|
|
924
1559
|
result.workspaceRoot ??= _workspaceRoot;
|
|
925
1560
|
} catch (error) {
|
|
926
1561
|
throw new Error(
|
|
927
|
-
`Failed to parse Storm Workspace configuration${_optionalChain([error, 'optionalAccess',
|
|
1562
|
+
`Failed to parse Storm Workspace configuration${_optionalChain([error, 'optionalAccess', _58 => _58.message]) ? `: ${error.message}` : ""}
|
|
928
1563
|
|
|
929
|
-
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${
|
|
1564
|
+
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${_chunkKRY2I44Jcjs.formatLogMessage.call(void 0,
|
|
930
1565
|
configInput
|
|
931
1566
|
)}`,
|
|
932
1567
|
{
|
|
@@ -971,9 +1606,9 @@ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
|
971
1606
|
);
|
|
972
1607
|
setConfigEnv(config);
|
|
973
1608
|
if (!skipLogs && !config.skipConfigLogging) {
|
|
974
|
-
|
|
1609
|
+
_chunkKRY2I44Jcjs.writeTrace.call(void 0,
|
|
975
1610
|
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
976
|
-
${
|
|
1611
|
+
${_chunkKRY2I44Jcjs.formatLogMessage.call(void 0, config)}`,
|
|
977
1612
|
config
|
|
978
1613
|
);
|
|
979
1614
|
}
|
|
@@ -1009,15 +1644,15 @@ var _findworkspaceroot = require('nx/src/utils/find-workspace-root');
|
|
|
1009
1644
|
|
|
1010
1645
|
var _unbuild = require('unbuild');
|
|
1011
1646
|
async function resolveOptions(options, config) {
|
|
1012
|
-
|
|
1013
|
-
const stopwatch =
|
|
1647
|
+
_chunkKRY2I44Jcjs.writeDebug.call(void 0, " \u2699\uFE0F Resolving build options", config);
|
|
1648
|
+
const stopwatch = _chunkKRY2I44Jcjs.getStopwatch.call(void 0, "Build options resolution");
|
|
1014
1649
|
if (options.configPath) {
|
|
1015
|
-
const configFile = await
|
|
1650
|
+
const configFile = await _chunkQRSVSWU2cjs.loadConfig.call(void 0, options.configPath);
|
|
1016
1651
|
if (configFile) {
|
|
1017
1652
|
options = _defu2.default.call(void 0, options, configFile);
|
|
1018
1653
|
}
|
|
1019
1654
|
}
|
|
1020
|
-
const outputPath = options.outputPath ||
|
|
1655
|
+
const outputPath = options.outputPath || joinPaths("dist", options.projectRoot);
|
|
1021
1656
|
let projectGraph;
|
|
1022
1657
|
try {
|
|
1023
1658
|
projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
@@ -1030,7 +1665,7 @@ async function resolveOptions(options, config) {
|
|
|
1030
1665
|
"The build process failed because the project graph is not available. Please run the build command again."
|
|
1031
1666
|
);
|
|
1032
1667
|
}
|
|
1033
|
-
const projectJsonPath =
|
|
1668
|
+
const projectJsonPath = joinPaths(
|
|
1034
1669
|
config.workspaceRoot,
|
|
1035
1670
|
options.projectRoot,
|
|
1036
1671
|
"project.json"
|
|
@@ -1041,7 +1676,7 @@ async function resolveOptions(options, config) {
|
|
|
1041
1676
|
const projectJsonContent = await _promises.readFile.call(void 0, projectJsonPath, "utf8");
|
|
1042
1677
|
const projectJson = JSON.parse(projectJsonContent);
|
|
1043
1678
|
const projectName = projectJson.name;
|
|
1044
|
-
const packageJsonPath =
|
|
1679
|
+
const packageJsonPath = joinPaths(
|
|
1045
1680
|
config.workspaceRoot,
|
|
1046
1681
|
options.projectRoot,
|
|
1047
1682
|
"package.json"
|
|
@@ -1053,17 +1688,17 @@ async function resolveOptions(options, config) {
|
|
|
1053
1688
|
const packageJson = JSON.parse(packageJsonContent);
|
|
1054
1689
|
let tsconfig = options.tsconfig;
|
|
1055
1690
|
if (!tsconfig) {
|
|
1056
|
-
tsconfig =
|
|
1691
|
+
tsconfig = joinPaths(options.projectRoot, "tsconfig.json");
|
|
1057
1692
|
}
|
|
1058
1693
|
if (!tsconfig.startsWith(config.workspaceRoot)) {
|
|
1059
|
-
tsconfig =
|
|
1694
|
+
tsconfig = joinPaths(config.workspaceRoot, tsconfig);
|
|
1060
1695
|
}
|
|
1061
1696
|
if (!_fs.existsSync.call(void 0, tsconfig)) {
|
|
1062
1697
|
throw new Error("Cannot find tsconfig.json configuration");
|
|
1063
1698
|
}
|
|
1064
1699
|
let sourceRoot = projectJson.sourceRoot;
|
|
1065
1700
|
if (!sourceRoot) {
|
|
1066
|
-
sourceRoot =
|
|
1701
|
+
sourceRoot = joinPaths(options.projectRoot, "src");
|
|
1067
1702
|
}
|
|
1068
1703
|
if (!_fs.existsSync.call(void 0, sourceRoot)) {
|
|
1069
1704
|
throw new Error("Cannot find sourceRoot directory");
|
|
@@ -1112,9 +1747,9 @@ async function resolveOptions(options, config) {
|
|
|
1112
1747
|
while (entryPath.startsWith("/")) {
|
|
1113
1748
|
entryPath = entryPath.substring(1);
|
|
1114
1749
|
}
|
|
1115
|
-
const outDir =
|
|
1750
|
+
const outDir = joinPaths(
|
|
1116
1751
|
_path.relative.call(void 0,
|
|
1117
|
-
|
|
1752
|
+
joinPaths(config.workspaceRoot, options.projectRoot),
|
|
1118
1753
|
config.workspaceRoot
|
|
1119
1754
|
),
|
|
1120
1755
|
outputPath,
|
|
@@ -1193,7 +1828,7 @@ async function resolveOptions(options, config) {
|
|
|
1193
1828
|
treeShaking: options.treeShaking !== false,
|
|
1194
1829
|
platform: options.platform || "neutral",
|
|
1195
1830
|
color: true,
|
|
1196
|
-
logLevel: config.logLevel ===
|
|
1831
|
+
logLevel: config.logLevel === _chunkKRY2I44Jcjs.LogLevelLabel.FATAL ? _chunkKRY2I44Jcjs.LogLevelLabel.ERROR : _chunkKRY2I44Jcjs.isVerbose.call(void 0, ) ? "verbose" : config.logLevel
|
|
1197
1832
|
}
|
|
1198
1833
|
}
|
|
1199
1834
|
};
|
|
@@ -1214,7 +1849,7 @@ async function resolveOptions(options, config) {
|
|
|
1214
1849
|
if (options.rollup) {
|
|
1215
1850
|
let rollup = {};
|
|
1216
1851
|
if (typeof options.rollup === "string") {
|
|
1217
|
-
const rollupFile = await
|
|
1852
|
+
const rollupFile = await _chunkQRSVSWU2cjs.loadConfig.call(void 0, options.rollup);
|
|
1218
1853
|
if (rollupFile) {
|
|
1219
1854
|
rollup = rollupFile;
|
|
1220
1855
|
}
|
|
@@ -1226,20 +1861,20 @@ async function resolveOptions(options, config) {
|
|
|
1226
1861
|
resolvedOptions.hooks = {
|
|
1227
1862
|
"rollup:options": async (ctx, opts) => {
|
|
1228
1863
|
if (options.plugins && options.plugins.length > 0) {
|
|
1229
|
-
|
|
1864
|
+
_chunkKRY2I44Jcjs.writeDebug.call(void 0,
|
|
1230
1865
|
` \u{1F9E9} Found ${options.plugins.length} plugins in provided build options`,
|
|
1231
1866
|
config
|
|
1232
1867
|
);
|
|
1233
1868
|
opts.plugins = options.plugins;
|
|
1234
1869
|
} else {
|
|
1235
|
-
|
|
1870
|
+
_chunkKRY2I44Jcjs.writeDebug.call(void 0,
|
|
1236
1871
|
` \u{1F9E9} No plugins found in provided build options, using default plugins`,
|
|
1237
1872
|
config
|
|
1238
1873
|
);
|
|
1239
1874
|
opts.plugins = await Promise.all([
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1875
|
+
_chunkXYM4DLHBcjs.analyzePlugin.call(void 0, resolvedOptions),
|
|
1876
|
+
_chunkQRSVSWU2cjs.tscPlugin.call(void 0, resolvedOptions),
|
|
1877
|
+
_chunkULVTNQE3cjs.onErrorPlugin.call(void 0, resolvedOptions)
|
|
1243
1878
|
]);
|
|
1244
1879
|
}
|
|
1245
1880
|
},
|
|
@@ -1293,15 +1928,15 @@ var addPackageJsonExport = (file, type = "module", sourceRoot, projectRoot) => {
|
|
|
1293
1928
|
};
|
|
1294
1929
|
};
|
|
1295
1930
|
async function generatePackageJson(options) {
|
|
1296
|
-
if (options.generatePackageJson !== false && _fs.existsSync.call(void 0,
|
|
1297
|
-
|
|
1298
|
-
const stopwatch =
|
|
1299
|
-
const packageJsonPath =
|
|
1931
|
+
if (options.generatePackageJson !== false && _fs.existsSync.call(void 0, joinPaths(options.projectRoot, "package.json"))) {
|
|
1932
|
+
_chunkKRY2I44Jcjs.writeDebug.call(void 0, " \u270D\uFE0F Writing package.json file", options.config);
|
|
1933
|
+
const stopwatch = _chunkKRY2I44Jcjs.getStopwatch.call(void 0, "Write package.json file");
|
|
1934
|
+
const packageJsonPath = joinPaths(options.projectRoot, "project.json");
|
|
1300
1935
|
if (!_fs.existsSync.call(void 0, packageJsonPath)) {
|
|
1301
1936
|
throw new Error("Cannot find package.json configuration");
|
|
1302
1937
|
}
|
|
1303
1938
|
const packageJsonContent = await _promises.readFile.call(void 0,
|
|
1304
|
-
|
|
1939
|
+
joinPaths(
|
|
1305
1940
|
options.config.workspaceRoot,
|
|
1306
1941
|
options.projectRoot,
|
|
1307
1942
|
"package.json"
|
|
@@ -1337,7 +1972,7 @@ async function generatePackageJson(options) {
|
|
|
1337
1972
|
while (entryPath.startsWith("/")) {
|
|
1338
1973
|
entryPath = entryPath.substring(1);
|
|
1339
1974
|
}
|
|
1340
|
-
entryPath = `./${
|
|
1975
|
+
entryPath = `./${joinPaths(options.projectRoot, entryPath)}`;
|
|
1341
1976
|
if (!ret.includes(entryPath)) {
|
|
1342
1977
|
ret.push(entryPath);
|
|
1343
1978
|
}
|
|
@@ -1387,28 +2022,28 @@ async function generatePackageJson(options) {
|
|
|
1387
2022
|
options.sourceRoot,
|
|
1388
2023
|
options.projectRoot
|
|
1389
2024
|
);
|
|
1390
|
-
await _devkit.writeJsonFile.call(void 0,
|
|
2025
|
+
await _devkit.writeJsonFile.call(void 0, joinPaths(options.outDir, "package.json"), packageJson);
|
|
1391
2026
|
stopwatch();
|
|
1392
2027
|
}
|
|
1393
2028
|
return options;
|
|
1394
2029
|
}
|
|
1395
2030
|
async function executeUnbuild(options) {
|
|
1396
|
-
|
|
2031
|
+
_chunkKRY2I44Jcjs.writeDebug.call(void 0,
|
|
1397
2032
|
` \u{1F680} Running ${options.name} (${options.projectRoot}) build`,
|
|
1398
2033
|
options.config
|
|
1399
2034
|
);
|
|
1400
|
-
const stopwatch =
|
|
2035
|
+
const stopwatch = _chunkKRY2I44Jcjs.getStopwatch.call(void 0,
|
|
1401
2036
|
`${options.name} (${options.projectRoot}) build`
|
|
1402
2037
|
);
|
|
1403
2038
|
try {
|
|
1404
2039
|
const config = {
|
|
1405
2040
|
...options,
|
|
1406
2041
|
config: null,
|
|
1407
|
-
rootDir:
|
|
2042
|
+
rootDir: joinPaths(options.config.workspaceRoot, options.projectRoot)
|
|
1408
2043
|
};
|
|
1409
|
-
|
|
2044
|
+
_chunkKRY2I44Jcjs.writeTrace.call(void 0,
|
|
1410
2045
|
`Running with unbuild configuration:
|
|
1411
|
-
${
|
|
2046
|
+
${_chunkKRY2I44Jcjs.formatLogMessage.call(void 0, { ...config, env: "<Hidden>" })}
|
|
1412
2047
|
`,
|
|
1413
2048
|
options.config
|
|
1414
2049
|
);
|
|
@@ -1419,11 +2054,11 @@ ${_chunk2RC3F2SNcjs.formatLogMessage.call(void 0, { ...config, env: "<Hidden>" }
|
|
|
1419
2054
|
return options;
|
|
1420
2055
|
}
|
|
1421
2056
|
async function copyBuildAssets(options) {
|
|
1422
|
-
|
|
2057
|
+
_chunkKRY2I44Jcjs.writeDebug.call(void 0,
|
|
1423
2058
|
` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`,
|
|
1424
2059
|
options.config
|
|
1425
2060
|
);
|
|
1426
|
-
const stopwatch =
|
|
2061
|
+
const stopwatch = _chunkKRY2I44Jcjs.getStopwatch.call(void 0, `${options.name} asset copy`);
|
|
1427
2062
|
await copyAssets(
|
|
1428
2063
|
options.config,
|
|
1429
2064
|
_nullishCoalesce(options.assets, () => ( [])),
|
|
@@ -1438,12 +2073,12 @@ async function copyBuildAssets(options) {
|
|
|
1438
2073
|
}
|
|
1439
2074
|
async function cleanOutputPath(options) {
|
|
1440
2075
|
if (options.clean !== false && options.outDir) {
|
|
1441
|
-
|
|
2076
|
+
_chunkKRY2I44Jcjs.writeDebug.call(void 0,
|
|
1442
2077
|
` \u{1F9F9} Cleaning ${options.name} output path: ${options.outDir}`,
|
|
1443
2078
|
options.config
|
|
1444
2079
|
);
|
|
1445
|
-
const stopwatch =
|
|
1446
|
-
await
|
|
2080
|
+
const stopwatch = _chunkKRY2I44Jcjs.getStopwatch.call(void 0, `${options.name} output clean`);
|
|
2081
|
+
await _chunk5LYLEQEHcjs.cleanDirectories.call(void 0, options.name, options.outDir, options.config);
|
|
1447
2082
|
stopwatch();
|
|
1448
2083
|
}
|
|
1449
2084
|
return options;
|
|
@@ -1458,10 +2093,10 @@ async function build(options) {
|
|
|
1458
2093
|
throw new Error("Cannot find workspace root");
|
|
1459
2094
|
}
|
|
1460
2095
|
const config = await getConfig(workspaceRoot.dir);
|
|
1461
|
-
|
|
1462
|
-
const stopwatch =
|
|
2096
|
+
_chunkKRY2I44Jcjs.writeDebug.call(void 0, ` \u26A1 Executing Storm Unbuild pipeline`, config);
|
|
2097
|
+
const stopwatch = _chunkKRY2I44Jcjs.getStopwatch.call(void 0, "Unbuild pipeline");
|
|
1463
2098
|
try {
|
|
1464
|
-
options.projectRoot =
|
|
2099
|
+
options.projectRoot = correctPaths(projectRoot);
|
|
1465
2100
|
const resolvedOptions = await resolveOptions(options, config);
|
|
1466
2101
|
await cleanOutputPath(resolvedOptions);
|
|
1467
2102
|
if (options.buildOnly !== true) {
|
|
@@ -1471,12 +2106,12 @@ async function build(options) {
|
|
|
1471
2106
|
if (options.buildOnly !== true) {
|
|
1472
2107
|
await copyBuildAssets(resolvedOptions);
|
|
1473
2108
|
}
|
|
1474
|
-
|
|
2109
|
+
_chunkKRY2I44Jcjs.writeSuccess.call(void 0,
|
|
1475
2110
|
` \u{1F3C1} The ${resolvedOptions.name} build completed successfully`,
|
|
1476
2111
|
config
|
|
1477
2112
|
);
|
|
1478
2113
|
} catch (error) {
|
|
1479
|
-
|
|
2114
|
+
_chunkKRY2I44Jcjs.writeFatal.call(void 0,
|
|
1480
2115
|
"Fatal errors that the build process could not recover from have occured. The build process has been terminated.",
|
|
1481
2116
|
config
|
|
1482
2117
|
);
|