@storm-software/projen 0.9.76 → 0.9.78
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/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/dist/{chunk-LTKRUM5P.js → chunk-BG73ZJER.js} +3 -5
- package/dist/{chunk-RLLFZW5Z.js → chunk-DUNMCAJE.js} +3 -3
- package/dist/{chunk-GM25EIP6.mjs → chunk-IQHRF4IX.mjs} +1197 -765
- package/dist/{chunk-VBI5UBLI.js → chunk-IRRBMF6O.js} +1310 -878
- package/dist/chunk-NG74QN4S.js +6 -0
- package/dist/{chunk-PHMFOUDC.js → chunk-NNSWWAGP.js} +8 -11
- package/dist/{chunk-IAJM6J3Z.mjs → chunk-NVTKHBEW.mjs} +1 -1
- package/dist/{chunk-EJSKIRCS.mjs → chunk-PEM26WKS.mjs} +7 -10
- package/dist/{chunk-JSBLU2B7.mjs → chunk-SHIGQSVE.mjs} +4 -6
- package/dist/{chunk-BSYROGZP.mjs → chunk-ZVRRJOP5.mjs} +1 -1
- package/dist/generators.js +5 -5
- package/dist/generators.mjs +4 -4
- package/dist/index.js +10 -10
- package/dist/index.mjs +5 -5
- package/dist/src/components/index.js +3 -3
- package/dist/src/components/index.mjs +2 -2
- package/dist/src/components/nx-workspace.js +127 -247
- package/dist/src/components/nx-workspace.mjs +127 -247
- package/dist/src/generators/init/generator.js +4 -4
- package/dist/src/generators/init/generator.mjs +3 -3
- package/dist/tsup.config.js +3 -6
- package/dist/tsup.config.mjs +2 -5
- package/package.json +1 -1
- package/dist/chunk-DQ67WT5G.js +0 -6
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
correctPaths,
|
|
3
3
|
joinPaths
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PEM26WKS.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__dirname,
|
|
7
|
-
__name,
|
|
8
7
|
__require,
|
|
9
8
|
init_esm_shims
|
|
10
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SHIGQSVE.mjs";
|
|
11
10
|
|
|
12
11
|
// src/generators/init/generator.ts
|
|
13
12
|
init_esm_shims();
|
|
14
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
addDependenciesToPackageJson as addDependenciesToPackageJson4,
|
|
15
|
+
formatFiles as formatFiles9,
|
|
16
|
+
readJsonFile as readJsonFile4,
|
|
17
|
+
runTasksInSerial
|
|
18
|
+
} from "@nx/devkit";
|
|
15
19
|
|
|
16
20
|
// ../workspace-tools/index.ts
|
|
17
21
|
init_esm_shims();
|
|
@@ -167,23 +171,39 @@ var RegistryConfigSchema = z.object({
|
|
|
167
171
|
cyclone: RegistryUrlConfigSchema,
|
|
168
172
|
container: RegistryUrlConfigSchema
|
|
169
173
|
}).default({}).describe("A list of remote registry URLs used by Storm Software");
|
|
170
|
-
var ColorConfigSchema = SingleThemeColorConfigSchema.or(
|
|
174
|
+
var ColorConfigSchema = SingleThemeColorConfigSchema.or(
|
|
175
|
+
MultiThemeColorConfigSchema
|
|
176
|
+
).describe("Colors used for various workspace elements");
|
|
171
177
|
var ColorConfigMapSchema = z.union([
|
|
172
|
-
z.object({
|
|
173
|
-
base: ColorConfigSchema
|
|
174
|
-
}),
|
|
178
|
+
z.object({ base: ColorConfigSchema }),
|
|
175
179
|
z.record(z.string(), ColorConfigSchema)
|
|
176
180
|
]);
|
|
177
|
-
var ExtendsItemSchema = z.string().trim().describe(
|
|
178
|
-
|
|
181
|
+
var ExtendsItemSchema = z.string().trim().describe(
|
|
182
|
+
"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."
|
|
183
|
+
);
|
|
184
|
+
var ExtendsSchema = ExtendsItemSchema.or(
|
|
185
|
+
z.array(ExtendsItemSchema)
|
|
186
|
+
).describe(
|
|
187
|
+
"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."
|
|
188
|
+
);
|
|
179
189
|
var WorkspaceBotConfigSchema = z.object({
|
|
180
|
-
name: z.string().trim().default("stormie-bot").describe(
|
|
190
|
+
name: z.string().trim().default("stormie-bot").describe(
|
|
191
|
+
"The workspace bot user's name (this is the bot that will be used to perform various tasks)"
|
|
192
|
+
),
|
|
181
193
|
email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
182
|
-
}).describe(
|
|
194
|
+
}).describe(
|
|
195
|
+
"The workspace's bot user's config used to automated various operations tasks"
|
|
196
|
+
);
|
|
183
197
|
var WorkspaceReleaseConfigSchema = z.object({
|
|
184
|
-
banner: z.string().trim().default(STORM_DEFAULT_RELEASE_BANNER).describe(
|
|
185
|
-
|
|
186
|
-
|
|
198
|
+
banner: z.string().trim().default(STORM_DEFAULT_RELEASE_BANNER).describe(
|
|
199
|
+
"A URL to a banner image used to display the workspace's release"
|
|
200
|
+
),
|
|
201
|
+
header: z.string().trim().optional().describe(
|
|
202
|
+
"A header message appended to the start of the workspace's release notes"
|
|
203
|
+
),
|
|
204
|
+
footer: z.string().trim().default(STORM_DEFAULT_RELEASE_FOOTER).describe(
|
|
205
|
+
"A footer message appended to the end of the workspace's release notes"
|
|
206
|
+
)
|
|
187
207
|
}).describe("The workspace's release config used during the release process");
|
|
188
208
|
var WorkspaceAccountConfigSchema = z.object({
|
|
189
209
|
twitter: z.string().trim().default(STORM_DEFAULT_ACCOUNT_TWITTER).describe("A Twitter/X account associated with the organization/project"),
|
|
@@ -192,23 +212,41 @@ var WorkspaceAccountConfigSchema = z.object({
|
|
|
192
212
|
slack: z.string().trim().default(STORM_DEFAULT_ACCOUNT_SLACK).describe("A Slack account associated with the organization/project"),
|
|
193
213
|
medium: z.string().trim().default(STORM_DEFAULT_ACCOUNT_MEDIUM).describe("A Medium account associated with the organization/project"),
|
|
194
214
|
github: z.string().trim().default(STORM_DEFAULT_ACCOUNT_GITHUB).describe("A GitHub account associated with the organization/project")
|
|
195
|
-
}).describe(
|
|
215
|
+
}).describe(
|
|
216
|
+
"The workspace's account config used to store various social media links"
|
|
217
|
+
);
|
|
196
218
|
var WorkspaceDirectoryConfigSchema = z.object({
|
|
197
|
-
cache: z.string().trim().optional().describe(
|
|
219
|
+
cache: z.string().trim().optional().describe(
|
|
220
|
+
"The directory used to store the environment's cached file data"
|
|
221
|
+
),
|
|
198
222
|
data: z.string().trim().optional().describe("The directory used to store the environment's data files"),
|
|
199
|
-
config: z.string().trim().optional().describe(
|
|
223
|
+
config: z.string().trim().optional().describe(
|
|
224
|
+
"The directory used to store the environment's configuration files"
|
|
225
|
+
),
|
|
200
226
|
temp: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
201
227
|
log: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
202
|
-
build: z.string().trim().default("dist").describe(
|
|
203
|
-
|
|
228
|
+
build: z.string().trim().default("dist").describe(
|
|
229
|
+
"The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
|
|
230
|
+
)
|
|
231
|
+
}).describe(
|
|
232
|
+
"Various directories used by the workspace to store data, cache, and configuration files"
|
|
233
|
+
);
|
|
204
234
|
var errorConfigSchema = z.object({
|
|
205
235
|
codesFile: z.string().trim().default(STORM_DEFAULT_ERROR_CODES_FILE).describe("The path to the workspace's error codes JSON file"),
|
|
206
|
-
url: z.string().trim().url().optional().describe(
|
|
236
|
+
url: z.string().trim().url().optional().describe(
|
|
237
|
+
"A URL to a page that looks up the workspace's error messages given a specific error code"
|
|
238
|
+
)
|
|
207
239
|
}).describe("The workspace's error config used during the error process");
|
|
208
240
|
var stormWorkspaceConfigSchema = z.object({
|
|
209
|
-
$schema: z.string().trim().default(
|
|
241
|
+
$schema: z.string().trim().default(
|
|
242
|
+
"https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm-workspace.schema.json"
|
|
243
|
+
).optional().nullish().describe(
|
|
244
|
+
"The URL to the JSON schema file that describes the Storm configuration file"
|
|
245
|
+
),
|
|
210
246
|
extends: ExtendsSchema.optional(),
|
|
211
|
-
name: z.string().trim().toLowerCase().optional().describe(
|
|
247
|
+
name: z.string().trim().toLowerCase().optional().describe(
|
|
248
|
+
"The name of the service/package/scope using this configuration"
|
|
249
|
+
),
|
|
212
250
|
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
213
251
|
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
214
252
|
repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
@@ -224,21 +262,16 @@ var stormWorkspaceConfigSchema = z.object({
|
|
|
224
262
|
release: WorkspaceReleaseConfigSchema,
|
|
225
263
|
account: WorkspaceAccountConfigSchema,
|
|
226
264
|
error: errorConfigSchema,
|
|
227
|
-
mode: z.enum([
|
|
228
|
-
"development",
|
|
229
|
-
"staging",
|
|
230
|
-
"production"
|
|
231
|
-
]).default("production").describe("The current runtime environment mode for the package"),
|
|
265
|
+
mode: z.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment mode for the package"),
|
|
232
266
|
workspaceRoot: z.string().trim().describe("The root directory of the workspace"),
|
|
233
|
-
externalPackagePatterns: z.array(z.string()).default([]).describe(
|
|
267
|
+
externalPackagePatterns: z.array(z.string()).default([]).describe(
|
|
268
|
+
"The build will use these package patterns to determine if they should be external to the bundle"
|
|
269
|
+
),
|
|
234
270
|
skipCache: z.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
|
|
235
271
|
directories: WorkspaceDirectoryConfigSchema,
|
|
236
|
-
packageManager: z.enum([
|
|
237
|
-
"
|
|
238
|
-
|
|
239
|
-
"pnpm",
|
|
240
|
-
"bun"
|
|
241
|
-
]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
|
|
272
|
+
packageManager: z.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe(
|
|
273
|
+
"The JavaScript/TypeScript package manager used by the repository"
|
|
274
|
+
),
|
|
242
275
|
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
243
276
|
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
244
277
|
logLevel: z.enum([
|
|
@@ -251,13 +284,23 @@ var stormWorkspaceConfigSchema = z.object({
|
|
|
251
284
|
"debug",
|
|
252
285
|
"trace",
|
|
253
286
|
"all"
|
|
254
|
-
]).default("info").describe(
|
|
255
|
-
|
|
287
|
+
]).default("info").describe(
|
|
288
|
+
"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`)."
|
|
289
|
+
),
|
|
290
|
+
skipConfigLogging: z.boolean().optional().describe(
|
|
291
|
+
"Should the logging of the current Storm Workspace configuration be skipped?"
|
|
292
|
+
),
|
|
256
293
|
registry: RegistryConfigSchema,
|
|
257
|
-
configFile: z.string().trim().nullable().default(null).describe(
|
|
258
|
-
|
|
294
|
+
configFile: z.string().trim().nullable().default(null).describe(
|
|
295
|
+
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
296
|
+
),
|
|
297
|
+
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe(
|
|
298
|
+
"Storm theme config values used for styling various package elements"
|
|
299
|
+
),
|
|
259
300
|
extensions: z.record(z.any()).optional().default({}).describe("Configuration of each used extension")
|
|
260
|
-
}).describe(
|
|
301
|
+
}).describe(
|
|
302
|
+
"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."
|
|
303
|
+
);
|
|
261
304
|
|
|
262
305
|
// ../config/src/types.ts
|
|
263
306
|
init_esm_shims();
|
|
@@ -295,10 +338,14 @@ var MAX_PATH_SEARCH_DEPTH = 30;
|
|
|
295
338
|
var depth = 0;
|
|
296
339
|
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
297
340
|
const _startPath = startPath ?? process.cwd();
|
|
298
|
-
if (endDirectoryNames.some(
|
|
341
|
+
if (endDirectoryNames.some(
|
|
342
|
+
(endDirName) => existsSync(join(_startPath, endDirName))
|
|
343
|
+
)) {
|
|
299
344
|
return _startPath;
|
|
300
345
|
}
|
|
301
|
-
if (endFileNames.some(
|
|
346
|
+
if (endFileNames.some(
|
|
347
|
+
(endFileName) => existsSync(join(_startPath, endFileName))
|
|
348
|
+
)) {
|
|
302
349
|
return _startPath;
|
|
303
350
|
}
|
|
304
351
|
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
@@ -307,7 +354,6 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
|
307
354
|
}
|
|
308
355
|
return void 0;
|
|
309
356
|
}
|
|
310
|
-
__name(findFolderUp, "findFolderUp");
|
|
311
357
|
|
|
312
358
|
// ../config-tools/src/utilities/find-workspace-root.ts
|
|
313
359
|
var rootFiles = [
|
|
@@ -354,21 +400,31 @@ var rootDirectories = [
|
|
|
354
400
|
];
|
|
355
401
|
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
356
402
|
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
357
|
-
return correctPaths(
|
|
358
|
-
|
|
359
|
-
|
|
403
|
+
return correctPaths(
|
|
404
|
+
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
return correctPaths(
|
|
408
|
+
findFolderUp(
|
|
409
|
+
pathInsideMonorepo ?? process.cwd(),
|
|
410
|
+
rootFiles,
|
|
411
|
+
rootDirectories
|
|
412
|
+
)
|
|
413
|
+
);
|
|
360
414
|
}
|
|
361
|
-
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
362
415
|
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
363
416
|
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
364
417
|
if (!result) {
|
|
365
|
-
throw new Error(
|
|
366
|
-
|
|
367
|
-
|
|
418
|
+
throw new Error(
|
|
419
|
+
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
420
|
+
${rootFiles.join(
|
|
421
|
+
"\n"
|
|
422
|
+
)}
|
|
423
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
424
|
+
);
|
|
368
425
|
}
|
|
369
426
|
return result;
|
|
370
427
|
}
|
|
371
|
-
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
372
428
|
|
|
373
429
|
// ../config-tools/src/utilities/get-default-config.ts
|
|
374
430
|
var DEFAULT_COLOR_CONFIG = {
|
|
@@ -399,7 +455,7 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
399
455
|
negative: "#dc2626"
|
|
400
456
|
}
|
|
401
457
|
};
|
|
402
|
-
var getDefaultConfig =
|
|
458
|
+
var getDefaultConfig = async (root) => {
|
|
403
459
|
let license = STORM_DEFAULT_LICENSE;
|
|
404
460
|
let homepage = STORM_DEFAULT_HOMEPAGE;
|
|
405
461
|
let name = void 0;
|
|
@@ -407,7 +463,10 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
407
463
|
let repository = void 0;
|
|
408
464
|
const workspaceRoot3 = findWorkspaceRoot(root);
|
|
409
465
|
if (existsSync2(join2(workspaceRoot3, "package.json"))) {
|
|
410
|
-
const file = await readFile(
|
|
466
|
+
const file = await readFile(
|
|
467
|
+
joinPaths(workspaceRoot3, "package.json"),
|
|
468
|
+
"utf8"
|
|
469
|
+
);
|
|
411
470
|
if (file) {
|
|
412
471
|
const packageJson = JSON.parse(file);
|
|
413
472
|
if (packageJson.name) {
|
|
@@ -444,37 +503,37 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
444
503
|
url: `${homepage || STORM_DEFAULT_HOMEPAGE}/errors`
|
|
445
504
|
}
|
|
446
505
|
};
|
|
447
|
-
}
|
|
506
|
+
};
|
|
448
507
|
|
|
449
508
|
// ../config-tools/src/logger/chalk.ts
|
|
450
509
|
init_esm_shims();
|
|
451
510
|
import chalk from "chalk";
|
|
452
511
|
var chalkDefault = {
|
|
453
|
-
hex:
|
|
454
|
-
bgHex:
|
|
455
|
-
whiteBright:
|
|
456
|
-
}),
|
|
457
|
-
whiteBright:
|
|
458
|
-
gray:
|
|
512
|
+
hex: (_) => (message) => message,
|
|
513
|
+
bgHex: (_) => ({
|
|
514
|
+
whiteBright: (message) => message
|
|
515
|
+
}),
|
|
516
|
+
whiteBright: (message) => message,
|
|
517
|
+
gray: (message) => message,
|
|
459
518
|
bold: {
|
|
460
|
-
hex:
|
|
461
|
-
bgHex:
|
|
462
|
-
whiteBright:
|
|
463
|
-
}),
|
|
464
|
-
whiteBright:
|
|
519
|
+
hex: (_) => (message) => message,
|
|
520
|
+
bgHex: (_) => ({
|
|
521
|
+
whiteBright: (message) => message
|
|
522
|
+
}),
|
|
523
|
+
whiteBright: (message) => message
|
|
465
524
|
},
|
|
466
525
|
dim: {
|
|
467
|
-
hex:
|
|
468
|
-
gray:
|
|
526
|
+
hex: (_) => (message) => message,
|
|
527
|
+
gray: (message) => message
|
|
469
528
|
}
|
|
470
529
|
};
|
|
471
|
-
var getChalk =
|
|
530
|
+
var getChalk = () => {
|
|
472
531
|
let _chalk = chalk;
|
|
473
532
|
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
|
|
474
533
|
_chalk = chalkDefault;
|
|
475
534
|
}
|
|
476
535
|
return _chalk;
|
|
477
|
-
}
|
|
536
|
+
};
|
|
478
537
|
|
|
479
538
|
// ../config-tools/src/logger/console-icons.ts
|
|
480
539
|
init_esm_shims();
|
|
@@ -490,10 +549,9 @@ function isUnicodeSupported() {
|
|
|
490
549
|
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
491
550
|
process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
492
551
|
}
|
|
493
|
-
__name(isUnicodeSupported, "isUnicodeSupported");
|
|
494
552
|
|
|
495
553
|
// ../config-tools/src/logger/console-icons.ts
|
|
496
|
-
var useIcon =
|
|
554
|
+
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
497
555
|
var CONSOLE_ICONS = {
|
|
498
556
|
[LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
|
|
499
557
|
[LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
|
|
@@ -507,13 +565,13 @@ var CONSOLE_ICONS = {
|
|
|
507
565
|
|
|
508
566
|
// ../config-tools/src/logger/format-timestamp.ts
|
|
509
567
|
init_esm_shims();
|
|
510
|
-
var formatTimestamp =
|
|
568
|
+
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
511
569
|
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
512
|
-
}
|
|
570
|
+
};
|
|
513
571
|
|
|
514
572
|
// ../config-tools/src/logger/get-log-level.ts
|
|
515
573
|
init_esm_shims();
|
|
516
|
-
var getLogLevel =
|
|
574
|
+
var getLogLevel = (label) => {
|
|
517
575
|
switch (label) {
|
|
518
576
|
case "all":
|
|
519
577
|
return LogLevel.ALL;
|
|
@@ -534,8 +592,8 @@ var getLogLevel = /* @__PURE__ */ __name((label) => {
|
|
|
534
592
|
default:
|
|
535
593
|
return LogLevel.INFO;
|
|
536
594
|
}
|
|
537
|
-
}
|
|
538
|
-
var getLogLevelLabel =
|
|
595
|
+
};
|
|
596
|
+
var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
|
|
539
597
|
if (logLevel >= LogLevel.ALL) {
|
|
540
598
|
return LogLevelLabel.ALL;
|
|
541
599
|
}
|
|
@@ -561,10 +619,10 @@ var getLogLevelLabel = /* @__PURE__ */ __name((logLevel = LogLevel.INFO) => {
|
|
|
561
619
|
return LogLevelLabel.SILENT;
|
|
562
620
|
}
|
|
563
621
|
return LogLevelLabel.INFO;
|
|
564
|
-
}
|
|
622
|
+
};
|
|
565
623
|
|
|
566
624
|
// ../config-tools/src/logger/console.ts
|
|
567
|
-
var getLogFn =
|
|
625
|
+
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
568
626
|
const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
|
|
569
627
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
570
628
|
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
@@ -573,103 +631,123 @@ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _c
|
|
|
573
631
|
}
|
|
574
632
|
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
575
633
|
return (message) => {
|
|
576
|
-
console.error(
|
|
634
|
+
console.error(
|
|
635
|
+
`
|
|
577
636
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
578
|
-
`
|
|
637
|
+
`
|
|
638
|
+
);
|
|
579
639
|
};
|
|
580
640
|
}
|
|
581
641
|
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
582
642
|
return (message) => {
|
|
583
|
-
console.error(
|
|
643
|
+
console.error(
|
|
644
|
+
`
|
|
584
645
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
585
|
-
`
|
|
646
|
+
`
|
|
647
|
+
);
|
|
586
648
|
};
|
|
587
649
|
}
|
|
588
650
|
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
589
651
|
return (message) => {
|
|
590
|
-
console.warn(
|
|
652
|
+
console.warn(
|
|
653
|
+
`
|
|
591
654
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
592
|
-
`
|
|
655
|
+
`
|
|
656
|
+
);
|
|
593
657
|
};
|
|
594
658
|
}
|
|
595
659
|
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
596
660
|
return (message) => {
|
|
597
|
-
console.info(
|
|
661
|
+
console.info(
|
|
662
|
+
`
|
|
598
663
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
599
|
-
`
|
|
664
|
+
`
|
|
665
|
+
);
|
|
600
666
|
};
|
|
601
667
|
}
|
|
602
668
|
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
603
669
|
return (message) => {
|
|
604
|
-
console.info(
|
|
670
|
+
console.info(
|
|
671
|
+
`
|
|
605
672
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
606
|
-
`
|
|
673
|
+
`
|
|
674
|
+
);
|
|
607
675
|
};
|
|
608
676
|
}
|
|
609
677
|
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
610
678
|
return (message) => {
|
|
611
|
-
console.debug(
|
|
679
|
+
console.debug(
|
|
680
|
+
`
|
|
612
681
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
613
|
-
`
|
|
682
|
+
`
|
|
683
|
+
);
|
|
614
684
|
};
|
|
615
685
|
}
|
|
616
686
|
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
617
687
|
return (message) => {
|
|
618
|
-
console.debug(
|
|
688
|
+
console.debug(
|
|
689
|
+
`
|
|
619
690
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
620
|
-
`
|
|
691
|
+
`
|
|
692
|
+
);
|
|
621
693
|
};
|
|
622
694
|
}
|
|
623
695
|
return (message) => {
|
|
624
|
-
console.log(
|
|
696
|
+
console.log(
|
|
697
|
+
`
|
|
625
698
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
626
|
-
`
|
|
699
|
+
`
|
|
700
|
+
);
|
|
627
701
|
};
|
|
628
|
-
}
|
|
629
|
-
var writeFatal =
|
|
630
|
-
var writeError =
|
|
631
|
-
var writeWarning =
|
|
632
|
-
var writeInfo =
|
|
633
|
-
var writeSuccess =
|
|
634
|
-
var writeDebug =
|
|
635
|
-
var writeTrace =
|
|
636
|
-
var getStopwatch =
|
|
702
|
+
};
|
|
703
|
+
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
704
|
+
var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
|
|
705
|
+
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
706
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
707
|
+
var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
|
|
708
|
+
var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
|
|
709
|
+
var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
|
|
710
|
+
var getStopwatch = (name) => {
|
|
637
711
|
const start = process.hrtime();
|
|
638
712
|
return () => {
|
|
639
713
|
const end = process.hrtime(start);
|
|
640
|
-
console.info(
|
|
641
|
-
|
|
642
|
-
`
|
|
714
|
+
console.info(
|
|
715
|
+
`
|
|
716
|
+
> \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
|
|
717
|
+
end[0] * 1e3 + end[1] / 1e6
|
|
718
|
+
)}ms to complete
|
|
719
|
+
`
|
|
720
|
+
);
|
|
643
721
|
};
|
|
644
|
-
}
|
|
722
|
+
};
|
|
645
723
|
var MAX_DEPTH = 4;
|
|
646
|
-
var formatLogMessage =
|
|
724
|
+
var formatLogMessage = (message, options = {}, depth2 = 0) => {
|
|
647
725
|
if (depth2 > MAX_DEPTH) {
|
|
648
726
|
return "<max depth>";
|
|
649
727
|
}
|
|
650
728
|
const prefix = options.prefix ?? "-";
|
|
651
729
|
const skip = options.skip ?? [];
|
|
652
730
|
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
653
|
-
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
}
|
|
662
|
-
var _isFunction =
|
|
731
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
732
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map(
|
|
733
|
+
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
|
|
734
|
+
message[key],
|
|
735
|
+
{ prefix: `${prefix}-`, skip },
|
|
736
|
+
depth2 + 1
|
|
737
|
+
) : message[key]}`
|
|
738
|
+
).join("\n")}` : message;
|
|
739
|
+
};
|
|
740
|
+
var _isFunction = (value) => {
|
|
663
741
|
try {
|
|
664
742
|
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
665
743
|
} catch (e) {
|
|
666
744
|
return false;
|
|
667
745
|
}
|
|
668
|
-
}
|
|
746
|
+
};
|
|
669
747
|
|
|
670
748
|
// ../config-tools/src/utilities/apply-workspace-tokens.ts
|
|
671
749
|
init_esm_shims();
|
|
672
|
-
var applyWorkspaceBaseTokens =
|
|
750
|
+
var applyWorkspaceBaseTokens = async (option, tokenParams) => {
|
|
673
751
|
let result = option;
|
|
674
752
|
if (!result) {
|
|
675
753
|
return result;
|
|
@@ -679,7 +757,10 @@ var applyWorkspaceBaseTokens = /* @__PURE__ */ __name(async (option, tokenParams
|
|
|
679
757
|
if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
|
|
680
758
|
for (const optionKey of optionKeys) {
|
|
681
759
|
if (result.includes(`{${optionKey}}`)) {
|
|
682
|
-
result = result.replaceAll(
|
|
760
|
+
result = result.replaceAll(
|
|
761
|
+
`{${optionKey}}`,
|
|
762
|
+
tokenParams?.[optionKey] || ""
|
|
763
|
+
);
|
|
683
764
|
}
|
|
684
765
|
}
|
|
685
766
|
}
|
|
@@ -689,40 +770,56 @@ var applyWorkspaceBaseTokens = /* @__PURE__ */ __name(async (option, tokenParams
|
|
|
689
770
|
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
690
771
|
for (const configKey of configKeys) {
|
|
691
772
|
if (result.includes(`{${configKey}}`)) {
|
|
692
|
-
result = result.replaceAll(
|
|
773
|
+
result = result.replaceAll(
|
|
774
|
+
`{${configKey}}`,
|
|
775
|
+
tokenParams.config[configKey] || ""
|
|
776
|
+
);
|
|
693
777
|
}
|
|
694
778
|
}
|
|
695
779
|
}
|
|
696
780
|
}
|
|
697
781
|
if (result.includes("{workspaceRoot}")) {
|
|
698
|
-
result = result.replaceAll(
|
|
782
|
+
result = result.replaceAll(
|
|
783
|
+
"{workspaceRoot}",
|
|
784
|
+
tokenParams.workspaceRoot ?? tokenParams.config?.workspaceRoot ?? findWorkspaceRoot()
|
|
785
|
+
);
|
|
699
786
|
}
|
|
700
787
|
return result;
|
|
701
|
-
}
|
|
702
|
-
var applyWorkspaceProjectTokens =
|
|
788
|
+
};
|
|
789
|
+
var applyWorkspaceProjectTokens = (option, tokenParams) => {
|
|
703
790
|
return applyWorkspaceBaseTokens(option, tokenParams);
|
|
704
|
-
}
|
|
705
|
-
var applyWorkspaceTokens =
|
|
791
|
+
};
|
|
792
|
+
var applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
|
|
706
793
|
if (!options) {
|
|
707
794
|
return {};
|
|
708
795
|
}
|
|
709
796
|
const result = {};
|
|
710
797
|
for (const option of Object.keys(options)) {
|
|
711
798
|
if (typeof options[option] === "string") {
|
|
712
|
-
result[option] = await Promise.resolve(
|
|
799
|
+
result[option] = await Promise.resolve(
|
|
800
|
+
tokenizerFn(options[option], tokenParams)
|
|
801
|
+
);
|
|
713
802
|
} else if (Array.isArray(options[option])) {
|
|
714
|
-
result[option] = await Promise.all(
|
|
803
|
+
result[option] = await Promise.all(
|
|
804
|
+
options[option].map(
|
|
805
|
+
async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item
|
|
806
|
+
)
|
|
807
|
+
);
|
|
715
808
|
} else if (typeof options[option] === "object") {
|
|
716
|
-
result[option] = await applyWorkspaceTokens(
|
|
809
|
+
result[option] = await applyWorkspaceTokens(
|
|
810
|
+
options[option],
|
|
811
|
+
tokenParams,
|
|
812
|
+
tokenizerFn
|
|
813
|
+
);
|
|
717
814
|
} else {
|
|
718
815
|
result[option] = options[option];
|
|
719
816
|
}
|
|
720
817
|
}
|
|
721
818
|
return result;
|
|
722
|
-
}
|
|
819
|
+
};
|
|
723
820
|
|
|
724
821
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
725
|
-
var getConfigFileByName =
|
|
822
|
+
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
726
823
|
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
727
824
|
const configs = await Promise.all([
|
|
728
825
|
loadConfig({
|
|
@@ -732,7 +829,10 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
732
829
|
envName: fileName?.toUpperCase(),
|
|
733
830
|
jitiOptions: {
|
|
734
831
|
debug: false,
|
|
735
|
-
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
832
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
833
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
834
|
+
"jiti"
|
|
835
|
+
)
|
|
736
836
|
},
|
|
737
837
|
...options
|
|
738
838
|
}),
|
|
@@ -743,32 +843,45 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
743
843
|
envName: fileName?.toUpperCase(),
|
|
744
844
|
jitiOptions: {
|
|
745
845
|
debug: false,
|
|
746
|
-
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
846
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
847
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
848
|
+
"jiti"
|
|
849
|
+
)
|
|
747
850
|
},
|
|
748
851
|
configFile: fileName,
|
|
749
852
|
...options
|
|
750
853
|
})
|
|
751
854
|
]);
|
|
752
855
|
return defu(configs[0] ?? {}, configs[1] ?? {});
|
|
753
|
-
}
|
|
754
|
-
var getConfigFile =
|
|
856
|
+
};
|
|
857
|
+
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
755
858
|
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
756
859
|
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
757
860
|
let config = result.config;
|
|
758
861
|
const configFile = result.configFile;
|
|
759
862
|
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
760
|
-
writeTrace(
|
|
761
|
-
|
|
762
|
-
|
|
863
|
+
writeTrace(
|
|
864
|
+
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
|
|
865
|
+
{
|
|
866
|
+
logLevel: "all"
|
|
867
|
+
}
|
|
868
|
+
);
|
|
763
869
|
}
|
|
764
870
|
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
765
|
-
const results = await Promise.all(
|
|
871
|
+
const results = await Promise.all(
|
|
872
|
+
additionalFileNames.map(
|
|
873
|
+
(fileName) => getConfigFileByName(fileName, workspacePath)
|
|
874
|
+
)
|
|
875
|
+
);
|
|
766
876
|
for (const result2 of results) {
|
|
767
877
|
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
768
878
|
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
769
|
-
writeTrace(
|
|
770
|
-
|
|
771
|
-
|
|
879
|
+
writeTrace(
|
|
880
|
+
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
|
|
881
|
+
{
|
|
882
|
+
logLevel: "all"
|
|
883
|
+
}
|
|
884
|
+
);
|
|
772
885
|
}
|
|
773
886
|
config = defu(result2.config ?? {}, config ?? {});
|
|
774
887
|
}
|
|
@@ -779,7 +892,7 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
779
892
|
}
|
|
780
893
|
config.configFile = configFile;
|
|
781
894
|
return config;
|
|
782
|
-
}
|
|
895
|
+
};
|
|
783
896
|
|
|
784
897
|
// ../config-tools/src/create-storm-config.ts
|
|
785
898
|
init_esm_shims();
|
|
@@ -787,17 +900,19 @@ import defu2 from "defu";
|
|
|
787
900
|
|
|
788
901
|
// ../config-tools/src/env/get-env.ts
|
|
789
902
|
init_esm_shims();
|
|
790
|
-
var getExtensionEnv =
|
|
903
|
+
var getExtensionEnv = (extensionName) => {
|
|
791
904
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
792
905
|
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
793
|
-
const name = key.replace(prefix, "").split("_").map(
|
|
906
|
+
const name = key.replace(prefix, "").split("_").map(
|
|
907
|
+
(i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
|
|
908
|
+
).join("");
|
|
794
909
|
if (name) {
|
|
795
910
|
ret[name] = process.env[key];
|
|
796
911
|
}
|
|
797
912
|
return ret;
|
|
798
913
|
}, {});
|
|
799
|
-
}
|
|
800
|
-
var getConfigEnv =
|
|
914
|
+
};
|
|
915
|
+
var getConfigEnv = () => {
|
|
801
916
|
const prefix = "STORM_";
|
|
802
917
|
let config = {
|
|
803
918
|
extends: process.env[`${prefix}EXTENDS`] || void 0,
|
|
@@ -865,14 +980,25 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
865
980
|
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
866
981
|
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
867
982
|
},
|
|
868
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
983
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
984
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
985
|
+
) ? getLogLevelLabel(
|
|
986
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
987
|
+
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
869
988
|
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
870
989
|
};
|
|
871
|
-
const themeNames = Object.keys(process.env).filter(
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
990
|
+
const themeNames = Object.keys(process.env).filter(
|
|
991
|
+
(envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
|
|
992
|
+
(colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
|
|
993
|
+
)
|
|
994
|
+
);
|
|
995
|
+
config.colors = themeNames.length > 0 ? themeNames.reduce(
|
|
996
|
+
(ret, themeName) => {
|
|
997
|
+
ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
|
|
998
|
+
return ret;
|
|
999
|
+
},
|
|
1000
|
+
{}
|
|
1001
|
+
) : getThemeColorConfigEnv(prefix);
|
|
876
1002
|
if (config.docs === STORM_DEFAULT_DOCS) {
|
|
877
1003
|
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
878
1004
|
config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
@@ -893,23 +1019,17 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
893
1019
|
config = {
|
|
894
1020
|
...config,
|
|
895
1021
|
...parsed,
|
|
896
|
-
colors: {
|
|
897
|
-
|
|
898
|
-
...parsed.colors
|
|
899
|
-
},
|
|
900
|
-
extensions: {
|
|
901
|
-
...config.extensions,
|
|
902
|
-
...parsed.extensions
|
|
903
|
-
}
|
|
1022
|
+
colors: { ...config.colors, ...parsed.colors },
|
|
1023
|
+
extensions: { ...config.extensions, ...parsed.extensions }
|
|
904
1024
|
};
|
|
905
1025
|
}
|
|
906
1026
|
return config;
|
|
907
|
-
}
|
|
908
|
-
var getThemeColorConfigEnv =
|
|
1027
|
+
};
|
|
1028
|
+
var getThemeColorConfigEnv = (prefix, theme) => {
|
|
909
1029
|
const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
|
|
910
1030
|
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
|
|
911
|
-
}
|
|
912
|
-
var getSingleThemeColorConfigEnv =
|
|
1031
|
+
};
|
|
1032
|
+
var getSingleThemeColorConfigEnv = (prefix) => {
|
|
913
1033
|
return {
|
|
914
1034
|
dark: process.env[`${prefix}DARK`],
|
|
915
1035
|
light: process.env[`${prefix}LIGHT`],
|
|
@@ -926,14 +1046,16 @@ var getSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
|
|
|
926
1046
|
positive: process.env[`${prefix}POSITIVE`],
|
|
927
1047
|
negative: process.env[`${prefix}NEGATIVE`]
|
|
928
1048
|
};
|
|
929
|
-
}
|
|
930
|
-
var getMultiThemeColorConfigEnv =
|
|
1049
|
+
};
|
|
1050
|
+
var getMultiThemeColorConfigEnv = (prefix) => {
|
|
931
1051
|
return {
|
|
932
|
-
light: getBaseThemeColorConfigEnv(
|
|
1052
|
+
light: getBaseThemeColorConfigEnv(
|
|
1053
|
+
`${prefix}_LIGHT_`
|
|
1054
|
+
),
|
|
933
1055
|
dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
|
|
934
1056
|
};
|
|
935
|
-
}
|
|
936
|
-
var getBaseThemeColorConfigEnv =
|
|
1057
|
+
};
|
|
1058
|
+
var getBaseThemeColorConfigEnv = (prefix) => {
|
|
937
1059
|
return {
|
|
938
1060
|
foreground: process.env[`${prefix}FOREGROUND`],
|
|
939
1061
|
background: process.env[`${prefix}BACKGROUND`],
|
|
@@ -950,14 +1072,17 @@ var getBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
|
|
|
950
1072
|
positive: process.env[`${prefix}POSITIVE`],
|
|
951
1073
|
negative: process.env[`${prefix}NEGATIVE`]
|
|
952
1074
|
};
|
|
953
|
-
}
|
|
1075
|
+
};
|
|
954
1076
|
|
|
955
1077
|
// ../config-tools/src/env/set-env.ts
|
|
956
1078
|
init_esm_shims();
|
|
957
|
-
var setExtensionEnv =
|
|
1079
|
+
var setExtensionEnv = (extensionName, extension) => {
|
|
958
1080
|
for (const key of Object.keys(extension ?? {})) {
|
|
959
1081
|
if (extension[key]) {
|
|
960
|
-
const result = key?.replace(
|
|
1082
|
+
const result = key?.replace(
|
|
1083
|
+
/([A-Z])+/g,
|
|
1084
|
+
(input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
|
|
1085
|
+
).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
961
1086
|
let extensionKey;
|
|
962
1087
|
if (result.length === 0) {
|
|
963
1088
|
return;
|
|
@@ -972,8 +1097,8 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
|
|
|
972
1097
|
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
973
1098
|
}
|
|
974
1099
|
}
|
|
975
|
-
}
|
|
976
|
-
var setConfigEnv =
|
|
1100
|
+
};
|
|
1101
|
+
var setConfigEnv = (config) => {
|
|
977
1102
|
const prefix = "STORM_";
|
|
978
1103
|
if (config.extends) {
|
|
979
1104
|
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
@@ -1062,7 +1187,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1062
1187
|
}
|
|
1063
1188
|
if (config.directories) {
|
|
1064
1189
|
if (!config.skipCache && config.directories.cache) {
|
|
1065
|
-
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
1190
|
+
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
1191
|
+
config.directories.cache
|
|
1192
|
+
);
|
|
1066
1193
|
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
1067
1194
|
}
|
|
1068
1195
|
if (config.directories.data) {
|
|
@@ -1070,7 +1197,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1070
1197
|
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
1071
1198
|
}
|
|
1072
1199
|
if (config.directories.config) {
|
|
1073
|
-
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
1200
|
+
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
1201
|
+
config.directories.config
|
|
1202
|
+
);
|
|
1074
1203
|
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
1075
1204
|
}
|
|
1076
1205
|
if (config.directories.temp) {
|
|
@@ -1082,7 +1211,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1082
1211
|
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
1083
1212
|
}
|
|
1084
1213
|
if (config.directories.build) {
|
|
1085
|
-
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
1214
|
+
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
1215
|
+
config.directories.build
|
|
1216
|
+
);
|
|
1086
1217
|
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
1087
1218
|
}
|
|
1088
1219
|
}
|
|
@@ -1103,7 +1234,10 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1103
1234
|
setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
|
|
1104
1235
|
}
|
|
1105
1236
|
} else {
|
|
1106
|
-
setThemeColorConfigEnv(
|
|
1237
|
+
setThemeColorConfigEnv(
|
|
1238
|
+
`${prefix}COLOR_`,
|
|
1239
|
+
config.colors
|
|
1240
|
+
);
|
|
1107
1241
|
}
|
|
1108
1242
|
if (config.repository) {
|
|
1109
1243
|
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
@@ -1115,7 +1249,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1115
1249
|
process.env[`${prefix}PRE_ID`] = String(config.preid);
|
|
1116
1250
|
}
|
|
1117
1251
|
if (config.externalPackagePatterns) {
|
|
1118
|
-
process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(
|
|
1252
|
+
process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(
|
|
1253
|
+
config.externalPackagePatterns
|
|
1254
|
+
);
|
|
1119
1255
|
}
|
|
1120
1256
|
if (config.registry) {
|
|
1121
1257
|
if (config.registry.github) {
|
|
@@ -1128,20 +1264,28 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1128
1264
|
process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
|
|
1129
1265
|
}
|
|
1130
1266
|
if (config.registry.cyclone) {
|
|
1131
|
-
process.env[`${prefix}REGISTRY_CYCLONE`] = String(
|
|
1267
|
+
process.env[`${prefix}REGISTRY_CYCLONE`] = String(
|
|
1268
|
+
config.registry.cyclone
|
|
1269
|
+
);
|
|
1132
1270
|
}
|
|
1133
1271
|
if (config.registry.container) {
|
|
1134
|
-
process.env[`${prefix}REGISTRY_CONTAINER`] = String(
|
|
1272
|
+
process.env[`${prefix}REGISTRY_CONTAINER`] = String(
|
|
1273
|
+
config.registry.container
|
|
1274
|
+
);
|
|
1135
1275
|
}
|
|
1136
1276
|
}
|
|
1137
1277
|
if (config.logLevel) {
|
|
1138
1278
|
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
1139
1279
|
process.env.LOG_LEVEL = String(config.logLevel);
|
|
1140
|
-
process.env.NX_VERBOSE_LOGGING = String(
|
|
1280
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
1281
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
1282
|
+
);
|
|
1141
1283
|
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
1142
1284
|
}
|
|
1143
1285
|
if (config.skipConfigLogging !== void 0) {
|
|
1144
|
-
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
1286
|
+
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
1287
|
+
config.skipConfigLogging
|
|
1288
|
+
);
|
|
1145
1289
|
}
|
|
1146
1290
|
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
1147
1291
|
for (const key of Object.keys(config.extensions ?? {})) {
|
|
@@ -1149,11 +1293,11 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1149
1293
|
setExtensionEnv(key, config.extensions[key]);
|
|
1150
1294
|
}
|
|
1151
1295
|
}
|
|
1152
|
-
}
|
|
1153
|
-
var setThemeColorConfigEnv =
|
|
1296
|
+
};
|
|
1297
|
+
var setThemeColorConfigEnv = (prefix, config) => {
|
|
1154
1298
|
return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
|
|
1155
|
-
}
|
|
1156
|
-
var setSingleThemeColorConfigEnv =
|
|
1299
|
+
};
|
|
1300
|
+
var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
1157
1301
|
if (config.dark) {
|
|
1158
1302
|
process.env[`${prefix}DARK`] = config.dark;
|
|
1159
1303
|
}
|
|
@@ -1196,14 +1340,14 @@ var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
|
|
|
1196
1340
|
if (config.negative) {
|
|
1197
1341
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
1198
1342
|
}
|
|
1199
|
-
}
|
|
1200
|
-
var setMultiThemeColorConfigEnv =
|
|
1343
|
+
};
|
|
1344
|
+
var setMultiThemeColorConfigEnv = (prefix, config) => {
|
|
1201
1345
|
return {
|
|
1202
1346
|
light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
|
|
1203
1347
|
dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
|
|
1204
1348
|
};
|
|
1205
|
-
}
|
|
1206
|
-
var setBaseThemeColorConfigEnv =
|
|
1349
|
+
};
|
|
1350
|
+
var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
1207
1351
|
if (config.foreground) {
|
|
1208
1352
|
process.env[`${prefix}FOREGROUND`] = config.foreground;
|
|
1209
1353
|
}
|
|
@@ -1246,12 +1390,12 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
|
|
|
1246
1390
|
if (config.negative) {
|
|
1247
1391
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
1248
1392
|
}
|
|
1249
|
-
}
|
|
1393
|
+
};
|
|
1250
1394
|
|
|
1251
1395
|
// ../config-tools/src/create-storm-config.ts
|
|
1252
1396
|
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
1253
1397
|
var _static_cache = void 0;
|
|
1254
|
-
var createStormWorkspaceConfig =
|
|
1398
|
+
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot3, skipLogs = false, useDefault = true) => {
|
|
1255
1399
|
let result;
|
|
1256
1400
|
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
1257
1401
|
let _workspaceRoot = workspaceRoot3;
|
|
@@ -1262,16 +1406,19 @@ var createStormWorkspaceConfig = /* @__PURE__ */ __name(async (extensionName, sc
|
|
|
1262
1406
|
const configFile = await getConfigFile(_workspaceRoot);
|
|
1263
1407
|
if (!configFile) {
|
|
1264
1408
|
if (!skipLogs) {
|
|
1265
|
-
writeWarning(
|
|
1266
|
-
|
|
1267
|
-
|
|
1409
|
+
writeWarning(
|
|
1410
|
+
"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",
|
|
1411
|
+
{ logLevel: "all" }
|
|
1412
|
+
);
|
|
1268
1413
|
}
|
|
1269
1414
|
if (useDefault === false) {
|
|
1270
1415
|
return void 0;
|
|
1271
1416
|
}
|
|
1272
1417
|
}
|
|
1273
1418
|
const defaultConfig = await getDefaultConfig(_workspaceRoot);
|
|
1274
|
-
result = await stormWorkspaceConfigSchema.parseAsync(
|
|
1419
|
+
result = await stormWorkspaceConfigSchema.parseAsync(
|
|
1420
|
+
defu2(configEnv, configFile, defaultConfig)
|
|
1421
|
+
);
|
|
1275
1422
|
result.workspaceRoot ??= _workspaceRoot;
|
|
1276
1423
|
} else {
|
|
1277
1424
|
result = _static_cache.data;
|
|
@@ -1287,11 +1434,9 @@ var createStormWorkspaceConfig = /* @__PURE__ */ __name(async (extensionName, sc
|
|
|
1287
1434
|
data: result
|
|
1288
1435
|
};
|
|
1289
1436
|
return result;
|
|
1290
|
-
}
|
|
1291
|
-
var createConfigExtension =
|
|
1292
|
-
const extension_cache_key = {
|
|
1293
|
-
extensionName
|
|
1294
|
-
};
|
|
1437
|
+
};
|
|
1438
|
+
var createConfigExtension = (extensionName, schema) => {
|
|
1439
|
+
const extension_cache_key = { extensionName };
|
|
1295
1440
|
if (_extension_cache.has(extension_cache_key)) {
|
|
1296
1441
|
return _extension_cache.get(extension_cache_key);
|
|
1297
1442
|
}
|
|
@@ -1301,39 +1446,50 @@ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
|
|
|
1301
1446
|
}
|
|
1302
1447
|
_extension_cache.set(extension_cache_key, extension);
|
|
1303
1448
|
return extension;
|
|
1304
|
-
}
|
|
1305
|
-
var loadStormWorkspaceConfig =
|
|
1306
|
-
const config = await createStormWorkspaceConfig(
|
|
1449
|
+
};
|
|
1450
|
+
var loadStormWorkspaceConfig = async (workspaceRoot3, skipLogs = false) => {
|
|
1451
|
+
const config = await createStormWorkspaceConfig(
|
|
1452
|
+
void 0,
|
|
1453
|
+
void 0,
|
|
1454
|
+
workspaceRoot3,
|
|
1455
|
+
skipLogs,
|
|
1456
|
+
true
|
|
1457
|
+
);
|
|
1307
1458
|
setConfigEnv(config);
|
|
1308
1459
|
if (!skipLogs && !config.skipConfigLogging) {
|
|
1309
|
-
writeTrace(
|
|
1310
|
-
|
|
1460
|
+
writeTrace(
|
|
1461
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
1462
|
+
${formatLogMessage(config)}`,
|
|
1463
|
+
config
|
|
1464
|
+
);
|
|
1311
1465
|
}
|
|
1312
1466
|
return config;
|
|
1313
|
-
}
|
|
1467
|
+
};
|
|
1314
1468
|
|
|
1315
1469
|
// ../config-tools/src/get-config.ts
|
|
1316
1470
|
init_esm_shims();
|
|
1317
|
-
var getConfig =
|
|
1471
|
+
var getConfig = (workspaceRoot3, skipLogs = false) => {
|
|
1318
1472
|
return loadStormWorkspaceConfig(workspaceRoot3, skipLogs);
|
|
1319
|
-
}
|
|
1320
|
-
var getWorkspaceConfig =
|
|
1473
|
+
};
|
|
1474
|
+
var getWorkspaceConfig = (skipLogs = false, options = {}) => {
|
|
1321
1475
|
let workspaceRoot3 = options.workspaceRoot;
|
|
1322
1476
|
if (!workspaceRoot3) {
|
|
1323
1477
|
workspaceRoot3 = findWorkspaceRoot(options.cwd);
|
|
1324
1478
|
}
|
|
1325
1479
|
return getConfig(workspaceRoot3, skipLogs);
|
|
1326
|
-
}
|
|
1480
|
+
};
|
|
1327
1481
|
|
|
1328
1482
|
// ../workspace-tools/src/base/base-executor.ts
|
|
1329
1483
|
import { defu as defu3 } from "defu";
|
|
1330
|
-
var withRunExecutor =
|
|
1484
|
+
var withRunExecutor = (name, executorFn, executorOptions = {}) => async (_options, context) => {
|
|
1331
1485
|
const stopwatch = getStopwatch(name);
|
|
1332
1486
|
let options = _options;
|
|
1333
1487
|
let config = {};
|
|
1334
1488
|
try {
|
|
1335
1489
|
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
1336
|
-
throw new Error(
|
|
1490
|
+
throw new Error(
|
|
1491
|
+
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
1492
|
+
);
|
|
1337
1493
|
}
|
|
1338
1494
|
const workspaceRoot3 = findWorkspaceRoot();
|
|
1339
1495
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root || workspaceRoot3;
|
|
@@ -1342,35 +1498,50 @@ var withRunExecutor = /* @__PURE__ */ __name((name, executorFn, executorOptions
|
|
|
1342
1498
|
config.workspaceRoot = workspaceRoot3;
|
|
1343
1499
|
writeInfo(`\u26A1 Running the ${name} executor for ${projectName} `, config);
|
|
1344
1500
|
if (!executorOptions.skipReadingConfig) {
|
|
1345
|
-
writeTrace(
|
|
1501
|
+
writeTrace(
|
|
1502
|
+
`Loading the Storm Config from environment variables and storm.config.js file...
|
|
1346
1503
|
- workspaceRoot: ${workspaceRoot3}
|
|
1347
1504
|
- projectRoot: ${projectRoot}
|
|
1348
1505
|
- sourceRoot: ${sourceRoot}
|
|
1349
1506
|
- projectName: ${projectName}
|
|
1350
|
-
`,
|
|
1507
|
+
`,
|
|
1508
|
+
config
|
|
1509
|
+
);
|
|
1351
1510
|
config = await getConfig(workspaceRoot3);
|
|
1352
1511
|
}
|
|
1353
1512
|
if (executorOptions?.hooks?.applyDefaultOptions) {
|
|
1354
1513
|
writeDebug("Running the applyDefaultOptions hook...", config);
|
|
1355
|
-
options = await Promise.resolve(
|
|
1514
|
+
options = await Promise.resolve(
|
|
1515
|
+
executorOptions.hooks.applyDefaultOptions(options, config)
|
|
1516
|
+
);
|
|
1356
1517
|
writeDebug("Completed the applyDefaultOptions hook", config);
|
|
1357
1518
|
}
|
|
1358
|
-
writeTrace(
|
|
1519
|
+
writeTrace(
|
|
1520
|
+
`Executor schema options \u2699\uFE0F
|
|
1359
1521
|
${formatLogMessage(options)}
|
|
1360
|
-
`,
|
|
1361
|
-
const tokenized = await applyWorkspaceTokens(options, defu3({
|
|
1362
|
-
workspaceRoot: workspaceRoot3,
|
|
1363
|
-
projectRoot,
|
|
1364
|
-
sourceRoot,
|
|
1365
|
-
projectName,
|
|
1522
|
+
`,
|
|
1366
1523
|
config
|
|
1367
|
-
|
|
1368
|
-
|
|
1524
|
+
);
|
|
1525
|
+
const tokenized = await applyWorkspaceTokens(
|
|
1526
|
+
options,
|
|
1527
|
+
defu3(
|
|
1528
|
+
{ workspaceRoot: workspaceRoot3, projectRoot, sourceRoot, projectName, config },
|
|
1529
|
+
config,
|
|
1530
|
+
context.projectsConfigurations.projects[context.projectName]
|
|
1531
|
+
),
|
|
1532
|
+
applyWorkspaceProjectTokens
|
|
1533
|
+
);
|
|
1534
|
+
writeTrace(
|
|
1535
|
+
`Executor schema tokenized options \u2699\uFE0F
|
|
1369
1536
|
${formatLogMessage(tokenized)}
|
|
1370
|
-
`,
|
|
1537
|
+
`,
|
|
1538
|
+
config
|
|
1539
|
+
);
|
|
1371
1540
|
if (executorOptions?.hooks?.preProcess) {
|
|
1372
1541
|
writeDebug("Running the preProcess hook...", config);
|
|
1373
|
-
await Promise.resolve(
|
|
1542
|
+
await Promise.resolve(
|
|
1543
|
+
executorOptions.hooks.preProcess(tokenized, config)
|
|
1544
|
+
);
|
|
1374
1545
|
writeDebug("Completed the preProcess hook", config);
|
|
1375
1546
|
}
|
|
1376
1547
|
const ret = executorFn(tokenized, context, config);
|
|
@@ -1380,10 +1551,15 @@ ${formatLogMessage(tokenized)}
|
|
|
1380
1551
|
void iter;
|
|
1381
1552
|
}
|
|
1382
1553
|
}
|
|
1383
|
-
const result = await Promise.resolve(
|
|
1554
|
+
const result = await Promise.resolve(
|
|
1555
|
+
ret
|
|
1556
|
+
);
|
|
1384
1557
|
if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
|
|
1385
|
-
writeTrace(
|
|
1386
|
-
${
|
|
1558
|
+
writeTrace(
|
|
1559
|
+
`Failure determined by the ${name} executor
|
|
1560
|
+
${formatLogMessage(result)}`,
|
|
1561
|
+
config
|
|
1562
|
+
);
|
|
1387
1563
|
console.error(result);
|
|
1388
1564
|
throw new Error(`The ${name} executor failed to run`, {
|
|
1389
1565
|
cause: result?.error
|
|
@@ -1400,29 +1576,38 @@ ${formatLogMessage(result)}`, config);
|
|
|
1400
1576
|
success: true
|
|
1401
1577
|
};
|
|
1402
1578
|
} catch (error) {
|
|
1403
|
-
writeFatal(
|
|
1404
|
-
|
|
1579
|
+
writeFatal(
|
|
1580
|
+
"A fatal error occurred while running the executor - the process was forced to terminate",
|
|
1581
|
+
config
|
|
1582
|
+
);
|
|
1583
|
+
writeError(
|
|
1584
|
+
`An exception was thrown in the executor's process
|
|
1405
1585
|
- Details: ${error.message}
|
|
1406
|
-
- Stacktrace: ${error.stack}`,
|
|
1586
|
+
- Stacktrace: ${error.stack}`,
|
|
1587
|
+
config
|
|
1588
|
+
);
|
|
1407
1589
|
return {
|
|
1408
1590
|
success: false
|
|
1409
1591
|
};
|
|
1410
1592
|
} finally {
|
|
1411
1593
|
stopwatch();
|
|
1412
1594
|
}
|
|
1413
|
-
}
|
|
1414
|
-
var _isFunction2 =
|
|
1595
|
+
};
|
|
1596
|
+
var _isFunction2 = (value) => {
|
|
1415
1597
|
try {
|
|
1416
1598
|
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
1417
1599
|
} catch (e) {
|
|
1418
1600
|
return false;
|
|
1419
1601
|
}
|
|
1420
|
-
}
|
|
1602
|
+
};
|
|
1421
1603
|
|
|
1422
1604
|
// ../workspace-tools/src/utils/cargo.ts
|
|
1423
1605
|
init_esm_shims();
|
|
1424
1606
|
import { joinPathFragments, workspaceRoot } from "@nx/devkit";
|
|
1425
|
-
import {
|
|
1607
|
+
import {
|
|
1608
|
+
execSync,
|
|
1609
|
+
spawn
|
|
1610
|
+
} from "node:child_process";
|
|
1426
1611
|
import { relative } from "node:path";
|
|
1427
1612
|
var INVALID_CARGO_ARGS = [
|
|
1428
1613
|
"allFeatures",
|
|
@@ -1432,7 +1617,7 @@ var INVALID_CARGO_ARGS = [
|
|
|
1432
1617
|
"package",
|
|
1433
1618
|
"tsConfig"
|
|
1434
1619
|
];
|
|
1435
|
-
var buildCargoCommand =
|
|
1620
|
+
var buildCargoCommand = (baseCommand, options, context) => {
|
|
1436
1621
|
const args = [];
|
|
1437
1622
|
if (options.toolchain && options.toolchain !== "stable") {
|
|
1438
1623
|
args.push(`+${options.toolchain}`);
|
|
@@ -1470,13 +1655,12 @@ var buildCargoCommand = /* @__PURE__ */ __name((baseCommand, options, context) =
|
|
|
1470
1655
|
args.push("--target-dir", options.outputPath);
|
|
1471
1656
|
}
|
|
1472
1657
|
return args;
|
|
1473
|
-
}
|
|
1658
|
+
};
|
|
1474
1659
|
async function cargoCommand(...args) {
|
|
1475
1660
|
console.log(`> cargo ${args.join(" ")}`);
|
|
1476
1661
|
args.push("--color", "always");
|
|
1477
1662
|
return await Promise.resolve(runProcess("cargo", ...args));
|
|
1478
1663
|
}
|
|
1479
|
-
__name(cargoCommand, "cargoCommand");
|
|
1480
1664
|
function cargoCommandSync(args = "", options) {
|
|
1481
1665
|
const normalizedOptions = {
|
|
1482
1666
|
stdio: options?.stdio ?? "inherit",
|
|
@@ -1503,7 +1687,6 @@ function cargoCommandSync(args = "", options) {
|
|
|
1503
1687
|
};
|
|
1504
1688
|
}
|
|
1505
1689
|
}
|
|
1506
|
-
__name(cargoCommandSync, "cargoCommandSync");
|
|
1507
1690
|
function cargoMetadata() {
|
|
1508
1691
|
const output3 = cargoCommandSync("metadata --format-version=1", {
|
|
1509
1692
|
stdio: "pipe"
|
|
@@ -1514,15 +1697,12 @@ function cargoMetadata() {
|
|
|
1514
1697
|
}
|
|
1515
1698
|
return JSON.parse(output3.output);
|
|
1516
1699
|
}
|
|
1517
|
-
__name(cargoMetadata, "cargoMetadata");
|
|
1518
1700
|
function runProcess(processCmd, ...args) {
|
|
1519
1701
|
const metadata = cargoMetadata();
|
|
1520
1702
|
const targetDir = metadata?.target_directory ?? joinPathFragments(workspaceRoot, "dist", "cargo");
|
|
1521
1703
|
return new Promise((resolve) => {
|
|
1522
1704
|
if (process.env.VERCEL) {
|
|
1523
|
-
return resolve({
|
|
1524
|
-
success: true
|
|
1525
|
-
});
|
|
1705
|
+
return resolve({ success: true });
|
|
1526
1706
|
}
|
|
1527
1707
|
execSync(`${processCmd} ${args.join(" ")}`, {
|
|
1528
1708
|
cwd: process.cwd(),
|
|
@@ -1533,35 +1713,31 @@ function runProcess(processCmd, ...args) {
|
|
|
1533
1713
|
CARGO_BUILD_TARGET_DIR: targetDir
|
|
1534
1714
|
},
|
|
1535
1715
|
windowsHide: true,
|
|
1536
|
-
stdio: [
|
|
1537
|
-
"inherit",
|
|
1538
|
-
"inherit",
|
|
1539
|
-
"inherit"
|
|
1540
|
-
]
|
|
1541
|
-
});
|
|
1542
|
-
resolve({
|
|
1543
|
-
success: true
|
|
1716
|
+
stdio: ["inherit", "inherit", "inherit"]
|
|
1544
1717
|
});
|
|
1718
|
+
resolve({ success: true });
|
|
1545
1719
|
});
|
|
1546
1720
|
}
|
|
1547
|
-
__name(runProcess, "runProcess");
|
|
1548
1721
|
|
|
1549
1722
|
// ../workspace-tools/src/executors/cargo-build/executor.ts
|
|
1550
1723
|
async function cargoBuildExecutor(options, context) {
|
|
1551
1724
|
const command = buildCargoCommand("build", options, context);
|
|
1552
1725
|
return await cargoCommand(...command);
|
|
1553
1726
|
}
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
options
|
|
1561
|
-
|
|
1562
|
-
|
|
1727
|
+
var executor_default = withRunExecutor(
|
|
1728
|
+
"Cargo Build",
|
|
1729
|
+
cargoBuildExecutor,
|
|
1730
|
+
{
|
|
1731
|
+
skipReadingConfig: false,
|
|
1732
|
+
hooks: {
|
|
1733
|
+
applyDefaultOptions: (options) => {
|
|
1734
|
+
options.outputPath ??= "dist/target/{projectRoot}";
|
|
1735
|
+
options.toolchain ??= "stable";
|
|
1736
|
+
return options;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1563
1739
|
}
|
|
1564
|
-
|
|
1740
|
+
);
|
|
1565
1741
|
|
|
1566
1742
|
// ../workspace-tools/src/executors/cargo-check/executor.ts
|
|
1567
1743
|
init_esm_shims();
|
|
@@ -1569,16 +1745,19 @@ async function cargoCheckExecutor(options, context) {
|
|
|
1569
1745
|
const command = buildCargoCommand("check", options, context);
|
|
1570
1746
|
return await cargoCommand(...command);
|
|
1571
1747
|
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1748
|
+
var executor_default2 = withRunExecutor(
|
|
1749
|
+
"Cargo Check",
|
|
1750
|
+
cargoCheckExecutor,
|
|
1751
|
+
{
|
|
1752
|
+
skipReadingConfig: false,
|
|
1753
|
+
hooks: {
|
|
1754
|
+
applyDefaultOptions: (options) => {
|
|
1755
|
+
options.toolchain ??= "stable";
|
|
1756
|
+
return options;
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1580
1759
|
}
|
|
1581
|
-
|
|
1760
|
+
);
|
|
1582
1761
|
|
|
1583
1762
|
// ../workspace-tools/src/executors/cargo-clippy/executor.ts
|
|
1584
1763
|
init_esm_shims();
|
|
@@ -1586,46 +1765,50 @@ async function cargoClippyExecutor(options, context) {
|
|
|
1586
1765
|
const command = buildCargoCommand("clippy", options, context);
|
|
1587
1766
|
return await cargoCommand(...command);
|
|
1588
1767
|
}
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
options
|
|
1596
|
-
|
|
1597
|
-
|
|
1768
|
+
var executor_default3 = withRunExecutor(
|
|
1769
|
+
"Cargo Clippy",
|
|
1770
|
+
cargoClippyExecutor,
|
|
1771
|
+
{
|
|
1772
|
+
skipReadingConfig: false,
|
|
1773
|
+
hooks: {
|
|
1774
|
+
applyDefaultOptions: (options) => {
|
|
1775
|
+
options.toolchain ??= "stable";
|
|
1776
|
+
options.fix ??= false;
|
|
1777
|
+
return options;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1598
1780
|
}
|
|
1599
|
-
|
|
1781
|
+
);
|
|
1600
1782
|
|
|
1601
1783
|
// ../workspace-tools/src/executors/cargo-doc/executor.ts
|
|
1602
1784
|
init_esm_shims();
|
|
1603
1785
|
async function cargoDocExecutor(options, context) {
|
|
1604
|
-
const opts = {
|
|
1605
|
-
...options
|
|
1606
|
-
};
|
|
1786
|
+
const opts = { ...options };
|
|
1607
1787
|
opts["no-deps"] = opts.noDeps;
|
|
1608
1788
|
delete opts.noDeps;
|
|
1609
1789
|
const command = buildCargoCommand("doc", options, context);
|
|
1610
1790
|
return await cargoCommand(...command);
|
|
1611
1791
|
}
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
options
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1792
|
+
var executor_default4 = withRunExecutor(
|
|
1793
|
+
"Cargo Doc",
|
|
1794
|
+
cargoDocExecutor,
|
|
1795
|
+
{
|
|
1796
|
+
skipReadingConfig: false,
|
|
1797
|
+
hooks: {
|
|
1798
|
+
applyDefaultOptions: (options) => {
|
|
1799
|
+
options.outputPath ??= "dist/docs/{projectRoot}";
|
|
1800
|
+
options.toolchain ??= "stable";
|
|
1801
|
+
options.release ??= options.profile ? false : true;
|
|
1802
|
+
options.allFeatures ??= true;
|
|
1803
|
+
options.lib ??= true;
|
|
1804
|
+
options.bins ??= true;
|
|
1805
|
+
options.examples ??= true;
|
|
1806
|
+
options.noDeps ??= false;
|
|
1807
|
+
return options;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1627
1810
|
}
|
|
1628
|
-
|
|
1811
|
+
);
|
|
1629
1812
|
|
|
1630
1813
|
// ../workspace-tools/src/executors/cargo-format/executor.ts
|
|
1631
1814
|
init_esm_shims();
|
|
@@ -1633,17 +1816,20 @@ async function cargoFormatExecutor(options, context) {
|
|
|
1633
1816
|
const command = buildCargoCommand("fmt", options, context);
|
|
1634
1817
|
return await cargoCommand(...command);
|
|
1635
1818
|
}
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
options
|
|
1643
|
-
|
|
1644
|
-
|
|
1819
|
+
var executor_default5 = withRunExecutor(
|
|
1820
|
+
"Cargo Format",
|
|
1821
|
+
cargoFormatExecutor,
|
|
1822
|
+
{
|
|
1823
|
+
skipReadingConfig: false,
|
|
1824
|
+
hooks: {
|
|
1825
|
+
applyDefaultOptions: (options) => {
|
|
1826
|
+
options.outputPath ??= "dist/target/{projectRoot}";
|
|
1827
|
+
options.toolchain ??= "stable";
|
|
1828
|
+
return options;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1645
1831
|
}
|
|
1646
|
-
|
|
1832
|
+
);
|
|
1647
1833
|
|
|
1648
1834
|
// ../workspace-tools/src/executors/cargo-publish/executor.ts
|
|
1649
1835
|
init_esm_shims();
|
|
@@ -1718,7 +1904,7 @@ init_esm_shims();
|
|
|
1718
1904
|
import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
|
|
1719
1905
|
import { glob } from "glob";
|
|
1720
1906
|
import { readFile as readFile2, writeFile } from "node:fs/promises";
|
|
1721
|
-
var copyAssets =
|
|
1907
|
+
var copyAssets = async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1722
1908
|
const pendingAssets = Array.from(assets ?? []);
|
|
1723
1909
|
pendingAssets.push({
|
|
1724
1910
|
input: projectRoot,
|
|
@@ -1744,8 +1930,11 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
1744
1930
|
output: "src/"
|
|
1745
1931
|
});
|
|
1746
1932
|
}
|
|
1747
|
-
writeTrace(
|
|
1748
|
-
|
|
1933
|
+
writeTrace(
|
|
1934
|
+
`\u{1F4DD} Copying the following assets to the output directory:
|
|
1935
|
+
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`,
|
|
1936
|
+
config
|
|
1937
|
+
);
|
|
1749
1938
|
const assetHandler = new CopyAssetsHandler({
|
|
1750
1939
|
projectDir: projectRoot,
|
|
1751
1940
|
rootDir: config.workspaceRoot,
|
|
@@ -1754,20 +1943,33 @@ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${p
|
|
|
1754
1943
|
});
|
|
1755
1944
|
await assetHandler.processAllAssetsOnce();
|
|
1756
1945
|
if (includeSrc === true) {
|
|
1757
|
-
writeDebug(
|
|
1946
|
+
writeDebug(
|
|
1947
|
+
`\u{1F4DD} Adding banner and writing source files: ${joinPaths(
|
|
1948
|
+
outputPath,
|
|
1949
|
+
"src"
|
|
1950
|
+
)}`,
|
|
1951
|
+
config
|
|
1952
|
+
);
|
|
1758
1953
|
const files = await glob([
|
|
1759
1954
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
1760
1955
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
1761
1956
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
1762
1957
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
1763
1958
|
]);
|
|
1764
|
-
await Promise.allSettled(
|
|
1959
|
+
await Promise.allSettled(
|
|
1960
|
+
files.map(
|
|
1961
|
+
async (file) => writeFile(
|
|
1962
|
+
file,
|
|
1963
|
+
`${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
1765
1964
|
|
|
1766
1965
|
${await readFile2(file, "utf8")}
|
|
1767
1966
|
|
|
1768
|
-
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
|
|
1967
|
+
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`
|
|
1968
|
+
)
|
|
1969
|
+
)
|
|
1970
|
+
);
|
|
1769
1971
|
}
|
|
1770
|
-
}
|
|
1972
|
+
};
|
|
1771
1973
|
|
|
1772
1974
|
// ../build-tools/src/utilities/generate-package-json.ts
|
|
1773
1975
|
init_esm_shims();
|
|
@@ -1775,8 +1977,12 @@ import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildabl
|
|
|
1775
1977
|
import { Glob } from "glob";
|
|
1776
1978
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
|
|
1777
1979
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
1778
|
-
import {
|
|
1779
|
-
|
|
1980
|
+
import {
|
|
1981
|
+
createProjectGraphAsync,
|
|
1982
|
+
readCachedProjectGraph,
|
|
1983
|
+
readProjectsConfigurationFromProjectGraph
|
|
1984
|
+
} from "nx/src/project-graph/project-graph";
|
|
1985
|
+
var addPackageDependencies = async (workspaceRoot3, projectRoot, projectName, packageJson) => {
|
|
1780
1986
|
let projectGraph;
|
|
1781
1987
|
try {
|
|
1782
1988
|
projectGraph = readCachedProjectGraph();
|
|
@@ -1785,16 +1991,35 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, proje
|
|
|
1785
1991
|
projectGraph = readCachedProjectGraph();
|
|
1786
1992
|
}
|
|
1787
1993
|
if (!projectGraph) {
|
|
1788
|
-
throw new Error(
|
|
1994
|
+
throw new Error(
|
|
1995
|
+
"The Build process failed because the project graph is not available. Please run the build command again."
|
|
1996
|
+
);
|
|
1789
1997
|
}
|
|
1790
|
-
const projectDependencies = calculateProjectBuildableDependencies(
|
|
1998
|
+
const projectDependencies = calculateProjectBuildableDependencies(
|
|
1999
|
+
void 0,
|
|
2000
|
+
projectGraph,
|
|
2001
|
+
workspaceRoot3,
|
|
2002
|
+
projectName,
|
|
2003
|
+
process.env.NX_TASK_TARGET_TARGET || "build",
|
|
2004
|
+
process.env.NX_TASK_TARGET_CONFIGURATION || "production",
|
|
2005
|
+
true
|
|
2006
|
+
);
|
|
1791
2007
|
const localPackages = [];
|
|
1792
|
-
for (const project of projectDependencies.dependencies.filter(
|
|
2008
|
+
for (const project of projectDependencies.dependencies.filter(
|
|
2009
|
+
(dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot3
|
|
2010
|
+
)) {
|
|
1793
2011
|
const projectNode = project.node;
|
|
1794
2012
|
if (projectNode.data.root) {
|
|
1795
|
-
const projectPackageJsonPath = joinPaths(
|
|
2013
|
+
const projectPackageJsonPath = joinPaths(
|
|
2014
|
+
workspaceRoot3,
|
|
2015
|
+
projectNode.data.root,
|
|
2016
|
+
"package.json"
|
|
2017
|
+
);
|
|
1796
2018
|
if (existsSync3(projectPackageJsonPath)) {
|
|
1797
|
-
const projectPackageJsonContent = await readFile3(
|
|
2019
|
+
const projectPackageJsonContent = await readFile3(
|
|
2020
|
+
projectPackageJsonPath,
|
|
2021
|
+
"utf8"
|
|
2022
|
+
);
|
|
1798
2023
|
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
1799
2024
|
if (projectPackageJson.private !== true) {
|
|
1800
2025
|
localPackages.push(projectPackageJson);
|
|
@@ -1803,19 +2028,33 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, proje
|
|
|
1803
2028
|
}
|
|
1804
2029
|
}
|
|
1805
2030
|
if (localPackages.length > 0) {
|
|
1806
|
-
writeTrace(
|
|
1807
|
-
|
|
2031
|
+
writeTrace(
|
|
2032
|
+
`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`
|
|
2033
|
+
);
|
|
2034
|
+
const projectJsonFile = await readFile3(
|
|
2035
|
+
joinPaths(projectRoot, "project.json"),
|
|
2036
|
+
"utf8"
|
|
2037
|
+
);
|
|
1808
2038
|
const projectJson = JSON.parse(projectJsonFile);
|
|
1809
2039
|
const projectName2 = projectJson.name;
|
|
1810
2040
|
const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
1811
2041
|
if (!projectConfigurations?.projects?.[projectName2]) {
|
|
1812
|
-
throw new Error(
|
|
2042
|
+
throw new Error(
|
|
2043
|
+
"The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project."
|
|
2044
|
+
);
|
|
1813
2045
|
}
|
|
1814
2046
|
const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
|
|
1815
2047
|
if (projectConfigurations.projects?.[dep]) {
|
|
1816
|
-
const depPackageJsonPath = joinPaths(
|
|
2048
|
+
const depPackageJsonPath = joinPaths(
|
|
2049
|
+
workspaceRoot3,
|
|
2050
|
+
projectConfigurations.projects[dep].root,
|
|
2051
|
+
"package.json"
|
|
2052
|
+
);
|
|
1817
2053
|
if (existsSync3(depPackageJsonPath)) {
|
|
1818
|
-
const depPackageJsonContent = readFileSync2(
|
|
2054
|
+
const depPackageJsonContent = readFileSync2(
|
|
2055
|
+
depPackageJsonPath,
|
|
2056
|
+
"utf8"
|
|
2057
|
+
);
|
|
1819
2058
|
const depPackageJson = JSON.parse(depPackageJsonContent);
|
|
1820
2059
|
if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
|
|
1821
2060
|
ret.push(depPackageJson.name);
|
|
@@ -1840,10 +2079,13 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot3, proje
|
|
|
1840
2079
|
writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
|
|
1841
2080
|
}
|
|
1842
2081
|
return packageJson;
|
|
1843
|
-
}
|
|
1844
|
-
var addWorkspacePackageJsonFields =
|
|
2082
|
+
};
|
|
2083
|
+
var addWorkspacePackageJsonFields = async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
1845
2084
|
const workspaceRoot3 = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
|
|
1846
|
-
const workspacePackageJsonContent = await readFile3(
|
|
2085
|
+
const workspacePackageJsonContent = await readFile3(
|
|
2086
|
+
joinPaths(workspaceRoot3, "package.json"),
|
|
2087
|
+
"utf8"
|
|
2088
|
+
);
|
|
1847
2089
|
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
1848
2090
|
packageJson.type ??= "module";
|
|
1849
2091
|
packageJson.sideEffects ??= false;
|
|
@@ -1854,9 +2096,7 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfi
|
|
|
1854
2096
|
}
|
|
1855
2097
|
packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
1856
2098
|
}
|
|
1857
|
-
packageJson.files ??= [
|
|
1858
|
-
"dist/**/*"
|
|
1859
|
-
];
|
|
2099
|
+
packageJson.files ??= ["dist/**/*"];
|
|
1860
2100
|
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
1861
2101
|
packageJson.files.push("src/**/*");
|
|
1862
2102
|
}
|
|
@@ -1872,20 +2112,16 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfi
|
|
|
1872
2112
|
packageJson.author ??= workspacePackageJson.author;
|
|
1873
2113
|
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
1874
2114
|
if (!packageJson.maintainers && packageJson.author) {
|
|
1875
|
-
packageJson.maintainers = [
|
|
1876
|
-
packageJson.author
|
|
1877
|
-
];
|
|
2115
|
+
packageJson.maintainers = [packageJson.author];
|
|
1878
2116
|
}
|
|
1879
2117
|
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
1880
2118
|
if (!packageJson.contributors && packageJson.author) {
|
|
1881
|
-
packageJson.contributors = [
|
|
1882
|
-
packageJson.author
|
|
1883
|
-
];
|
|
2119
|
+
packageJson.contributors = [packageJson.author];
|
|
1884
2120
|
}
|
|
1885
2121
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
1886
2122
|
packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
|
|
1887
2123
|
return packageJson;
|
|
1888
|
-
}
|
|
2124
|
+
};
|
|
1889
2125
|
|
|
1890
2126
|
// ../build-tools/src/utilities/get-entry-points.ts
|
|
1891
2127
|
init_esm_shims();
|
|
@@ -1893,7 +2129,7 @@ import { glob as glob2 } from "glob";
|
|
|
1893
2129
|
|
|
1894
2130
|
// ../build-tools/src/utilities/get-env.ts
|
|
1895
2131
|
init_esm_shims();
|
|
1896
|
-
var getEnv =
|
|
2132
|
+
var getEnv = (builder, options) => {
|
|
1897
2133
|
return {
|
|
1898
2134
|
STORM_BUILD: builder,
|
|
1899
2135
|
STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
|
|
@@ -1904,7 +2140,7 @@ var getEnv = /* @__PURE__ */ __name((builder, options) => {
|
|
|
1904
2140
|
STORM_TARGET: JSON.stringify(options.target),
|
|
1905
2141
|
...options.env
|
|
1906
2142
|
};
|
|
1907
|
-
}
|
|
2143
|
+
};
|
|
1908
2144
|
|
|
1909
2145
|
// ../build-tools/src/utilities/get-file-banner.ts
|
|
1910
2146
|
init_esm_shims();
|
|
@@ -1922,34 +2158,46 @@ import { readFile as readFile4 } from "node:fs/promises";
|
|
|
1922
2158
|
|
|
1923
2159
|
// ../build-tools/src/utilities/task-graph.ts
|
|
1924
2160
|
init_esm_shims();
|
|
1925
|
-
import {
|
|
2161
|
+
import {
|
|
2162
|
+
createTaskGraph,
|
|
2163
|
+
mapTargetDefaultsToDependencies
|
|
2164
|
+
} from "nx/src/tasks-runner/create-task-graph";
|
|
1926
2165
|
|
|
1927
2166
|
// ../esbuild/src/assets.ts
|
|
1928
2167
|
async function copyBuildAssets(context) {
|
|
1929
2168
|
if (context.result?.errors.length === 0) {
|
|
1930
|
-
writeDebug(
|
|
2169
|
+
writeDebug(
|
|
2170
|
+
` \u{1F4CB} Copying asset files to output directory: ${context.outputPath}`,
|
|
2171
|
+
context.workspaceConfig
|
|
2172
|
+
);
|
|
1931
2173
|
const stopwatch = getStopwatch(`${context.options.name} asset copy`);
|
|
1932
|
-
await copyAssets(
|
|
2174
|
+
await copyAssets(
|
|
2175
|
+
context.workspaceConfig,
|
|
2176
|
+
context.options.assets ?? [],
|
|
2177
|
+
context.outputPath,
|
|
2178
|
+
context.options.projectRoot,
|
|
2179
|
+
context.sourceRoot,
|
|
2180
|
+
true,
|
|
2181
|
+
false
|
|
2182
|
+
);
|
|
1933
2183
|
stopwatch();
|
|
1934
2184
|
}
|
|
1935
2185
|
return context;
|
|
1936
2186
|
}
|
|
1937
|
-
__name(copyBuildAssets, "copyBuildAssets");
|
|
1938
2187
|
|
|
1939
2188
|
// ../esbuild/src/clean.ts
|
|
1940
2189
|
init_esm_shims();
|
|
1941
2190
|
import { rm } from "node:fs/promises";
|
|
1942
2191
|
async function cleanDirectories(directory) {
|
|
1943
|
-
await rm(directory, {
|
|
1944
|
-
recursive: true,
|
|
1945
|
-
force: true
|
|
1946
|
-
});
|
|
2192
|
+
await rm(directory, { recursive: true, force: true });
|
|
1947
2193
|
}
|
|
1948
|
-
__name(cleanDirectories, "cleanDirectories");
|
|
1949
2194
|
|
|
1950
2195
|
// ../esbuild/src/context.ts
|
|
1951
2196
|
init_esm_shims();
|
|
1952
|
-
import {
|
|
2197
|
+
import {
|
|
2198
|
+
createProjectGraphAsync as createProjectGraphAsync2,
|
|
2199
|
+
readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2
|
|
2200
|
+
} from "@nx/devkit";
|
|
1953
2201
|
import defu4 from "defu";
|
|
1954
2202
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1955
2203
|
import hf from "node:fs/promises";
|
|
@@ -2008,43 +2256,46 @@ function resolvePathsConfig(options, cwd, projectRoot) {
|
|
|
2008
2256
|
if (options?.compilerOptions?.paths) {
|
|
2009
2257
|
const paths = Object.entries(options.compilerOptions.paths);
|
|
2010
2258
|
const resolvedPaths = paths.map(([key, paths2]) => {
|
|
2011
|
-
return [
|
|
2012
|
-
key,
|
|
2013
|
-
paths2.map((v) => path2.resolve(cwd, v))
|
|
2014
|
-
];
|
|
2259
|
+
return [key, paths2.map((v) => path2.resolve(cwd, v))];
|
|
2015
2260
|
});
|
|
2016
2261
|
return Object.fromEntries(resolvedPaths);
|
|
2017
2262
|
}
|
|
2018
2263
|
if (options.extends) {
|
|
2019
|
-
const extendsPath = path2.resolve(
|
|
2264
|
+
const extendsPath = path2.resolve(
|
|
2265
|
+
projectRoot ? joinPaths(cwd, projectRoot, options.extends) : joinPaths(cwd, options.extends)
|
|
2266
|
+
);
|
|
2020
2267
|
const extendsDir = path2.dirname(extendsPath);
|
|
2021
2268
|
const extendsConfig = __require(extendsPath);
|
|
2022
2269
|
return resolvePathsConfig(extendsConfig, extendsDir);
|
|
2023
2270
|
}
|
|
2024
2271
|
return [];
|
|
2025
2272
|
}
|
|
2026
|
-
|
|
2027
|
-
var resolvePathsPlugin = /* @__PURE__ */ __name((context) => ({
|
|
2273
|
+
var resolvePathsPlugin = (context) => ({
|
|
2028
2274
|
name: "storm:resolve-paths",
|
|
2029
2275
|
setup(build3) {
|
|
2030
|
-
const parentTsConfig = build3.initialOptions.tsconfig ? __require(joinPaths(
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2276
|
+
const parentTsConfig = build3.initialOptions.tsconfig ? __require(joinPaths(
|
|
2277
|
+
context.workspaceConfig.workspaceRoot,
|
|
2278
|
+
build3.initialOptions.tsconfig.replace(
|
|
2279
|
+
context.workspaceConfig.workspaceRoot,
|
|
2280
|
+
""
|
|
2281
|
+
)
|
|
2282
|
+
)) : __require(joinPaths(context.workspaceConfig.workspaceRoot, "tsconfig.json"));
|
|
2283
|
+
const resolvedTsPaths = resolvePathsConfig(
|
|
2284
|
+
parentTsConfig,
|
|
2285
|
+
context.workspaceConfig.workspaceRoot,
|
|
2286
|
+
context.options.projectRoot
|
|
2287
|
+
);
|
|
2288
|
+
const packagesRegex = new RegExp(
|
|
2289
|
+
`^(${Object.keys(resolvedTsPaths).join("|")})$`
|
|
2290
|
+
);
|
|
2291
|
+
build3.onResolve({ filter: packagesRegex }, (args) => {
|
|
2036
2292
|
if (build3.initialOptions.external?.includes(args.path)) {
|
|
2037
|
-
return {
|
|
2038
|
-
path: args.path,
|
|
2039
|
-
external: true
|
|
2040
|
-
};
|
|
2293
|
+
return { path: args.path, external: true };
|
|
2041
2294
|
}
|
|
2042
|
-
return {
|
|
2043
|
-
path: `${resolvedTsPaths[args.path][0]}/index.ts`
|
|
2044
|
-
};
|
|
2295
|
+
return { path: `${resolvedTsPaths[args.path][0]}/index.ts` };
|
|
2045
2296
|
});
|
|
2046
2297
|
}
|
|
2047
|
-
})
|
|
2298
|
+
});
|
|
2048
2299
|
|
|
2049
2300
|
// ../esbuild/src/context.ts
|
|
2050
2301
|
async function resolveContext(userOptions) {
|
|
@@ -2061,7 +2312,11 @@ async function resolveContext(userOptions) {
|
|
|
2061
2312
|
const projectGraph = await createProjectGraphAsync2({
|
|
2062
2313
|
exitOnError: true
|
|
2063
2314
|
});
|
|
2064
|
-
const projectJsonPath = joinPaths(
|
|
2315
|
+
const projectJsonPath = joinPaths(
|
|
2316
|
+
workspaceRoot3.dir,
|
|
2317
|
+
projectRoot,
|
|
2318
|
+
"project.json"
|
|
2319
|
+
);
|
|
2065
2320
|
if (!existsSync5(projectJsonPath)) {
|
|
2066
2321
|
throw new Error("Cannot find project.json configuration");
|
|
2067
2322
|
}
|
|
@@ -2070,11 +2325,17 @@ async function resolveContext(userOptions) {
|
|
|
2070
2325
|
const projectName = projectJson.name || userOptions.name;
|
|
2071
2326
|
const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
|
|
2072
2327
|
if (!projectConfigurations?.projects?.[projectName]) {
|
|
2073
|
-
throw new Error(
|
|
2328
|
+
throw new Error(
|
|
2329
|
+
"The Build process failed because the project does not have a valid configuration in the project.json file. Check if the file exists in the root of the project."
|
|
2330
|
+
);
|
|
2074
2331
|
}
|
|
2075
2332
|
const options = defu4(userOptions, DEFAULT_BUILD_OPTIONS);
|
|
2076
2333
|
options.name ??= projectName;
|
|
2077
|
-
const packageJsonPath = joinPaths(
|
|
2334
|
+
const packageJsonPath = joinPaths(
|
|
2335
|
+
workspaceRoot3.dir,
|
|
2336
|
+
options.projectRoot,
|
|
2337
|
+
"package.json"
|
|
2338
|
+
);
|
|
2078
2339
|
if (!existsSync5(packageJsonPath)) {
|
|
2079
2340
|
throw new Error("Cannot find package.json configuration");
|
|
2080
2341
|
}
|
|
@@ -2108,7 +2369,11 @@ async function resolveContext(userOptions) {
|
|
|
2108
2369
|
projectName,
|
|
2109
2370
|
projectGraph,
|
|
2110
2371
|
sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || joinPaths(resolvedOptions.projectRoot, "src"),
|
|
2111
|
-
outputPath: resolvedOptions.outputPath || joinPaths(
|
|
2372
|
+
outputPath: resolvedOptions.outputPath || joinPaths(
|
|
2373
|
+
workspaceConfig.workspaceRoot,
|
|
2374
|
+
"dist",
|
|
2375
|
+
resolvedOptions.projectRoot
|
|
2376
|
+
),
|
|
2112
2377
|
minify: resolvedOptions.minify || resolvedOptions.mode === "production"
|
|
2113
2378
|
};
|
|
2114
2379
|
context.options.esbuildPlugins = [
|
|
@@ -2117,7 +2382,6 @@ async function resolveContext(userOptions) {
|
|
|
2117
2382
|
];
|
|
2118
2383
|
return context;
|
|
2119
2384
|
}
|
|
2120
|
-
__name(resolveContext, "resolveContext");
|
|
2121
2385
|
|
|
2122
2386
|
// ../esbuild/src/package-json.ts
|
|
2123
2387
|
init_esm_shims();
|
|
@@ -2128,17 +2392,39 @@ async function generatePackageJson(context) {
|
|
|
2128
2392
|
if (context.options.generatePackageJson !== false && existsSync6(joinPaths(context.options.projectRoot, "package.json"))) {
|
|
2129
2393
|
writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
|
|
2130
2394
|
const stopwatch = getStopwatch("Write package.json file");
|
|
2131
|
-
const packageJsonPath = joinPaths(
|
|
2395
|
+
const packageJsonPath = joinPaths(
|
|
2396
|
+
context.options.projectRoot,
|
|
2397
|
+
"project.json"
|
|
2398
|
+
);
|
|
2132
2399
|
if (!existsSync6(packageJsonPath)) {
|
|
2133
2400
|
throw new Error("Cannot find package.json configuration");
|
|
2134
2401
|
}
|
|
2135
|
-
const packageJsonFile = await hf2.readFile(
|
|
2402
|
+
const packageJsonFile = await hf2.readFile(
|
|
2403
|
+
joinPaths(
|
|
2404
|
+
context.workspaceConfig.workspaceRoot,
|
|
2405
|
+
context.options.projectRoot,
|
|
2406
|
+
"package.json"
|
|
2407
|
+
),
|
|
2408
|
+
"utf8"
|
|
2409
|
+
);
|
|
2136
2410
|
let packageJson = JSON.parse(packageJsonFile);
|
|
2137
2411
|
if (!packageJson) {
|
|
2138
2412
|
throw new Error("Cannot find package.json configuration file");
|
|
2139
2413
|
}
|
|
2140
|
-
packageJson = await addPackageDependencies(
|
|
2141
|
-
|
|
2414
|
+
packageJson = await addPackageDependencies(
|
|
2415
|
+
context.workspaceConfig.workspaceRoot,
|
|
2416
|
+
context.options.projectRoot,
|
|
2417
|
+
context.projectName,
|
|
2418
|
+
packageJson
|
|
2419
|
+
);
|
|
2420
|
+
packageJson = await addWorkspacePackageJsonFields(
|
|
2421
|
+
context.workspaceConfig,
|
|
2422
|
+
context.options.projectRoot,
|
|
2423
|
+
context.sourceRoot,
|
|
2424
|
+
context.projectName,
|
|
2425
|
+
false,
|
|
2426
|
+
packageJson
|
|
2427
|
+
);
|
|
2142
2428
|
if (context.options.entry) {
|
|
2143
2429
|
packageJson.exports ??= {};
|
|
2144
2430
|
packageJson.exports["./package.json"] ??= "./package.json";
|
|
@@ -2208,20 +2494,25 @@ async function generatePackageJson(context) {
|
|
|
2208
2494
|
if (isDts) {
|
|
2209
2495
|
packageJson.types = `${defaultEntry}.d.${isEsm ? "mts" : isCjs ? "cts" : "ts"}`;
|
|
2210
2496
|
}
|
|
2211
|
-
packageJson.exports = Object.keys(packageJson.exports).reduce(
|
|
2212
|
-
|
|
2213
|
-
ret[key.replace("/index", "")]
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2497
|
+
packageJson.exports = Object.keys(packageJson.exports).reduce(
|
|
2498
|
+
(ret, key) => {
|
|
2499
|
+
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
2500
|
+
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
2501
|
+
}
|
|
2502
|
+
return ret;
|
|
2503
|
+
},
|
|
2504
|
+
packageJson.exports
|
|
2505
|
+
);
|
|
2217
2506
|
}
|
|
2218
2507
|
}
|
|
2219
|
-
await writeJsonFile(
|
|
2508
|
+
await writeJsonFile(
|
|
2509
|
+
joinPaths(context.outputPath, "package.json"),
|
|
2510
|
+
packageJson
|
|
2511
|
+
);
|
|
2220
2512
|
stopwatch();
|
|
2221
2513
|
}
|
|
2222
2514
|
return context;
|
|
2223
2515
|
}
|
|
2224
|
-
__name(generatePackageJson, "generatePackageJson");
|
|
2225
2516
|
|
|
2226
2517
|
// ../esbuild/src/plugins/deps-check.ts
|
|
2227
2518
|
init_esm_shims();
|
|
@@ -2251,12 +2542,8 @@ var unusedIgnore = [
|
|
|
2251
2542
|
// these are indirectly used by build
|
|
2252
2543
|
"buffer"
|
|
2253
2544
|
];
|
|
2254
|
-
var missingIgnore = [
|
|
2255
|
-
|
|
2256
|
-
"@prisma/client",
|
|
2257
|
-
"ts-toolbelt"
|
|
2258
|
-
];
|
|
2259
|
-
var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
2545
|
+
var missingIgnore = [".prisma", "@prisma/client", "ts-toolbelt"];
|
|
2546
|
+
var depsCheckPlugin = (bundle) => ({
|
|
2260
2547
|
name: "storm:deps-check",
|
|
2261
2548
|
setup(build3) {
|
|
2262
2549
|
const pkgJsonPath = path3.join(process.cwd(), "package.json");
|
|
@@ -2270,9 +2557,7 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
|
2270
2557
|
];
|
|
2271
2558
|
const collectedDependencies = /* @__PURE__ */ new Set();
|
|
2272
2559
|
const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
|
|
2273
|
-
build3.onResolve({
|
|
2274
|
-
filter: onlyPackages
|
|
2275
|
-
}, (args) => {
|
|
2560
|
+
build3.onResolve({ filter: onlyPackages }, (args) => {
|
|
2276
2561
|
if (args.importer.includes(process.cwd())) {
|
|
2277
2562
|
if (args.path[0] === "@") {
|
|
2278
2563
|
const [org, pkg] = args.path.split("/");
|
|
@@ -2282,19 +2567,13 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
|
2282
2567
|
collectedDependencies.add(pkg);
|
|
2283
2568
|
}
|
|
2284
2569
|
}
|
|
2285
|
-
return {
|
|
2286
|
-
external: true
|
|
2287
|
-
};
|
|
2570
|
+
return { external: true };
|
|
2288
2571
|
});
|
|
2289
2572
|
build3.onEnd(() => {
|
|
2290
|
-
const unusedDependencies = [
|
|
2291
|
-
...dependencies
|
|
2292
|
-
].filter((dep) => {
|
|
2573
|
+
const unusedDependencies = [...dependencies].filter((dep) => {
|
|
2293
2574
|
return !collectedDependencies.has(dep) || builtinModules2.includes(dep);
|
|
2294
2575
|
});
|
|
2295
|
-
const missingDependencies = [
|
|
2296
|
-
...collectedDependencies
|
|
2297
|
-
].filter((dep) => {
|
|
2576
|
+
const missingDependencies = [...collectedDependencies].filter((dep) => {
|
|
2298
2577
|
return !dependencies.includes(dep) && !builtinModules2.includes(dep);
|
|
2299
2578
|
});
|
|
2300
2579
|
const filteredUnusedDeps = unusedDependencies.filter((dep) => {
|
|
@@ -2303,8 +2582,12 @@ var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
|
2303
2582
|
const filteredMissingDeps = missingDependencies.filter((dep) => {
|
|
2304
2583
|
return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
|
|
2305
2584
|
});
|
|
2306
|
-
writeWarning(
|
|
2307
|
-
|
|
2585
|
+
writeWarning(
|
|
2586
|
+
`Unused Dependencies: ${JSON.stringify(filteredUnusedDeps)}`
|
|
2587
|
+
);
|
|
2588
|
+
writeError(
|
|
2589
|
+
`Missing Dependencies: ${JSON.stringify(filteredMissingDeps)}`
|
|
2590
|
+
);
|
|
2308
2591
|
if (filteredMissingDeps.length > 0) {
|
|
2309
2592
|
throw new Error(`Missing dependencies detected - please install them:
|
|
2310
2593
|
${JSON.stringify(filteredMissingDeps)}
|
|
@@ -2312,13 +2595,16 @@ ${JSON.stringify(filteredMissingDeps)}
|
|
|
2312
2595
|
}
|
|
2313
2596
|
});
|
|
2314
2597
|
}
|
|
2315
|
-
})
|
|
2598
|
+
});
|
|
2316
2599
|
|
|
2317
2600
|
// ../esbuild/src/tsup.ts
|
|
2318
2601
|
init_esm_shims();
|
|
2319
2602
|
import { build as tsup } from "tsup";
|
|
2320
2603
|
async function executeTsup(context) {
|
|
2321
|
-
writeDebug(
|
|
2604
|
+
writeDebug(
|
|
2605
|
+
` \u{1F680} Running ${context.options.name} build`,
|
|
2606
|
+
context.workspaceConfig
|
|
2607
|
+
);
|
|
2322
2608
|
const stopwatch = getStopwatch(`${context.options.name} build`);
|
|
2323
2609
|
await tsup({
|
|
2324
2610
|
...context.options,
|
|
@@ -2328,21 +2614,30 @@ async function executeTsup(context) {
|
|
|
2328
2614
|
stopwatch();
|
|
2329
2615
|
return context;
|
|
2330
2616
|
}
|
|
2331
|
-
__name(executeTsup, "executeTsup");
|
|
2332
2617
|
|
|
2333
2618
|
// ../esbuild/src/build.ts
|
|
2334
2619
|
async function reportResults(context) {
|
|
2335
2620
|
if (context.result?.errors.length === 0) {
|
|
2336
2621
|
if (context.result.warnings.length > 0) {
|
|
2337
|
-
writeWarning(
|
|
2622
|
+
writeWarning(
|
|
2623
|
+
` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`,
|
|
2624
|
+
context.workspaceConfig
|
|
2625
|
+
);
|
|
2338
2626
|
}
|
|
2339
|
-
writeSuccess(
|
|
2627
|
+
writeSuccess(
|
|
2628
|
+
` \u{1F4E6} The ${context.options.name} build completed successfully`,
|
|
2629
|
+
context.workspaceConfig
|
|
2630
|
+
);
|
|
2340
2631
|
} else if (context.result?.errors && context.result?.errors.length > 0) {
|
|
2341
|
-
writeError(
|
|
2342
|
-
|
|
2632
|
+
writeError(
|
|
2633
|
+
` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`,
|
|
2634
|
+
context.workspaceConfig
|
|
2635
|
+
);
|
|
2636
|
+
throw new Error(
|
|
2637
|
+
`The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`
|
|
2638
|
+
);
|
|
2343
2639
|
}
|
|
2344
2640
|
}
|
|
2345
|
-
__name(reportResults, "reportResults");
|
|
2346
2641
|
async function dependencyCheck(options) {
|
|
2347
2642
|
if (process.env.DEV === "true") {
|
|
2348
2643
|
return void 0;
|
|
@@ -2353,43 +2648,39 @@ async function dependencyCheck(options) {
|
|
|
2353
2648
|
const buildPromise = esbuild.build({
|
|
2354
2649
|
entryPoints: globbySync("**/*.{j,t}s", {
|
|
2355
2650
|
// We don't check dependencies in ecosystem tests because tests are isolated from the build.
|
|
2356
|
-
ignore: [
|
|
2357
|
-
"./src/__tests__/**/*",
|
|
2358
|
-
"./tests/e2e/**/*",
|
|
2359
|
-
"./dist/**/*"
|
|
2360
|
-
],
|
|
2651
|
+
ignore: ["./src/__tests__/**/*", "./tests/e2e/**/*", "./dist/**/*"],
|
|
2361
2652
|
gitignore: true
|
|
2362
2653
|
}),
|
|
2363
2654
|
logLevel: "silent",
|
|
2655
|
+
// there will be errors
|
|
2364
2656
|
bundle: true,
|
|
2657
|
+
// we bundle to get everything
|
|
2365
2658
|
write: false,
|
|
2659
|
+
// no need to write for analysis
|
|
2366
2660
|
outdir: "out",
|
|
2367
|
-
plugins: [
|
|
2368
|
-
depsCheckPlugin(options.bundle)
|
|
2369
|
-
]
|
|
2661
|
+
plugins: [depsCheckPlugin(options.bundle)]
|
|
2370
2662
|
});
|
|
2371
2663
|
await buildPromise.catch(() => {
|
|
2372
2664
|
});
|
|
2373
2665
|
return void 0;
|
|
2374
2666
|
}
|
|
2375
|
-
__name(dependencyCheck, "dependencyCheck");
|
|
2376
2667
|
async function cleanOutputPath(context) {
|
|
2377
2668
|
if (context.clean !== false && context.outputPath) {
|
|
2378
|
-
writeDebug(
|
|
2669
|
+
writeDebug(
|
|
2670
|
+
` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`,
|
|
2671
|
+
context.workspaceConfig
|
|
2672
|
+
);
|
|
2379
2673
|
const stopwatch = getStopwatch(`${context.options.name} output clean`);
|
|
2380
2674
|
await cleanDirectories(context.outputPath);
|
|
2381
2675
|
stopwatch();
|
|
2382
2676
|
}
|
|
2383
2677
|
return context;
|
|
2384
2678
|
}
|
|
2385
|
-
__name(cleanOutputPath, "cleanOutputPath");
|
|
2386
2679
|
async function build2(options) {
|
|
2387
2680
|
writeDebug(` \u26A1 Executing Storm ESBuild pipeline`);
|
|
2388
2681
|
const stopwatch = getStopwatch("ESBuild pipeline");
|
|
2389
2682
|
try {
|
|
2390
|
-
const opts = Array.isArray(options) ? options : [
|
|
2391
|
-
options
|
|
2392
|
-
];
|
|
2683
|
+
const opts = Array.isArray(options) ? options : [options];
|
|
2393
2684
|
if (opts.length === 0) {
|
|
2394
2685
|
throw new Error("No build options were provided");
|
|
2395
2686
|
}
|
|
@@ -2404,19 +2695,22 @@ async function build2(options) {
|
|
|
2404
2695
|
await reportResults(context);
|
|
2405
2696
|
writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
|
|
2406
2697
|
} catch (error) {
|
|
2407
|
-
writeFatal(
|
|
2698
|
+
writeFatal(
|
|
2699
|
+
"Fatal errors that the build process could not recover from have occured. The build process has been terminated."
|
|
2700
|
+
);
|
|
2408
2701
|
throw error;
|
|
2409
2702
|
} finally {
|
|
2410
2703
|
stopwatch();
|
|
2411
2704
|
}
|
|
2412
2705
|
}
|
|
2413
|
-
__name(build2, "build");
|
|
2414
2706
|
|
|
2415
2707
|
// ../workspace-tools/src/executors/esbuild/executor.ts
|
|
2416
2708
|
async function esbuildExecutorFn(options, context, config) {
|
|
2417
2709
|
writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
|
|
2418
2710
|
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
|
|
2419
|
-
throw new Error(
|
|
2711
|
+
throw new Error(
|
|
2712
|
+
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
2713
|
+
);
|
|
2420
2714
|
}
|
|
2421
2715
|
await build2({
|
|
2422
2716
|
...options,
|
|
@@ -2430,20 +2724,21 @@ async function esbuildExecutorFn(options, context, config) {
|
|
|
2430
2724
|
success: true
|
|
2431
2725
|
};
|
|
2432
2726
|
}
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2727
|
+
var executor_default6 = withRunExecutor(
|
|
2728
|
+
"Storm ESBuild build",
|
|
2729
|
+
esbuildExecutorFn,
|
|
2730
|
+
{
|
|
2731
|
+
skipReadingConfig: false,
|
|
2732
|
+
hooks: {
|
|
2733
|
+
applyDefaultOptions: async (options, config) => {
|
|
2734
|
+
options.entry ??= ["src/index.ts"];
|
|
2735
|
+
options.outputPath ??= "dist/{projectRoot}";
|
|
2736
|
+
options.tsconfig ??= "{projectRoot}/tsconfig.json";
|
|
2737
|
+
return options;
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2445
2740
|
}
|
|
2446
|
-
|
|
2741
|
+
);
|
|
2447
2742
|
|
|
2448
2743
|
// ../workspace-tools/src/executors/npm-publish/executor.ts
|
|
2449
2744
|
init_esm_shims();
|
|
@@ -2469,31 +2764,38 @@ import filePlugin from "@size-limit/file";
|
|
|
2469
2764
|
import sizeLimit from "size-limit";
|
|
2470
2765
|
async function sizeLimitExecutorFn(options, context, config) {
|
|
2471
2766
|
if (!context?.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName]) {
|
|
2472
|
-
throw new Error(
|
|
2767
|
+
throw new Error(
|
|
2768
|
+
"The Size-Limit process failed because the context is not valid. Please run this command from a workspace."
|
|
2769
|
+
);
|
|
2473
2770
|
}
|
|
2474
2771
|
writeInfo(`\u{1F4CF} Running Size-Limit on ${context.projectName}`, config);
|
|
2475
|
-
sizeLimit([
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments3(context.projectsConfigurations.projects[context.projectName]?.root ?? "./", "src")
|
|
2772
|
+
sizeLimit([filePlugin, esBuildPlugin, esBuildWhyPlugin], {
|
|
2773
|
+
checks: options.entry ?? context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? joinPathFragments3(
|
|
2774
|
+
context.projectsConfigurations.projects[context.projectName]?.root ?? "./",
|
|
2775
|
+
"src"
|
|
2776
|
+
)
|
|
2481
2777
|
}).then((result) => {
|
|
2482
|
-
writeInfo(
|
|
2778
|
+
writeInfo(
|
|
2779
|
+
`\u{1F4CF} ${context.projectName} Size-Limit result: ${JSON.stringify(result)}`,
|
|
2780
|
+
config
|
|
2781
|
+
);
|
|
2483
2782
|
});
|
|
2484
2783
|
return {
|
|
2485
2784
|
success: true
|
|
2486
2785
|
};
|
|
2487
2786
|
}
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2787
|
+
var executor_default7 = withRunExecutor(
|
|
2788
|
+
"Size-Limit Performance Test Executor",
|
|
2789
|
+
sizeLimitExecutorFn,
|
|
2790
|
+
{
|
|
2791
|
+
skipReadingConfig: false,
|
|
2792
|
+
hooks: {
|
|
2793
|
+
applyDefaultOptions: (options) => {
|
|
2794
|
+
return options;
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2495
2797
|
}
|
|
2496
|
-
|
|
2798
|
+
);
|
|
2497
2799
|
|
|
2498
2800
|
// ../workspace-tools/src/executors/typia/executor.ts
|
|
2499
2801
|
init_esm_shims();
|
|
@@ -2504,33 +2806,36 @@ async function typiaExecutorFn(options, _, config) {
|
|
|
2504
2806
|
writeInfo(`\u{1F9F9} Cleaning output path: ${options.outputPath}`, config);
|
|
2505
2807
|
removeSync(options.outputPath);
|
|
2506
2808
|
}
|
|
2507
|
-
await Promise.all(
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2809
|
+
await Promise.all(
|
|
2810
|
+
options.entry.map((entry) => {
|
|
2811
|
+
writeInfo(`\u{1F680} Running Typia on entry: ${entry}`, config);
|
|
2812
|
+
return TypiaProgrammer.build({
|
|
2813
|
+
input: entry,
|
|
2814
|
+
output: options.outputPath,
|
|
2815
|
+
project: options.tsconfig
|
|
2816
|
+
});
|
|
2817
|
+
})
|
|
2818
|
+
);
|
|
2515
2819
|
return {
|
|
2516
2820
|
success: true
|
|
2517
2821
|
};
|
|
2518
2822
|
}
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2823
|
+
var executor_default8 = withRunExecutor(
|
|
2824
|
+
"Typia runtime validation generator",
|
|
2825
|
+
typiaExecutorFn,
|
|
2826
|
+
{
|
|
2827
|
+
skipReadingConfig: false,
|
|
2828
|
+
hooks: {
|
|
2829
|
+
applyDefaultOptions: (options) => {
|
|
2830
|
+
options.entry ??= ["{sourceRoot}/index.ts"];
|
|
2831
|
+
options.outputPath ??= "{sourceRoot}/__generated__/typia";
|
|
2832
|
+
options.tsconfig ??= "{projectRoot}/tsconfig.json";
|
|
2833
|
+
options.clean ??= true;
|
|
2834
|
+
return options;
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2532
2837
|
}
|
|
2533
|
-
|
|
2838
|
+
);
|
|
2534
2839
|
|
|
2535
2840
|
// ../workspace-tools/src/executors/unbuild/executor.ts
|
|
2536
2841
|
init_esm_shims();
|
|
@@ -2539,79 +2844,106 @@ import { createJiti } from "jiti";
|
|
|
2539
2844
|
async function unbuildExecutorFn(options, context, config) {
|
|
2540
2845
|
writeInfo("\u{1F4E6} Running Storm Unbuild executor on the workspace", config);
|
|
2541
2846
|
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
2542
|
-
throw new Error(
|
|
2847
|
+
throw new Error(
|
|
2848
|
+
"The Build process failed because the context is not valid. Please run this command from a workspace root directory."
|
|
2849
|
+
);
|
|
2543
2850
|
}
|
|
2544
2851
|
if (!context.projectsConfigurations.projects[context.projectName].root) {
|
|
2545
|
-
throw new Error(
|
|
2852
|
+
throw new Error(
|
|
2853
|
+
"The Build process failed because the project root is not valid. Please run this command from a workspace root directory."
|
|
2854
|
+
);
|
|
2546
2855
|
}
|
|
2547
2856
|
if (!context.projectsConfigurations.projects[context.projectName].sourceRoot) {
|
|
2548
|
-
throw new Error(
|
|
2857
|
+
throw new Error(
|
|
2858
|
+
"The Build process failed because the project's source root is not valid. Please run this command from a workspace root directory."
|
|
2859
|
+
);
|
|
2549
2860
|
}
|
|
2550
2861
|
const jiti = createJiti(config.workspaceRoot, {
|
|
2551
|
-
fsCache: config.skipCache ? false : joinPaths(
|
|
2862
|
+
fsCache: config.skipCache ? false : joinPaths(
|
|
2863
|
+
config.workspaceRoot,
|
|
2864
|
+
config.directories.cache || "node_modules/.cache/storm",
|
|
2865
|
+
"jiti"
|
|
2866
|
+
),
|
|
2552
2867
|
interopDefault: true
|
|
2553
2868
|
});
|
|
2554
|
-
const stormUnbuild = await jiti.import(
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
}
|
|
2566
|
-
},
|
|
2567
|
-
rollup: {
|
|
2568
|
-
emitCJS: true,
|
|
2569
|
-
watch: false,
|
|
2570
|
-
dts: {
|
|
2571
|
-
respectExternal: true
|
|
2869
|
+
const stormUnbuild = await jiti.import(
|
|
2870
|
+
jiti.esmResolve("@storm-software/unbuild/build")
|
|
2871
|
+
);
|
|
2872
|
+
await stormUnbuild.build(
|
|
2873
|
+
defu5(
|
|
2874
|
+
{
|
|
2875
|
+
...options,
|
|
2876
|
+
projectRoot: context.projectsConfigurations.projects[context.projectName].root,
|
|
2877
|
+
projectName: context.projectName,
|
|
2878
|
+
sourceRoot: context.projectsConfigurations.projects[context.projectName].sourceRoot,
|
|
2879
|
+
platform: options.platform
|
|
2572
2880
|
},
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2881
|
+
{
|
|
2882
|
+
stubOptions: {
|
|
2883
|
+
jiti: {
|
|
2884
|
+
fsCache: config.skipCache ? false : joinPaths(
|
|
2885
|
+
config.workspaceRoot,
|
|
2886
|
+
config.directories.cache || "node_modules/.cache/storm",
|
|
2887
|
+
"jiti"
|
|
2888
|
+
)
|
|
2889
|
+
}
|
|
2890
|
+
},
|
|
2891
|
+
rollup: {
|
|
2892
|
+
emitCJS: true,
|
|
2893
|
+
watch: false,
|
|
2894
|
+
dts: {
|
|
2895
|
+
respectExternal: true
|
|
2896
|
+
},
|
|
2897
|
+
esbuild: {
|
|
2898
|
+
target: options.target,
|
|
2899
|
+
format: "esm",
|
|
2900
|
+
platform: options.platform,
|
|
2901
|
+
minify: options.minify ?? !options.debug,
|
|
2902
|
+
sourcemap: options.sourcemap ?? options.debug,
|
|
2903
|
+
treeShaking: options.treeShaking
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2580
2906
|
}
|
|
2581
|
-
|
|
2582
|
-
|
|
2907
|
+
)
|
|
2908
|
+
);
|
|
2583
2909
|
return {
|
|
2584
2910
|
success: true
|
|
2585
2911
|
};
|
|
2586
2912
|
}
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
options
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
"
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2913
|
+
var executor_default9 = withRunExecutor(
|
|
2914
|
+
"TypeScript Unbuild build",
|
|
2915
|
+
unbuildExecutorFn,
|
|
2916
|
+
{
|
|
2917
|
+
skipReadingConfig: false,
|
|
2918
|
+
hooks: {
|
|
2919
|
+
applyDefaultOptions: async (options, config) => {
|
|
2920
|
+
options.debug ??= false;
|
|
2921
|
+
options.treeShaking ??= true;
|
|
2922
|
+
options.buildOnly ??= false;
|
|
2923
|
+
options.platform ??= "neutral";
|
|
2924
|
+
options.entry ??= ["{sourceRoot}"];
|
|
2925
|
+
options.tsconfig ??= "{projectRoot}/tsconfig.json";
|
|
2926
|
+
return options;
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2602
2929
|
}
|
|
2603
|
-
|
|
2930
|
+
);
|
|
2604
2931
|
|
|
2605
2932
|
// ../workspace-tools/generators.ts
|
|
2606
2933
|
init_esm_shims();
|
|
2607
2934
|
|
|
2608
2935
|
// ../workspace-tools/src/generators/browser-library/generator.ts
|
|
2609
2936
|
init_esm_shims();
|
|
2610
|
-
import {
|
|
2937
|
+
import {
|
|
2938
|
+
formatFiles as formatFiles2,
|
|
2939
|
+
generateFiles,
|
|
2940
|
+
names as names2,
|
|
2941
|
+
offsetFromRoot as offsetFromRoot2
|
|
2942
|
+
} from "@nx/devkit";
|
|
2611
2943
|
|
|
2612
2944
|
// ../workspace-tools/src/base/base-generator.ts
|
|
2613
2945
|
init_esm_shims();
|
|
2614
|
-
var withRunGenerator =
|
|
2946
|
+
var withRunGenerator = (name, generatorFn, generatorOptions = {
|
|
2615
2947
|
skipReadingConfig: false
|
|
2616
2948
|
}) => async (tree, _options) => {
|
|
2617
2949
|
const stopwatch = getStopwatch(name);
|
|
@@ -2623,27 +2955,40 @@ var withRunGenerator = /* @__PURE__ */ __name((name, generatorFn, generatorOptio
|
|
|
2623
2955
|
`, config);
|
|
2624
2956
|
const workspaceRoot3 = findWorkspaceRoot();
|
|
2625
2957
|
if (!generatorOptions.skipReadingConfig) {
|
|
2626
|
-
writeDebug(
|
|
2627
|
-
|
|
2958
|
+
writeDebug(
|
|
2959
|
+
`Loading the Storm Config from environment variables and storm.config.js file...
|
|
2960
|
+
- workspaceRoot: ${workspaceRoot3}`,
|
|
2961
|
+
config
|
|
2962
|
+
);
|
|
2628
2963
|
config = await getConfig(workspaceRoot3);
|
|
2629
2964
|
}
|
|
2630
2965
|
if (generatorOptions?.hooks?.applyDefaultOptions) {
|
|
2631
2966
|
writeDebug("Running the applyDefaultOptions hook...", config);
|
|
2632
|
-
options = await Promise.resolve(
|
|
2967
|
+
options = await Promise.resolve(
|
|
2968
|
+
generatorOptions.hooks.applyDefaultOptions(options, config)
|
|
2969
|
+
);
|
|
2633
2970
|
writeDebug("Completed the applyDefaultOptions hook", config);
|
|
2634
2971
|
}
|
|
2635
|
-
writeTrace(
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
workspaceRoot: tree.root,
|
|
2972
|
+
writeTrace(
|
|
2973
|
+
`Generator schema options \u2699\uFE0F
|
|
2974
|
+
${Object.keys(options ?? {}).map((key) => ` - ${key}=${JSON.stringify(options[key])}`).join("\n")}`,
|
|
2639
2975
|
config
|
|
2640
|
-
|
|
2976
|
+
);
|
|
2977
|
+
const tokenized = await applyWorkspaceTokens(
|
|
2978
|
+
options,
|
|
2979
|
+
{ workspaceRoot: tree.root, config },
|
|
2980
|
+
applyWorkspaceBaseTokens
|
|
2981
|
+
);
|
|
2641
2982
|
if (generatorOptions?.hooks?.preProcess) {
|
|
2642
2983
|
writeDebug("Running the preProcess hook...", config);
|
|
2643
|
-
await Promise.resolve(
|
|
2984
|
+
await Promise.resolve(
|
|
2985
|
+
generatorOptions.hooks.preProcess(tokenized, config)
|
|
2986
|
+
);
|
|
2644
2987
|
writeDebug("Completed the preProcess hook", config);
|
|
2645
2988
|
}
|
|
2646
|
-
const result = await Promise.resolve(
|
|
2989
|
+
const result = await Promise.resolve(
|
|
2990
|
+
generatorFn(tree, tokenized, config)
|
|
2991
|
+
);
|
|
2647
2992
|
if (result) {
|
|
2648
2993
|
if (result.success === false || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string") {
|
|
2649
2994
|
throw new Error(`The ${name} generator failed to run`, {
|
|
@@ -2664,21 +3009,41 @@ ${Object.keys(options ?? {}).map((key) => ` - ${key}=${JSON.stringify(options[ke
|
|
|
2664
3009
|
};
|
|
2665
3010
|
} catch (error) {
|
|
2666
3011
|
return () => {
|
|
2667
|
-
writeFatal(
|
|
2668
|
-
|
|
3012
|
+
writeFatal(
|
|
3013
|
+
"A fatal error occurred while running the generator - the process was forced to terminate",
|
|
3014
|
+
config
|
|
3015
|
+
);
|
|
3016
|
+
writeError(
|
|
3017
|
+
`An exception was thrown in the generator's process
|
|
2669
3018
|
- Details: ${error.message}
|
|
2670
|
-
- Stacktrace: ${error.stack}`,
|
|
3019
|
+
- Stacktrace: ${error.stack}`,
|
|
3020
|
+
config
|
|
3021
|
+
);
|
|
2671
3022
|
};
|
|
2672
3023
|
} finally {
|
|
2673
3024
|
stopwatch();
|
|
2674
3025
|
}
|
|
2675
|
-
}
|
|
3026
|
+
};
|
|
2676
3027
|
|
|
2677
3028
|
// ../workspace-tools/src/base/typescript-library-generator.ts
|
|
2678
3029
|
init_esm_shims();
|
|
2679
|
-
import {
|
|
3030
|
+
import {
|
|
3031
|
+
addDependenciesToPackageJson,
|
|
3032
|
+
addProjectConfiguration,
|
|
3033
|
+
ensurePackage,
|
|
3034
|
+
formatFiles,
|
|
3035
|
+
names,
|
|
3036
|
+
offsetFromRoot,
|
|
3037
|
+
readJson,
|
|
3038
|
+
updateJson,
|
|
3039
|
+
writeJson
|
|
3040
|
+
} from "@nx/devkit";
|
|
2680
3041
|
import { determineProjectNameAndRootOptions } from "@nx/devkit/src/generators/project-name-and-root-utils";
|
|
2681
|
-
import {
|
|
3042
|
+
import {
|
|
3043
|
+
addTsConfigPath,
|
|
3044
|
+
getRelativePathToRootTsConfig,
|
|
3045
|
+
tsConfigBaseOptions
|
|
3046
|
+
} from "@nx/js";
|
|
2682
3047
|
import jsInitGenerator from "@nx/js/src/generators/init/init";
|
|
2683
3048
|
import setupVerdaccio from "@nx/js/src/generators/setup-verdaccio/generator";
|
|
2684
3049
|
|
|
@@ -2721,23 +3086,27 @@ var ProjectTagConstants = {
|
|
|
2721
3086
|
TAG_ID: "plugin"
|
|
2722
3087
|
}
|
|
2723
3088
|
};
|
|
2724
|
-
var formatProjectTag =
|
|
3089
|
+
var formatProjectTag = (variant, value) => {
|
|
2725
3090
|
return `${variant}:${value}`;
|
|
2726
|
-
}
|
|
2727
|
-
var hasProjectTag =
|
|
3091
|
+
};
|
|
3092
|
+
var hasProjectTag = (project, variant) => {
|
|
2728
3093
|
project.tags = project.tags ?? [];
|
|
2729
3094
|
const prefix = formatProjectTag(variant, "");
|
|
2730
|
-
return project.tags.some(
|
|
2731
|
-
|
|
2732
|
-
|
|
3095
|
+
return project.tags.some(
|
|
3096
|
+
(tag) => tag.startsWith(prefix) && tag.length > prefix.length
|
|
3097
|
+
);
|
|
3098
|
+
};
|
|
3099
|
+
var addProjectTag = (project, variant, value, options = {
|
|
2733
3100
|
overwrite: false
|
|
2734
3101
|
}) => {
|
|
2735
3102
|
project.tags = project.tags ?? [];
|
|
2736
3103
|
if (options.overwrite || !hasProjectTag(project, variant)) {
|
|
2737
|
-
project.tags = project.tags.filter(
|
|
3104
|
+
project.tags = project.tags.filter(
|
|
3105
|
+
(tag) => !tag.startsWith(formatProjectTag(variant, ""))
|
|
3106
|
+
);
|
|
2738
3107
|
project.tags.push(formatProjectTag(variant, value));
|
|
2739
3108
|
}
|
|
2740
|
-
}
|
|
3109
|
+
};
|
|
2741
3110
|
|
|
2742
3111
|
// ../workspace-tools/src/utils/versions.ts
|
|
2743
3112
|
init_esm_shims();
|
|
@@ -2748,24 +3117,27 @@ var pnpmVersion = "8.10.2";
|
|
|
2748
3117
|
|
|
2749
3118
|
// ../workspace-tools/src/base/typescript-library-generator.ts
|
|
2750
3119
|
async function typeScriptLibraryGeneratorFn(tree, options, config) {
|
|
2751
|
-
const normalized = await normalizeOptions(tree, {
|
|
2752
|
-
...options
|
|
2753
|
-
});
|
|
3120
|
+
const normalized = await normalizeOptions(tree, { ...options });
|
|
2754
3121
|
const tasks = [];
|
|
2755
|
-
tasks.push(
|
|
2756
|
-
|
|
2757
|
-
tsConfigName: normalized.rootProject ? "tsconfig.json" : "tsconfig.base.json"
|
|
2758
|
-
}));
|
|
2759
|
-
tasks.push(addDependenciesToPackageJson(tree, {}, {
|
|
2760
|
-
"@storm-software/workspace-tools": "latest",
|
|
2761
|
-
"@storm-software/testing-tools": "latest",
|
|
2762
|
-
...options.devDependencies ?? {}
|
|
2763
|
-
}));
|
|
2764
|
-
if (normalized.publishable) {
|
|
2765
|
-
tasks.push(await setupVerdaccio(tree, {
|
|
3122
|
+
tasks.push(
|
|
3123
|
+
await jsInitGenerator(tree, {
|
|
2766
3124
|
...normalized,
|
|
2767
|
-
|
|
2768
|
-
})
|
|
3125
|
+
tsConfigName: normalized.rootProject ? "tsconfig.json" : "tsconfig.base.json"
|
|
3126
|
+
})
|
|
3127
|
+
);
|
|
3128
|
+
tasks.push(
|
|
3129
|
+
addDependenciesToPackageJson(
|
|
3130
|
+
tree,
|
|
3131
|
+
{},
|
|
3132
|
+
{
|
|
3133
|
+
"@storm-software/workspace-tools": "latest",
|
|
3134
|
+
"@storm-software/testing-tools": "latest",
|
|
3135
|
+
...options.devDependencies ?? {}
|
|
3136
|
+
}
|
|
3137
|
+
)
|
|
3138
|
+
);
|
|
3139
|
+
if (normalized.publishable) {
|
|
3140
|
+
tasks.push(await setupVerdaccio(tree, { ...normalized, skipFormat: true }));
|
|
2769
3141
|
}
|
|
2770
3142
|
const projectConfig = {
|
|
2771
3143
|
root: normalized.directory,
|
|
@@ -2774,13 +3146,9 @@ async function typeScriptLibraryGeneratorFn(tree, options, config) {
|
|
|
2774
3146
|
targets: {
|
|
2775
3147
|
build: {
|
|
2776
3148
|
executor: options.buildExecutor,
|
|
2777
|
-
outputs: [
|
|
2778
|
-
"{options.outputPath}"
|
|
2779
|
-
],
|
|
3149
|
+
outputs: ["{options.outputPath}"],
|
|
2780
3150
|
options: {
|
|
2781
|
-
entry: [
|
|
2782
|
-
joinPaths(normalized.projectRoot, "src", "index.ts")
|
|
2783
|
-
],
|
|
3151
|
+
entry: [joinPaths(normalized.projectRoot, "src", "index.ts")],
|
|
2784
3152
|
outputPath: getOutputPath(normalized),
|
|
2785
3153
|
tsconfig: joinPaths(normalized.projectRoot, "tsconfig.json"),
|
|
2786
3154
|
project: joinPaths(normalized.projectRoot, "package.json"),
|
|
@@ -2815,9 +3183,12 @@ async function typeScriptLibraryGeneratorFn(tree, options, config) {
|
|
|
2815
3183
|
if (options.platform) {
|
|
2816
3184
|
projectConfig.targets.build.options.platform = options.platform === "worker" ? "node" : options.platform;
|
|
2817
3185
|
}
|
|
2818
|
-
addProjectTag(
|
|
2819
|
-
|
|
2820
|
-
|
|
3186
|
+
addProjectTag(
|
|
3187
|
+
projectConfig,
|
|
3188
|
+
ProjectTagConstants.Platform.TAG_ID,
|
|
3189
|
+
options.platform === "node" ? ProjectTagConstants.Platform.NODE : options.platform === "worker" ? ProjectTagConstants.Platform.WORKER : options.platform === "browser" ? ProjectTagConstants.Platform.BROWSER : ProjectTagConstants.Platform.NEUTRAL,
|
|
3190
|
+
{ overwrite: false }
|
|
3191
|
+
);
|
|
2821
3192
|
createProjectTsConfigJson(tree, normalized);
|
|
2822
3193
|
addProjectConfiguration(tree, normalized.name, projectConfig);
|
|
2823
3194
|
let repository = {
|
|
@@ -2894,7 +3265,11 @@ async function typeScriptLibraryGeneratorFn(tree, options, config) {
|
|
|
2894
3265
|
}));
|
|
2895
3266
|
}
|
|
2896
3267
|
addTsConfigPath(tree, normalized.importPath, [
|
|
2897
|
-
joinPaths(
|
|
3268
|
+
joinPaths(
|
|
3269
|
+
normalized.projectRoot,
|
|
3270
|
+
"./src",
|
|
3271
|
+
`index.${normalized.js ? "js" : "ts"}`
|
|
3272
|
+
)
|
|
2898
3273
|
]);
|
|
2899
3274
|
addTsConfigPath(tree, joinPaths(normalized.importPath, "/*"), [
|
|
2900
3275
|
joinPaths(normalized.projectRoot, "./src", "/*")
|
|
@@ -2922,25 +3297,15 @@ async function typeScriptLibraryGeneratorFn(tree, options, config) {
|
|
|
2922
3297
|
outDir: `${offsetFromRoot(normalized.projectRoot)}dist/out-tsc`
|
|
2923
3298
|
},
|
|
2924
3299
|
files: [],
|
|
2925
|
-
include: [
|
|
2926
|
-
|
|
2927
|
-
"src/**/*.js"
|
|
2928
|
-
],
|
|
2929
|
-
exclude: [
|
|
2930
|
-
"jest.config.ts",
|
|
2931
|
-
"src/**/*.spec.ts",
|
|
2932
|
-
"src/**/*.test.ts"
|
|
2933
|
-
]
|
|
3300
|
+
include: ["src/**/*.ts", "src/**/*.js"],
|
|
3301
|
+
exclude: ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
|
|
2934
3302
|
});
|
|
2935
3303
|
}
|
|
2936
3304
|
await formatFiles(tree);
|
|
2937
3305
|
return null;
|
|
2938
3306
|
}
|
|
2939
|
-
__name(typeScriptLibraryGeneratorFn, "typeScriptLibraryGeneratorFn");
|
|
2940
3307
|
function getOutputPath(options) {
|
|
2941
|
-
const parts = [
|
|
2942
|
-
"dist"
|
|
2943
|
-
];
|
|
3308
|
+
const parts = ["dist"];
|
|
2944
3309
|
if (options.projectRoot === ".") {
|
|
2945
3310
|
parts.push(options.name);
|
|
2946
3311
|
} else {
|
|
@@ -2948,7 +3313,6 @@ function getOutputPath(options) {
|
|
|
2948
3313
|
}
|
|
2949
3314
|
return joinPaths(...parts);
|
|
2950
3315
|
}
|
|
2951
|
-
__name(getOutputPath, "getOutputPath");
|
|
2952
3316
|
function createProjectTsConfigJson(tree, options) {
|
|
2953
3317
|
const tsconfig = {
|
|
2954
3318
|
extends: options.rootProject ? void 0 : getRelativePathToRootTsConfig(tree, options.projectRoot),
|
|
@@ -2959,9 +3323,7 @@ function createProjectTsConfigJson(tree, options) {
|
|
|
2959
3323
|
noEmit: true,
|
|
2960
3324
|
...options?.tsconfigOptions?.compilerOptions ?? {}
|
|
2961
3325
|
},
|
|
2962
|
-
files: [
|
|
2963
|
-
...options?.tsconfigOptions?.files ?? []
|
|
2964
|
-
],
|
|
3326
|
+
files: [...options?.tsconfigOptions?.files ?? []],
|
|
2965
3327
|
include: [
|
|
2966
3328
|
...options?.tsconfigOptions?.include ?? [],
|
|
2967
3329
|
"src/**/*.ts",
|
|
@@ -2977,7 +3339,6 @@ function createProjectTsConfigJson(tree, options) {
|
|
|
2977
3339
|
};
|
|
2978
3340
|
writeJson(tree, joinPaths(options.projectRoot, "tsconfig.json"), tsconfig);
|
|
2979
3341
|
}
|
|
2980
|
-
__name(createProjectTsConfigJson, "createProjectTsConfigJson");
|
|
2981
3342
|
async function normalizeOptions(tree, options, config) {
|
|
2982
3343
|
let importPath = options.importPath;
|
|
2983
3344
|
if (!importPath && config?.namespace) {
|
|
@@ -2985,7 +3346,9 @@ async function normalizeOptions(tree, options, config) {
|
|
|
2985
3346
|
}
|
|
2986
3347
|
if (options.publishable) {
|
|
2987
3348
|
if (!importPath) {
|
|
2988
|
-
throw new Error(
|
|
3349
|
+
throw new Error(
|
|
3350
|
+
`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`
|
|
3351
|
+
);
|
|
2989
3352
|
}
|
|
2990
3353
|
}
|
|
2991
3354
|
let bundler = "tsc";
|
|
@@ -2994,7 +3357,12 @@ async function normalizeOptions(tree, options, config) {
|
|
|
2994
3357
|
}
|
|
2995
3358
|
const { Linter } = ensurePackage("@nx/eslint", nxVersion);
|
|
2996
3359
|
const rootProject = false;
|
|
2997
|
-
const {
|
|
3360
|
+
const {
|
|
3361
|
+
projectName,
|
|
3362
|
+
names: projectNames,
|
|
3363
|
+
projectRoot,
|
|
3364
|
+
importPath: normalizedImportPath
|
|
3365
|
+
} = await determineProjectNameAndRootOptions(tree, {
|
|
2998
3366
|
name: options.name,
|
|
2999
3367
|
projectType: "library",
|
|
3000
3368
|
directory: options.directory,
|
|
@@ -3031,11 +3399,16 @@ async function normalizeOptions(tree, options, config) {
|
|
|
3031
3399
|
shouldUseSwcJest: false
|
|
3032
3400
|
};
|
|
3033
3401
|
}
|
|
3034
|
-
__name(normalizeOptions, "normalizeOptions");
|
|
3035
3402
|
|
|
3036
3403
|
// ../workspace-tools/src/generators/browser-library/generator.ts
|
|
3037
3404
|
async function browserLibraryGeneratorFn(tree, schema, config) {
|
|
3038
|
-
const filesDir = joinPaths(
|
|
3405
|
+
const filesDir = joinPaths(
|
|
3406
|
+
__dirname,
|
|
3407
|
+
"src",
|
|
3408
|
+
"generators",
|
|
3409
|
+
"browser-library",
|
|
3410
|
+
"files"
|
|
3411
|
+
);
|
|
3039
3412
|
const tsLibraryGeneratorOptions = {
|
|
3040
3413
|
buildExecutor: "@storm-software/workspace-tools:unbuild",
|
|
3041
3414
|
platform: "browser",
|
|
@@ -3061,7 +3434,9 @@ async function browserLibraryGeneratorFn(tree, schema, config) {
|
|
|
3061
3434
|
directory: schema.directory
|
|
3062
3435
|
};
|
|
3063
3436
|
const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
|
|
3064
|
-
const { className, name, propertyName } = names2(
|
|
3437
|
+
const { className, name, propertyName } = names2(
|
|
3438
|
+
options.projectNames.projectFileName
|
|
3439
|
+
);
|
|
3065
3440
|
generateFiles(tree, filesDir, options.projectRoot, {
|
|
3066
3441
|
...schema,
|
|
3067
3442
|
dot: ".",
|
|
@@ -3092,76 +3467,112 @@ async function browserLibraryGeneratorFn(tree, schema, config) {
|
|
|
3092
3467
|
await formatFiles2(tree);
|
|
3093
3468
|
return null;
|
|
3094
3469
|
}
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
options
|
|
3101
|
-
|
|
3102
|
-
|
|
3470
|
+
var generator_default = withRunGenerator(
|
|
3471
|
+
"TypeScript Library Creator (Browser Platform)",
|
|
3472
|
+
browserLibraryGeneratorFn,
|
|
3473
|
+
{
|
|
3474
|
+
hooks: {
|
|
3475
|
+
applyDefaultOptions: (options) => {
|
|
3476
|
+
options.description ??= "A library used by Storm Software to support browser applications";
|
|
3477
|
+
options.platform ??= "browser";
|
|
3478
|
+
return options;
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3103
3481
|
}
|
|
3104
|
-
|
|
3482
|
+
);
|
|
3105
3483
|
|
|
3106
3484
|
// ../workspace-tools/src/generators/config-schema/generator.ts
|
|
3107
3485
|
init_esm_shims();
|
|
3108
3486
|
import { formatFiles as formatFiles3, writeJson as writeJson2 } from "@nx/devkit";
|
|
3109
3487
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3110
3488
|
async function configSchemaGeneratorFn(tree, options, config) {
|
|
3111
|
-
writeInfo(
|
|
3112
|
-
|
|
3489
|
+
writeInfo(
|
|
3490
|
+
"\u{1F4E6} Running Storm Workspace Configuration JSON Schema generator",
|
|
3491
|
+
config
|
|
3492
|
+
);
|
|
3493
|
+
writeTrace(
|
|
3494
|
+
`Determining the Storm Workspace Configuration JSON Schema...`,
|
|
3495
|
+
config
|
|
3496
|
+
);
|
|
3113
3497
|
const jsonSchema = zodToJsonSchema(stormWorkspaceConfigSchema, {
|
|
3114
3498
|
name: "StormWorkspaceConfiguration"
|
|
3115
3499
|
});
|
|
3116
3500
|
writeTrace(jsonSchema, config);
|
|
3117
|
-
const outputPath = options.outputFile.replaceAll("{workspaceRoot}", "").replaceAll(
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3501
|
+
const outputPath = options.outputFile.replaceAll("{workspaceRoot}", "").replaceAll(
|
|
3502
|
+
config?.workspaceRoot ?? findWorkspaceRoot(),
|
|
3503
|
+
options.outputFile?.startsWith("./") ? "" : "./"
|
|
3504
|
+
);
|
|
3505
|
+
writeTrace(
|
|
3506
|
+
`\u{1F4DD} Writing Storm Configuration JSON Schema to "${outputPath}"`,
|
|
3507
|
+
config
|
|
3508
|
+
);
|
|
3509
|
+
writeJson2(tree, outputPath, jsonSchema, { spaces: 2 });
|
|
3122
3510
|
await formatFiles3(tree);
|
|
3123
|
-
writeSuccess(
|
|
3511
|
+
writeSuccess(
|
|
3512
|
+
"\u{1F680} Storm Configuration JSON Schema creation has completed successfully!",
|
|
3513
|
+
config
|
|
3514
|
+
);
|
|
3124
3515
|
return {
|
|
3125
3516
|
success: true
|
|
3126
3517
|
};
|
|
3127
3518
|
}
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3519
|
+
var generator_default2 = withRunGenerator(
|
|
3520
|
+
"Configuration Schema Creator",
|
|
3521
|
+
configSchemaGeneratorFn,
|
|
3522
|
+
{
|
|
3523
|
+
hooks: {
|
|
3524
|
+
applyDefaultOptions: (options) => {
|
|
3525
|
+
options.outputFile ??= "{workspaceRoot}/storm-workspace.schema.json";
|
|
3526
|
+
return options;
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3135
3529
|
}
|
|
3136
|
-
|
|
3530
|
+
);
|
|
3137
3531
|
|
|
3138
3532
|
// ../workspace-tools/src/generators/init/init.ts
|
|
3139
3533
|
init_esm_shims();
|
|
3140
|
-
import {
|
|
3534
|
+
import {
|
|
3535
|
+
addDependenciesToPackageJson as addDependenciesToPackageJson2,
|
|
3536
|
+
formatFiles as formatFiles4
|
|
3537
|
+
} from "@nx/devkit";
|
|
3141
3538
|
async function initGenerator(tree, schema) {
|
|
3142
|
-
const task = addDependenciesToPackageJson2(
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3539
|
+
const task = addDependenciesToPackageJson2(
|
|
3540
|
+
tree,
|
|
3541
|
+
{
|
|
3542
|
+
nx: "^19.6.2",
|
|
3543
|
+
"@nx/workspace": "^19.6.2",
|
|
3544
|
+
"@nx/js": "^19.6.2",
|
|
3545
|
+
"@storm-software/eslint": "latest",
|
|
3546
|
+
"@storm-software/prettier": "latest",
|
|
3547
|
+
"@storm-software/config-tools": "latest",
|
|
3548
|
+
"@storm-software/testing-tools": "latest",
|
|
3549
|
+
"@storm-software/git-tools": "latest",
|
|
3550
|
+
"@storm-software/linting-tools": "latest"
|
|
3551
|
+
},
|
|
3552
|
+
{}
|
|
3553
|
+
);
|
|
3153
3554
|
if (!schema.skipFormat) {
|
|
3154
3555
|
await formatFiles4(tree);
|
|
3155
3556
|
}
|
|
3156
3557
|
return task;
|
|
3157
3558
|
}
|
|
3158
|
-
__name(initGenerator, "initGenerator");
|
|
3159
3559
|
|
|
3160
3560
|
// ../workspace-tools/src/generators/neutral-library/generator.ts
|
|
3161
3561
|
init_esm_shims();
|
|
3162
|
-
import {
|
|
3562
|
+
import {
|
|
3563
|
+
formatFiles as formatFiles5,
|
|
3564
|
+
generateFiles as generateFiles2,
|
|
3565
|
+
names as names3,
|
|
3566
|
+
offsetFromRoot as offsetFromRoot3
|
|
3567
|
+
} from "@nx/devkit";
|
|
3163
3568
|
async function neutralLibraryGeneratorFn(tree, schema, config) {
|
|
3164
|
-
const filesDir = joinPaths(
|
|
3569
|
+
const filesDir = joinPaths(
|
|
3570
|
+
__dirname,
|
|
3571
|
+
"src",
|
|
3572
|
+
"generators",
|
|
3573
|
+
"neutral-library",
|
|
3574
|
+
"files"
|
|
3575
|
+
);
|
|
3165
3576
|
const tsLibraryGeneratorOptions = {
|
|
3166
3577
|
...schema,
|
|
3167
3578
|
platform: "neutral",
|
|
@@ -3169,7 +3580,9 @@ async function neutralLibraryGeneratorFn(tree, schema, config) {
|
|
|
3169
3580
|
buildExecutor: "@storm-software/workspace-tools:unbuild"
|
|
3170
3581
|
};
|
|
3171
3582
|
const options = await normalizeOptions(tree, tsLibraryGeneratorOptions);
|
|
3172
|
-
const { className, name, propertyName } = names3(
|
|
3583
|
+
const { className, name, propertyName } = names3(
|
|
3584
|
+
options.projectNames.projectFileName
|
|
3585
|
+
);
|
|
3173
3586
|
generateFiles2(tree, filesDir, options.projectRoot, {
|
|
3174
3587
|
...schema,
|
|
3175
3588
|
dot: ".",
|
|
@@ -3190,22 +3603,36 @@ async function neutralLibraryGeneratorFn(tree, schema, config) {
|
|
|
3190
3603
|
await formatFiles5(tree);
|
|
3191
3604
|
return null;
|
|
3192
3605
|
}
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
options
|
|
3199
|
-
|
|
3200
|
-
|
|
3606
|
+
var generator_default3 = withRunGenerator(
|
|
3607
|
+
"TypeScript Library Creator (Neutral Platform)",
|
|
3608
|
+
neutralLibraryGeneratorFn,
|
|
3609
|
+
{
|
|
3610
|
+
hooks: {
|
|
3611
|
+
applyDefaultOptions: (options) => {
|
|
3612
|
+
options.description ??= "A library used by Storm Software to support either browser or NodeJs applications";
|
|
3613
|
+
options.platform = "neutral";
|
|
3614
|
+
return options;
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3201
3617
|
}
|
|
3202
|
-
|
|
3618
|
+
);
|
|
3203
3619
|
|
|
3204
3620
|
// ../workspace-tools/src/generators/node-library/generator.ts
|
|
3205
3621
|
init_esm_shims();
|
|
3206
|
-
import {
|
|
3622
|
+
import {
|
|
3623
|
+
formatFiles as formatFiles6,
|
|
3624
|
+
generateFiles as generateFiles3,
|
|
3625
|
+
names as names4,
|
|
3626
|
+
offsetFromRoot as offsetFromRoot4
|
|
3627
|
+
} from "@nx/devkit";
|
|
3207
3628
|
async function nodeLibraryGeneratorFn(tree, schema, config) {
|
|
3208
|
-
const filesDir = joinPaths(
|
|
3629
|
+
const filesDir = joinPaths(
|
|
3630
|
+
__dirname,
|
|
3631
|
+
"src",
|
|
3632
|
+
"generators",
|
|
3633
|
+
"node-library",
|
|
3634
|
+
"files"
|
|
3635
|
+
);
|
|
3209
3636
|
const tsLibraryGeneratorOptions = {
|
|
3210
3637
|
platform: "node",
|
|
3211
3638
|
devDependencies: {
|
|
@@ -3238,20 +3665,30 @@ async function nodeLibraryGeneratorFn(tree, schema, config) {
|
|
|
3238
3665
|
await formatFiles6(tree);
|
|
3239
3666
|
return null;
|
|
3240
3667
|
}
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
options
|
|
3247
|
-
|
|
3248
|
-
|
|
3668
|
+
var generator_default4 = withRunGenerator(
|
|
3669
|
+
"TypeScript Library Creator (NodeJs Platform)",
|
|
3670
|
+
nodeLibraryGeneratorFn,
|
|
3671
|
+
{
|
|
3672
|
+
hooks: {
|
|
3673
|
+
applyDefaultOptions: (options) => {
|
|
3674
|
+
options.description ??= "A library used by Storm Software to support NodeJs applications";
|
|
3675
|
+
options.platform ??= "node";
|
|
3676
|
+
return options;
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3249
3679
|
}
|
|
3250
|
-
|
|
3680
|
+
);
|
|
3251
3681
|
|
|
3252
3682
|
// ../workspace-tools/src/generators/preset/generator.ts
|
|
3253
3683
|
init_esm_shims();
|
|
3254
|
-
import {
|
|
3684
|
+
import {
|
|
3685
|
+
addDependenciesToPackageJson as addDependenciesToPackageJson3,
|
|
3686
|
+
addProjectConfiguration as addProjectConfiguration2,
|
|
3687
|
+
formatFiles as formatFiles7,
|
|
3688
|
+
generateFiles as generateFiles4,
|
|
3689
|
+
joinPathFragments as joinPathFragments4,
|
|
3690
|
+
updateJson as updateJson2
|
|
3691
|
+
} from "@nx/devkit";
|
|
3255
3692
|
import * as path4 from "node:path";
|
|
3256
3693
|
async function presetGeneratorFn(tree, options) {
|
|
3257
3694
|
const projectRoot = ".";
|
|
@@ -3466,15 +3903,31 @@ async function presetGeneratorFn(tree, options) {
|
|
|
3466
3903
|
"nx-cloud": "latest"
|
|
3467
3904
|
};
|
|
3468
3905
|
}
|
|
3469
|
-
await Promise.resolve(
|
|
3906
|
+
await Promise.resolve(
|
|
3907
|
+
addDependenciesToPackageJson3(
|
|
3908
|
+
tree,
|
|
3909
|
+
dependencies,
|
|
3910
|
+
{},
|
|
3911
|
+
joinPathFragments4(projectRoot, "package.json")
|
|
3912
|
+
)
|
|
3913
|
+
);
|
|
3470
3914
|
return null;
|
|
3471
3915
|
}
|
|
3472
|
-
|
|
3473
|
-
|
|
3916
|
+
var generator_default5 = withRunGenerator(
|
|
3917
|
+
"Storm Workspace Preset Generator",
|
|
3918
|
+
presetGeneratorFn
|
|
3919
|
+
);
|
|
3474
3920
|
|
|
3475
3921
|
// ../workspace-tools/src/generators/release-version/generator.ts
|
|
3476
3922
|
init_esm_shims();
|
|
3477
|
-
import {
|
|
3923
|
+
import {
|
|
3924
|
+
formatFiles as formatFiles8,
|
|
3925
|
+
joinPathFragments as joinPathFragments5,
|
|
3926
|
+
output,
|
|
3927
|
+
readJson as readJson2,
|
|
3928
|
+
updateJson as updateJson3,
|
|
3929
|
+
writeJson as writeJson3
|
|
3930
|
+
} from "@nx/devkit";
|
|
3478
3931
|
import { resolveLocalPackageDependencies as resolveLocalPackageJsonDependencies } from "@nx/js/src/generators/release-version/utils/resolve-local-package-dependencies";
|
|
3479
3932
|
import { updateLockFile } from "@nx/js/src/release/utils/update-lock-file";
|
|
3480
3933
|
|
|
@@ -3620,7 +4073,9 @@ var DEFAULT_COMMIT_QUESTIONS = {
|
|
|
3620
4073
|
type: "select",
|
|
3621
4074
|
title: "Commit Type",
|
|
3622
4075
|
description: "Select the commit type that best describes your changes",
|
|
3623
|
-
enum: Object.keys(DEFAULT_COMMIT_TYPES).filter(
|
|
4076
|
+
enum: Object.keys(DEFAULT_COMMIT_TYPES).filter(
|
|
4077
|
+
(type) => DEFAULT_COMMIT_TYPES[type].hidden !== true
|
|
4078
|
+
).reduce((ret, type) => {
|
|
3624
4079
|
ret[type] = DEFAULT_COMMIT_TYPES[type];
|
|
3625
4080
|
return ret;
|
|
3626
4081
|
}, {}),
|
|
@@ -3660,7 +4115,7 @@ var DEFAULT_COMMIT_QUESTIONS = {
|
|
|
3660
4115
|
type: "input",
|
|
3661
4116
|
title: "Breaking Changes (Details)",
|
|
3662
4117
|
description: "A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself",
|
|
3663
|
-
when:
|
|
4118
|
+
when: (answers) => answers.isBreaking === true,
|
|
3664
4119
|
maxLength: 600,
|
|
3665
4120
|
minLength: 3
|
|
3666
4121
|
},
|
|
@@ -3674,17 +4129,11 @@ var DEFAULT_COMMIT_QUESTIONS = {
|
|
|
3674
4129
|
type: "input",
|
|
3675
4130
|
title: "Open Issue Affected (Details)",
|
|
3676
4131
|
description: "If issues are closed, the commit requires a body. Please enter a longer description of the commit itself",
|
|
3677
|
-
when:
|
|
4132
|
+
when: (answers) => answers.isIssueAffected === true,
|
|
3678
4133
|
maxLength: 600,
|
|
3679
4134
|
minLength: 3
|
|
3680
4135
|
}
|
|
3681
4136
|
};
|
|
3682
|
-
var RuleConfigSeverity;
|
|
3683
|
-
(function(RuleConfigSeverity2) {
|
|
3684
|
-
RuleConfigSeverity2[RuleConfigSeverity2["Disabled"] = 0] = "Disabled";
|
|
3685
|
-
RuleConfigSeverity2[RuleConfigSeverity2["Warning"] = 1] = "Warning";
|
|
3686
|
-
RuleConfigSeverity2[RuleConfigSeverity2["Error"] = 2] = "Error";
|
|
3687
|
-
})(RuleConfigSeverity || (RuleConfigSeverity = {}));
|
|
3688
4137
|
|
|
3689
4138
|
// ../git-tools/src/release/config.ts
|
|
3690
4139
|
init_esm_shims();
|
|
@@ -3693,10 +4142,19 @@ init_esm_shims();
|
|
|
3693
4142
|
import { exec, execSync as execSync4 } from "node:child_process";
|
|
3694
4143
|
import { relative as relative3 } from "node:path";
|
|
3695
4144
|
import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
|
|
3696
|
-
import {
|
|
3697
|
-
|
|
4145
|
+
import {
|
|
4146
|
+
getFirstGitCommit,
|
|
4147
|
+
getLatestGitTagForPattern
|
|
4148
|
+
} from "nx/src/command-line/release/utils/git";
|
|
4149
|
+
import {
|
|
4150
|
+
resolveSemverSpecifierFromConventionalCommits,
|
|
4151
|
+
resolveSemverSpecifierFromPrompt
|
|
4152
|
+
} from "nx/src/command-line/release/utils/resolve-semver-specifier";
|
|
3698
4153
|
import { isValidSemverSpecifier } from "nx/src/command-line/release/utils/semver";
|
|
3699
|
-
import {
|
|
4154
|
+
import {
|
|
4155
|
+
deriveNewSemverVersion,
|
|
4156
|
+
validReleaseVersionPrefixes
|
|
4157
|
+
} from "nx/src/command-line/release/version-legacy";
|
|
3700
4158
|
import { interpolate } from "nx/src/tasks-runner/utils";
|
|
3701
4159
|
import { prerelease } from "semver";
|
|
3702
4160
|
|
|
@@ -3764,11 +4222,7 @@ var cargo_base_executor_untyped_default = defineUntypedSchema3({
|
|
|
3764
4222
|
$schema: {
|
|
3765
4223
|
title: "Toolchain",
|
|
3766
4224
|
description: "The type of toolchain to use for the build",
|
|
3767
|
-
enum: [
|
|
3768
|
-
"stable",
|
|
3769
|
-
"beta",
|
|
3770
|
-
"nightly"
|
|
3771
|
-
],
|
|
4225
|
+
enum: ["stable", "beta", "nightly"],
|
|
3772
4226
|
default: "stable"
|
|
3773
4227
|
},
|
|
3774
4228
|
$default: "stable"
|
|
@@ -3806,17 +4260,7 @@ var cargo_base_executor_untyped_default = defineUntypedSchema3({
|
|
|
3806
4260
|
title: "Features",
|
|
3807
4261
|
type: "string",
|
|
3808
4262
|
description: "The features to build",
|
|
3809
|
-
oneOf: [
|
|
3810
|
-
{
|
|
3811
|
-
type: "string"
|
|
3812
|
-
},
|
|
3813
|
-
{
|
|
3814
|
-
type: "array",
|
|
3815
|
-
items: {
|
|
3816
|
-
type: "string"
|
|
3817
|
-
}
|
|
3818
|
-
}
|
|
3819
|
-
]
|
|
4263
|
+
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
|
|
3820
4264
|
}
|
|
3821
4265
|
},
|
|
3822
4266
|
allFeatures: {
|
|
@@ -3837,10 +4281,7 @@ var typescript_build_executor_untyped_default = defineUntypedSchema4({
|
|
|
3837
4281
|
id: "TypeScriptBuildExecutorSchema",
|
|
3838
4282
|
title: "TypeScript Build Executor",
|
|
3839
4283
|
description: "A type definition for the base TypeScript build executor schema",
|
|
3840
|
-
required: [
|
|
3841
|
-
"entry",
|
|
3842
|
-
"tsconfig"
|
|
3843
|
-
]
|
|
4284
|
+
required: ["entry", "tsconfig"]
|
|
3844
4285
|
},
|
|
3845
4286
|
entry: {
|
|
3846
4287
|
$schema: {
|
|
@@ -3848,13 +4289,9 @@ var typescript_build_executor_untyped_default = defineUntypedSchema4({
|
|
|
3848
4289
|
format: "path",
|
|
3849
4290
|
type: "array",
|
|
3850
4291
|
description: "The entry file or files to build",
|
|
3851
|
-
items: {
|
|
3852
|
-
type: "string"
|
|
3853
|
-
}
|
|
4292
|
+
items: { type: "string" }
|
|
3854
4293
|
},
|
|
3855
|
-
$default: [
|
|
3856
|
-
"{sourceRoot}/index.ts"
|
|
3857
|
-
]
|
|
4294
|
+
$default: ["{sourceRoot}/index.ts"]
|
|
3858
4295
|
},
|
|
3859
4296
|
tsconfig: {
|
|
3860
4297
|
$schema: {
|
|
@@ -3934,7 +4371,7 @@ var typescript_build_executor_untyped_default = defineUntypedSchema4({
|
|
|
3934
4371
|
]
|
|
3935
4372
|
},
|
|
3936
4373
|
$default: "esnext",
|
|
3937
|
-
$resolve:
|
|
4374
|
+
$resolve: (val = "esnext") => val.toLowerCase()
|
|
3938
4375
|
},
|
|
3939
4376
|
format: {
|
|
3940
4377
|
$schema: {
|
|
@@ -3943,28 +4380,17 @@ var typescript_build_executor_untyped_default = defineUntypedSchema4({
|
|
|
3943
4380
|
description: "The format to build",
|
|
3944
4381
|
items: {
|
|
3945
4382
|
type: "string",
|
|
3946
|
-
enum: [
|
|
3947
|
-
"cjs",
|
|
3948
|
-
"esm",
|
|
3949
|
-
"iife"
|
|
3950
|
-
]
|
|
4383
|
+
enum: ["cjs", "esm", "iife"]
|
|
3951
4384
|
}
|
|
3952
4385
|
},
|
|
3953
|
-
$resolve:
|
|
3954
|
-
"cjs",
|
|
3955
|
-
"esm"
|
|
3956
|
-
]) => [].concat(val), "$resolve")
|
|
4386
|
+
$resolve: (val = ["cjs", "esm"]) => [].concat(val)
|
|
3957
4387
|
},
|
|
3958
4388
|
platform: {
|
|
3959
4389
|
$schema: {
|
|
3960
4390
|
title: "Platform",
|
|
3961
4391
|
type: "string",
|
|
3962
4392
|
description: "The platform to build",
|
|
3963
|
-
enum: [
|
|
3964
|
-
"neutral",
|
|
3965
|
-
"node",
|
|
3966
|
-
"browser"
|
|
3967
|
-
]
|
|
4393
|
+
enum: ["neutral", "node", "browser"]
|
|
3968
4394
|
},
|
|
3969
4395
|
$default: "neutral"
|
|
3970
4396
|
},
|
|
@@ -3974,7 +4400,7 @@ var typescript_build_executor_untyped_default = defineUntypedSchema4({
|
|
|
3974
4400
|
type: "array",
|
|
3975
4401
|
description: "The external dependencies"
|
|
3976
4402
|
},
|
|
3977
|
-
$resolve:
|
|
4403
|
+
$resolve: (val = []) => [].concat(val)
|
|
3978
4404
|
},
|
|
3979
4405
|
define: {
|
|
3980
4406
|
$schema: {
|
|
@@ -3983,7 +4409,7 @@ var typescript_build_executor_untyped_default = defineUntypedSchema4({
|
|
|
3983
4409
|
tsType: "Record<string, string>",
|
|
3984
4410
|
description: "The define values"
|
|
3985
4411
|
},
|
|
3986
|
-
$resolve:
|
|
4412
|
+
$resolve: (val = {}) => val,
|
|
3987
4413
|
$default: {}
|
|
3988
4414
|
},
|
|
3989
4415
|
env: {
|
|
@@ -3993,7 +4419,7 @@ var typescript_build_executor_untyped_default = defineUntypedSchema4({
|
|
|
3993
4419
|
tsType: "Record<string, string>",
|
|
3994
4420
|
description: "The environment variable values"
|
|
3995
4421
|
},
|
|
3996
|
-
$resolve:
|
|
4422
|
+
$resolve: (val = {}) => val,
|
|
3997
4423
|
$default: {}
|
|
3998
4424
|
}
|
|
3999
4425
|
});
|
|
@@ -4007,10 +4433,7 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
|
|
|
4007
4433
|
id: "TypeScriptLibraryGeneratorSchema",
|
|
4008
4434
|
title: "TypeScript Library Generator",
|
|
4009
4435
|
description: "A type definition for the base TypeScript Library Generator schema",
|
|
4010
|
-
required: [
|
|
4011
|
-
"directory",
|
|
4012
|
-
"name"
|
|
4013
|
-
]
|
|
4436
|
+
required: ["directory", "name"]
|
|
4014
4437
|
},
|
|
4015
4438
|
name: {
|
|
4016
4439
|
$schema: {
|
|
@@ -4039,12 +4462,7 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
|
|
|
4039
4462
|
title: "Platform",
|
|
4040
4463
|
type: "string",
|
|
4041
4464
|
description: "The platform to target with the library",
|
|
4042
|
-
enum: [
|
|
4043
|
-
"neutral",
|
|
4044
|
-
"node",
|
|
4045
|
-
"worker",
|
|
4046
|
-
"browser"
|
|
4047
|
-
]
|
|
4465
|
+
enum: ["neutral", "node", "worker", "browser"]
|
|
4048
4466
|
},
|
|
4049
4467
|
$default: "neutral"
|
|
4050
4468
|
},
|
|
@@ -4066,11 +4484,7 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
|
|
|
4066
4484
|
$schema: {
|
|
4067
4485
|
title: "Unit Test Runner",
|
|
4068
4486
|
type: "string",
|
|
4069
|
-
enum: [
|
|
4070
|
-
"jest",
|
|
4071
|
-
"vitest",
|
|
4072
|
-
"none"
|
|
4073
|
-
],
|
|
4487
|
+
enum: ["jest", "vitest", "none"],
|
|
4074
4488
|
description: "The unit test runner to use"
|
|
4075
4489
|
}
|
|
4076
4490
|
},
|
|
@@ -4078,10 +4492,7 @@ var typescript_library_generator_untyped_default = defineUntypedSchema5({
|
|
|
4078
4492
|
$schema: {
|
|
4079
4493
|
title: "Test Environment",
|
|
4080
4494
|
type: "string",
|
|
4081
|
-
enum: [
|
|
4082
|
-
"jsdom",
|
|
4083
|
-
"node"
|
|
4084
|
-
],
|
|
4495
|
+
enum: ["jsdom", "node"],
|
|
4085
4496
|
description: "The test environment to use"
|
|
4086
4497
|
}
|
|
4087
4498
|
},
|
|
@@ -4138,12 +4549,25 @@ import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/proj
|
|
|
4138
4549
|
|
|
4139
4550
|
// ../workspace-tools/src/utils/lock-file.ts
|
|
4140
4551
|
init_esm_shims();
|
|
4141
|
-
import {
|
|
4552
|
+
import {
|
|
4553
|
+
output as output2,
|
|
4554
|
+
readJsonFile,
|
|
4555
|
+
workspaceRoot as workspaceRoot2
|
|
4556
|
+
} from "@nx/devkit";
|
|
4142
4557
|
import { existsSync as existsSync8 } from "node:fs";
|
|
4143
4558
|
import { join as join4 } from "node:path";
|
|
4144
|
-
import {
|
|
4145
|
-
|
|
4146
|
-
|
|
4559
|
+
import {
|
|
4560
|
+
getNpmLockfileDependencies,
|
|
4561
|
+
getNpmLockfileNodes
|
|
4562
|
+
} from "nx/src/plugins/js/lock-file/npm-parser";
|
|
4563
|
+
import {
|
|
4564
|
+
getPnpmLockfileDependencies,
|
|
4565
|
+
getPnpmLockfileNodes
|
|
4566
|
+
} from "nx/src/plugins/js/lock-file/pnpm-parser";
|
|
4567
|
+
import {
|
|
4568
|
+
getYarnLockfileDependencies,
|
|
4569
|
+
getYarnLockfileNodes
|
|
4570
|
+
} from "nx/src/plugins/js/lock-file/yarn-parser";
|
|
4147
4571
|
var YARN_LOCK_FILE = "yarn.lock";
|
|
4148
4572
|
var NPM_LOCK_FILE = "package-lock.json";
|
|
4149
4573
|
var PNPM_LOCK_FILE = "pnpm-lock.yaml";
|
|
@@ -4153,7 +4577,10 @@ var PNPM_LOCK_PATH = join4(workspaceRoot2, PNPM_LOCK_FILE);
|
|
|
4153
4577
|
|
|
4154
4578
|
// ../workspace-tools/src/utils/package-helpers.ts
|
|
4155
4579
|
init_esm_shims();
|
|
4156
|
-
import {
|
|
4580
|
+
import {
|
|
4581
|
+
joinPathFragments as joinPathFragments6,
|
|
4582
|
+
readJsonFile as readJsonFile2
|
|
4583
|
+
} from "@nx/devkit";
|
|
4157
4584
|
import { existsSync as existsSync9 } from "node:fs";
|
|
4158
4585
|
|
|
4159
4586
|
// ../workspace-tools/src/utils/plugin-helpers.ts
|
|
@@ -4176,18 +4603,23 @@ async function initGeneratorFn(tree, options, config) {
|
|
|
4176
4603
|
}
|
|
4177
4604
|
return task;
|
|
4178
4605
|
}
|
|
4179
|
-
|
|
4180
|
-
|
|
4606
|
+
var generator_default6 = withRunGenerator(
|
|
4607
|
+
"Initialize Storm Projen workspace",
|
|
4608
|
+
initGeneratorFn
|
|
4609
|
+
);
|
|
4181
4610
|
function addProjenDeps(tree, options) {
|
|
4182
4611
|
return () => {
|
|
4183
4612
|
const packageJson = readJsonFile4(`${options.directory}/package.json`);
|
|
4184
4613
|
packageJson.dependencies["projen"] ??= "^0.91.6";
|
|
4185
4614
|
if (packageJson) {
|
|
4186
|
-
addDependenciesToPackageJson4(
|
|
4615
|
+
addDependenciesToPackageJson4(
|
|
4616
|
+
tree,
|
|
4617
|
+
packageJson.dependencies || {},
|
|
4618
|
+
packageJson.devDependencies || {}
|
|
4619
|
+
)();
|
|
4187
4620
|
}
|
|
4188
4621
|
};
|
|
4189
4622
|
}
|
|
4190
|
-
__name(addProjenDeps, "addProjenDeps");
|
|
4191
4623
|
|
|
4192
4624
|
export {
|
|
4193
4625
|
initGeneratorFn,
|