@storm-software/unbuild 0.35.2 → 0.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/unbuild.cjs +67 -37
- package/bin/unbuild.js +69 -39
- package/dist/build.cjs +7 -7
- package/dist/build.js +6 -6
- package/dist/{chunk-KXDOKQLW.js → chunk-4VAP3O4T.js} +48 -29
- package/dist/{chunk-3HGUCQU6.cjs → chunk-5XTLMOFH.cjs} +3 -3
- package/dist/{chunk-5FQVMM7I.cjs → chunk-A45F3XCO.cjs} +26 -15
- package/dist/{chunk-PLJQK2VX.js → chunk-A7ULBMR4.js} +26 -15
- package/dist/{chunk-Y7PS2HJA.cjs → chunk-AI7YECRT.cjs} +3 -3
- package/dist/{chunk-ZPWH22ZM.cjs → chunk-BZELKGMN.cjs} +2 -2
- package/dist/{chunk-2E6P5U5P.js → chunk-FLMNRVR2.js} +1 -1
- package/dist/{chunk-3M7GEZDL.js → chunk-FRURXT64.js} +1 -1
- package/dist/{chunk-N5KR37LU.cjs → chunk-MXG2QBLK.cjs} +2 -2
- package/dist/{chunk-RFEZKCMQ.js → chunk-R6HJQ5XB.js} +1 -1
- package/dist/{chunk-44QVHNBQ.cjs → chunk-WIBRZ6QG.cjs} +142 -123
- package/dist/{chunk-L3WYWYD4.js → chunk-XRMMVXZP.js} +1 -1
- package/dist/clean.cjs +3 -3
- package/dist/clean.js +2 -2
- package/dist/index.cjs +7 -7
- package/dist/index.js +6 -6
- package/dist/plugins/analyze.cjs +3 -3
- package/dist/plugins/analyze.js +2 -2
- package/dist/plugins/on-error.cjs +3 -3
- package/dist/plugins/on-error.js +2 -2
- package/dist/plugins/tsc.cjs +3 -3
- package/dist/plugins/tsc.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
package/bin/unbuild.cjs
CHANGED
|
@@ -129,7 +129,7 @@ var WorkspaceDirectoryConfigSchema = import_zod.default.object({
|
|
|
129
129
|
build: import_zod.default.string().trim().default("dist").describe("The directory used to store the workspace's distributable files after a build (relative to the workspace root)")
|
|
130
130
|
}).describe("Various directories used by the workspace to store data, cache, and configuration files");
|
|
131
131
|
var StormConfigSchema = import_zod.default.object({
|
|
132
|
-
$schema: import_zod.default.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
|
|
132
|
+
$schema: import_zod.default.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm-workspace.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
|
|
133
133
|
extends: ExtendsSchema.optional(),
|
|
134
134
|
name: import_zod.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
|
|
135
135
|
namespace: import_zod.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
@@ -171,6 +171,7 @@ var StormConfigSchema = import_zod.default.object({
|
|
|
171
171
|
"trace",
|
|
172
172
|
"all"
|
|
173
173
|
]).default("info").describe("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`)."),
|
|
174
|
+
skipConfigLogging: import_zod.default.boolean().optional().describe("Should the logging of the current Storm Workspace configuration be skipped?"),
|
|
174
175
|
registry: RegistryConfigSchema,
|
|
175
176
|
configFile: import_zod.default.string().trim().nullable().default(null).describe("The filepath of the Storm config. When this field is null, no config file was found in the current workspace."),
|
|
176
177
|
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe("Storm theme config values used for styling various package elements"),
|
|
@@ -364,14 +365,17 @@ var import_node_fs = require("fs");
|
|
|
364
365
|
var import_node_path = require("path");
|
|
365
366
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
366
367
|
var depth = 0;
|
|
367
|
-
function findFolderUp(startPath, endFileNames) {
|
|
368
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
368
369
|
const _startPath = startPath ?? process.cwd();
|
|
370
|
+
if (endDirectoryNames.some((endDirName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endDirName)))) {
|
|
371
|
+
return _startPath;
|
|
372
|
+
}
|
|
369
373
|
if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
|
|
370
374
|
return _startPath;
|
|
371
375
|
}
|
|
372
376
|
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
373
377
|
const parent = (0, import_node_path.join)(_startPath, "..");
|
|
374
|
-
return findFolderUp(parent, endFileNames);
|
|
378
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
375
379
|
}
|
|
376
380
|
return void 0;
|
|
377
381
|
}
|
|
@@ -379,17 +383,17 @@ __name(findFolderUp, "findFolderUp");
|
|
|
379
383
|
|
|
380
384
|
// ../config-tools/src/utilities/find-workspace-root.ts
|
|
381
385
|
var rootFiles = [
|
|
382
|
-
"storm.json",
|
|
383
|
-
"storm.json",
|
|
384
|
-
"storm.yaml",
|
|
385
|
-
"storm.yml",
|
|
386
|
-
"storm.js",
|
|
387
|
-
"storm.ts",
|
|
388
|
-
".storm.json",
|
|
389
|
-
".storm.yaml",
|
|
390
|
-
".storm.yml",
|
|
391
|
-
".storm.js",
|
|
392
|
-
".storm.ts",
|
|
386
|
+
"storm-workspace.json",
|
|
387
|
+
"storm-workspace.json",
|
|
388
|
+
"storm-workspace.yaml",
|
|
389
|
+
"storm-workspace.yml",
|
|
390
|
+
"storm-workspace.js",
|
|
391
|
+
"storm-workspace.ts",
|
|
392
|
+
".storm-workspace.json",
|
|
393
|
+
".storm-workspace.yaml",
|
|
394
|
+
".storm-workspace.yml",
|
|
395
|
+
".storm-workspace.js",
|
|
396
|
+
".storm-workspace.ts",
|
|
393
397
|
"lerna.json",
|
|
394
398
|
"nx.json",
|
|
395
399
|
"turbo.json",
|
|
@@ -413,11 +417,18 @@ var rootFiles = [
|
|
|
413
417
|
"pnpm-lock.yml",
|
|
414
418
|
"bun.lockb"
|
|
415
419
|
];
|
|
420
|
+
var rootDirectories = [
|
|
421
|
+
".storm-workspace",
|
|
422
|
+
".nx",
|
|
423
|
+
".github",
|
|
424
|
+
".vscode",
|
|
425
|
+
".verdaccio"
|
|
426
|
+
];
|
|
416
427
|
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
417
428
|
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
418
429
|
return correctPaths(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
419
430
|
}
|
|
420
|
-
return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles));
|
|
431
|
+
return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
421
432
|
}
|
|
422
433
|
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
423
434
|
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
@@ -792,10 +803,10 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
792
803
|
}, "getConfigFileByName");
|
|
793
804
|
var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
|
|
794
805
|
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
795
|
-
const result = await getConfigFileByName("storm", workspacePath);
|
|
806
|
+
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
796
807
|
let config = result.config;
|
|
797
808
|
const configFile = result.configFile;
|
|
798
|
-
if (config && configFile && Object.keys(config).length > 0) {
|
|
809
|
+
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
799
810
|
writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
|
|
800
811
|
logLevel: "all"
|
|
801
812
|
});
|
|
@@ -804,9 +815,11 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
804
815
|
const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
|
|
805
816
|
for (const result2 of results) {
|
|
806
817
|
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
818
|
+
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
819
|
+
writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
|
|
820
|
+
logLevel: "all"
|
|
821
|
+
});
|
|
822
|
+
}
|
|
810
823
|
config = (0, import_defu.default)(result2.config ?? {}, config ?? {});
|
|
811
824
|
}
|
|
812
825
|
}
|
|
@@ -879,7 +892,8 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
879
892
|
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
880
893
|
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
881
894
|
},
|
|
882
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0
|
|
895
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
896
|
+
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
883
897
|
};
|
|
884
898
|
const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
|
|
885
899
|
config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
|
|
@@ -1114,6 +1128,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1114
1128
|
process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
|
|
1115
1129
|
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
1116
1130
|
}
|
|
1131
|
+
if (config.skipConfigLogging !== void 0) {
|
|
1132
|
+
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(config.skipConfigLogging);
|
|
1133
|
+
}
|
|
1117
1134
|
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
1118
1135
|
for (const key of Object.keys(config.extensions ?? {})) {
|
|
1119
1136
|
config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
|
|
@@ -1231,7 +1248,7 @@ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, wor
|
|
|
1231
1248
|
const defaultConfig = await getDefaultConfig(_workspaceRoot);
|
|
1232
1249
|
const configFile = await getConfigFile(_workspaceRoot);
|
|
1233
1250
|
if (!configFile && !skipLogs) {
|
|
1234
|
-
writeWarning("No Storm
|
|
1251
|
+
writeWarning("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", {
|
|
1235
1252
|
logLevel: "all"
|
|
1236
1253
|
});
|
|
1237
1254
|
}
|
|
@@ -1269,8 +1286,8 @@ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
|
|
|
1269
1286
|
var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
|
|
1270
1287
|
const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
|
|
1271
1288
|
setConfigEnv(config);
|
|
1272
|
-
if (!skipLogs) {
|
|
1273
|
-
writeTrace(`\u2699\uFE0F Using Storm configuration:
|
|
1289
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
1290
|
+
writeTrace(`\u2699\uFE0F Using Storm Workspace configuration:
|
|
1274
1291
|
${formatLogMessage(config)}`, config);
|
|
1275
1292
|
}
|
|
1276
1293
|
return config;
|
|
@@ -1364,7 +1381,8 @@ var import_node_fs4 = require("fs");
|
|
|
1364
1381
|
var import_promises3 = require("fs/promises");
|
|
1365
1382
|
var import_project_graph = require("nx/src/project-graph/project-graph");
|
|
1366
1383
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
1367
|
-
const
|
|
1384
|
+
const projectGraph = (0, import_project_graph.readCachedProjectGraph)();
|
|
1385
|
+
const projectDependencies = (0, import_buildable_libs_utils.calculateProjectBuildableDependencies)(void 0, projectGraph, workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
1368
1386
|
const localPackages = [];
|
|
1369
1387
|
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
1370
1388
|
const projectNode = project.node;
|
|
@@ -1381,26 +1399,38 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
1381
1399
|
}
|
|
1382
1400
|
if (localPackages.length > 0) {
|
|
1383
1401
|
writeTrace(`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1402
|
+
const projectJsonFile = await (0, import_promises3.readFile)(joinPaths(projectRoot, "project.json"), "utf8");
|
|
1403
|
+
const projectJson = JSON.parse(projectJsonFile);
|
|
1404
|
+
const projectName2 = projectJson.name;
|
|
1405
|
+
const projectConfigurations = (0, import_project_graph.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
1406
|
+
if (!projectConfigurations?.projects?.[projectName2]) {
|
|
1407
|
+
throw new Error("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.");
|
|
1408
|
+
}
|
|
1409
|
+
const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
|
|
1410
|
+
if (projectConfigurations.projects?.[dep]) {
|
|
1411
|
+
const depPackageJsonPath = joinPaths(workspaceRoot, projectConfigurations.projects[dep].root, "package.json");
|
|
1412
|
+
if ((0, import_node_fs4.existsSync)(depPackageJsonPath)) {
|
|
1413
|
+
const depPackageJsonContent = (0, import_node_fs4.readFileSync)(depPackageJsonPath, "utf8");
|
|
1414
|
+
const depPackageJson = JSON.parse(depPackageJsonContent);
|
|
1415
|
+
if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
|
|
1416
|
+
ret.push(depPackageJson.name);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1387
1419
|
}
|
|
1388
1420
|
return ret;
|
|
1389
|
-
},
|
|
1390
|
-
packageJson.
|
|
1391
|
-
if (!ret[localPackage.name]) {
|
|
1392
|
-
ret[localPackage.name] = {
|
|
1393
|
-
optional: false
|
|
1394
|
-
};
|
|
1421
|
+
}, []);
|
|
1422
|
+
packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
|
|
1423
|
+
if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name)) {
|
|
1424
|
+
ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
|
|
1395
1425
|
}
|
|
1396
1426
|
return ret;
|
|
1397
|
-
}, packageJson.
|
|
1427
|
+
}, packageJson.dependencies ?? {});
|
|
1398
1428
|
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
1399
|
-
if (!ret[localPackage.name]) {
|
|
1429
|
+
if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name)) {
|
|
1400
1430
|
ret[localPackage.name] = localPackage.version || "0.0.1";
|
|
1401
1431
|
}
|
|
1402
1432
|
return ret;
|
|
1403
|
-
}, packageJson.
|
|
1433
|
+
}, packageJson.devDependencies ?? {});
|
|
1404
1434
|
} else {
|
|
1405
1435
|
writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
|
|
1406
1436
|
}
|
package/bin/unbuild.js
CHANGED
|
@@ -108,7 +108,7 @@ var WorkspaceDirectoryConfigSchema = z.object({
|
|
|
108
108
|
build: z.string().trim().default("dist").describe("The directory used to store the workspace's distributable files after a build (relative to the workspace root)")
|
|
109
109
|
}).describe("Various directories used by the workspace to store data, cache, and configuration files");
|
|
110
110
|
var StormConfigSchema = z.object({
|
|
111
|
-
$schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
|
|
111
|
+
$schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm-workspace.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
|
|
112
112
|
extends: ExtendsSchema.optional(),
|
|
113
113
|
name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
|
|
114
114
|
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
@@ -150,6 +150,7 @@ var StormConfigSchema = z.object({
|
|
|
150
150
|
"trace",
|
|
151
151
|
"all"
|
|
152
152
|
]).default("info").describe("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`)."),
|
|
153
|
+
skipConfigLogging: z.boolean().optional().describe("Should the logging of the current Storm Workspace configuration be skipped?"),
|
|
153
154
|
registry: RegistryConfigSchema,
|
|
154
155
|
configFile: z.string().trim().nullable().default(null).describe("The filepath of the Storm config. When this field is null, no config file was found in the current workspace."),
|
|
155
156
|
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe("Storm theme config values used for styling various package elements"),
|
|
@@ -343,14 +344,17 @@ import { existsSync } from "node:fs";
|
|
|
343
344
|
import { join } from "node:path";
|
|
344
345
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
345
346
|
var depth = 0;
|
|
346
|
-
function findFolderUp(startPath, endFileNames) {
|
|
347
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
347
348
|
const _startPath = startPath ?? process.cwd();
|
|
349
|
+
if (endDirectoryNames.some((endDirName) => existsSync(join(_startPath, endDirName)))) {
|
|
350
|
+
return _startPath;
|
|
351
|
+
}
|
|
348
352
|
if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
|
|
349
353
|
return _startPath;
|
|
350
354
|
}
|
|
351
355
|
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
352
356
|
const parent = join(_startPath, "..");
|
|
353
|
-
return findFolderUp(parent, endFileNames);
|
|
357
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
354
358
|
}
|
|
355
359
|
return void 0;
|
|
356
360
|
}
|
|
@@ -358,17 +362,17 @@ __name(findFolderUp, "findFolderUp");
|
|
|
358
362
|
|
|
359
363
|
// ../config-tools/src/utilities/find-workspace-root.ts
|
|
360
364
|
var rootFiles = [
|
|
361
|
-
"storm.json",
|
|
362
|
-
"storm.json",
|
|
363
|
-
"storm.yaml",
|
|
364
|
-
"storm.yml",
|
|
365
|
-
"storm.js",
|
|
366
|
-
"storm.ts",
|
|
367
|
-
".storm.json",
|
|
368
|
-
".storm.yaml",
|
|
369
|
-
".storm.yml",
|
|
370
|
-
".storm.js",
|
|
371
|
-
".storm.ts",
|
|
365
|
+
"storm-workspace.json",
|
|
366
|
+
"storm-workspace.json",
|
|
367
|
+
"storm-workspace.yaml",
|
|
368
|
+
"storm-workspace.yml",
|
|
369
|
+
"storm-workspace.js",
|
|
370
|
+
"storm-workspace.ts",
|
|
371
|
+
".storm-workspace.json",
|
|
372
|
+
".storm-workspace.yaml",
|
|
373
|
+
".storm-workspace.yml",
|
|
374
|
+
".storm-workspace.js",
|
|
375
|
+
".storm-workspace.ts",
|
|
372
376
|
"lerna.json",
|
|
373
377
|
"nx.json",
|
|
374
378
|
"turbo.json",
|
|
@@ -392,11 +396,18 @@ var rootFiles = [
|
|
|
392
396
|
"pnpm-lock.yml",
|
|
393
397
|
"bun.lockb"
|
|
394
398
|
];
|
|
399
|
+
var rootDirectories = [
|
|
400
|
+
".storm-workspace",
|
|
401
|
+
".nx",
|
|
402
|
+
".github",
|
|
403
|
+
".vscode",
|
|
404
|
+
".verdaccio"
|
|
405
|
+
];
|
|
395
406
|
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
396
407
|
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
397
408
|
return correctPaths(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
398
409
|
}
|
|
399
|
-
return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles));
|
|
410
|
+
return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
400
411
|
}
|
|
401
412
|
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
402
413
|
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
@@ -771,10 +782,10 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
771
782
|
}, "getConfigFileByName");
|
|
772
783
|
var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames = []) => {
|
|
773
784
|
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
774
|
-
const result = await getConfigFileByName("storm", workspacePath);
|
|
785
|
+
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
775
786
|
let config = result.config;
|
|
776
787
|
const configFile = result.configFile;
|
|
777
|
-
if (config && configFile && Object.keys(config).length > 0) {
|
|
788
|
+
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
778
789
|
writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
|
|
779
790
|
logLevel: "all"
|
|
780
791
|
});
|
|
@@ -783,9 +794,11 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
783
794
|
const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
|
|
784
795
|
for (const result2 of results) {
|
|
785
796
|
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
797
|
+
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
798
|
+
writeTrace(`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
|
|
799
|
+
logLevel: "all"
|
|
800
|
+
});
|
|
801
|
+
}
|
|
789
802
|
config = defu(result2.config ?? {}, config ?? {});
|
|
790
803
|
}
|
|
791
804
|
}
|
|
@@ -858,7 +871,8 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
858
871
|
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
859
872
|
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
860
873
|
},
|
|
861
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0
|
|
874
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
875
|
+
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
862
876
|
};
|
|
863
877
|
const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
|
|
864
878
|
config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
|
|
@@ -1093,6 +1107,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1093
1107
|
process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
|
|
1094
1108
|
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
1095
1109
|
}
|
|
1110
|
+
if (config.skipConfigLogging !== void 0) {
|
|
1111
|
+
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(config.skipConfigLogging);
|
|
1112
|
+
}
|
|
1096
1113
|
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
1097
1114
|
for (const key of Object.keys(config.extensions ?? {})) {
|
|
1098
1115
|
config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
|
|
@@ -1210,7 +1227,7 @@ var createStormConfig = /* @__PURE__ */ __name(async (extensionName, schema, wor
|
|
|
1210
1227
|
const defaultConfig = await getDefaultConfig(_workspaceRoot);
|
|
1211
1228
|
const configFile = await getConfigFile(_workspaceRoot);
|
|
1212
1229
|
if (!configFile && !skipLogs) {
|
|
1213
|
-
writeWarning("No Storm
|
|
1230
|
+
writeWarning("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", {
|
|
1214
1231
|
logLevel: "all"
|
|
1215
1232
|
});
|
|
1216
1233
|
}
|
|
@@ -1248,8 +1265,8 @@ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
|
|
|
1248
1265
|
var loadStormConfig = /* @__PURE__ */ __name(async (workspaceRoot, skipLogs = false) => {
|
|
1249
1266
|
const config = await createStormConfig(void 0, void 0, workspaceRoot, skipLogs);
|
|
1250
1267
|
setConfigEnv(config);
|
|
1251
|
-
if (!skipLogs) {
|
|
1252
|
-
writeTrace(`\u2699\uFE0F Using Storm configuration:
|
|
1268
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
1269
|
+
writeTrace(`\u2699\uFE0F Using Storm Workspace configuration:
|
|
1253
1270
|
${formatLogMessage(config)}`, config);
|
|
1254
1271
|
}
|
|
1255
1272
|
return config;
|
|
@@ -1339,11 +1356,12 @@ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `//
|
|
|
1339
1356
|
// ../build-tools/src/utilities/generate-package-json.ts
|
|
1340
1357
|
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
1341
1358
|
import { Glob } from "glob";
|
|
1342
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
1359
|
+
import { existsSync as existsSync3, readFileSync } from "node:fs";
|
|
1343
1360
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
1344
|
-
import { readCachedProjectGraph } from "nx/src/project-graph/project-graph";
|
|
1361
|
+
import { readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "nx/src/project-graph/project-graph";
|
|
1345
1362
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
1346
|
-
const
|
|
1363
|
+
const projectGraph = readCachedProjectGraph();
|
|
1364
|
+
const projectDependencies = calculateProjectBuildableDependencies(void 0, projectGraph, workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
1347
1365
|
const localPackages = [];
|
|
1348
1366
|
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
1349
1367
|
const projectNode = project.node;
|
|
@@ -1360,26 +1378,38 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
1360
1378
|
}
|
|
1361
1379
|
if (localPackages.length > 0) {
|
|
1362
1380
|
writeTrace(`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1381
|
+
const projectJsonFile = await readFile3(joinPaths(projectRoot, "project.json"), "utf8");
|
|
1382
|
+
const projectJson = JSON.parse(projectJsonFile);
|
|
1383
|
+
const projectName2 = projectJson.name;
|
|
1384
|
+
const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
1385
|
+
if (!projectConfigurations?.projects?.[projectName2]) {
|
|
1386
|
+
throw new Error("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.");
|
|
1387
|
+
}
|
|
1388
|
+
const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
|
|
1389
|
+
if (projectConfigurations.projects?.[dep]) {
|
|
1390
|
+
const depPackageJsonPath = joinPaths(workspaceRoot, projectConfigurations.projects[dep].root, "package.json");
|
|
1391
|
+
if (existsSync3(depPackageJsonPath)) {
|
|
1392
|
+
const depPackageJsonContent = readFileSync(depPackageJsonPath, "utf8");
|
|
1393
|
+
const depPackageJson = JSON.parse(depPackageJsonContent);
|
|
1394
|
+
if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
|
|
1395
|
+
ret.push(depPackageJson.name);
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1366
1398
|
}
|
|
1367
1399
|
return ret;
|
|
1368
|
-
},
|
|
1369
|
-
packageJson.
|
|
1370
|
-
if (!ret[localPackage.name]) {
|
|
1371
|
-
ret[localPackage.name] = {
|
|
1372
|
-
optional: false
|
|
1373
|
-
};
|
|
1400
|
+
}, []);
|
|
1401
|
+
packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
|
|
1402
|
+
if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name)) {
|
|
1403
|
+
ret[localPackage.name] = `>=${localPackage.version || "0.0.1"}`;
|
|
1374
1404
|
}
|
|
1375
1405
|
return ret;
|
|
1376
|
-
}, packageJson.
|
|
1406
|
+
}, packageJson.dependencies ?? {});
|
|
1377
1407
|
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
1378
|
-
if (!ret[localPackage.name]) {
|
|
1408
|
+
if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name)) {
|
|
1379
1409
|
ret[localPackage.name] = localPackage.version || "0.0.1";
|
|
1380
1410
|
}
|
|
1381
1411
|
return ret;
|
|
1382
|
-
}, packageJson.
|
|
1412
|
+
}, packageJson.devDependencies ?? {});
|
|
1383
1413
|
} else {
|
|
1384
1414
|
writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
|
|
1385
1415
|
}
|
package/dist/build.cjs
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkWIBRZ6QGcjs = require('./chunk-WIBRZ6QG.cjs');
|
|
9
9
|
require('./chunk-OD3ULBE3.cjs');
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
12
|
-
require('./chunk-
|
|
13
|
-
require('./chunk-
|
|
14
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-5XTLMOFH.cjs');
|
|
11
|
+
require('./chunk-MXG2QBLK.cjs');
|
|
12
|
+
require('./chunk-AI7YECRT.cjs');
|
|
13
|
+
require('./chunk-BZELKGMN.cjs');
|
|
14
|
+
require('./chunk-A45F3XCO.cjs');
|
|
15
15
|
require('./chunk-BGYQAVKQ.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
@@ -20,4 +20,4 @@ require('./chunk-BGYQAVKQ.cjs');
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
exports.build =
|
|
23
|
+
exports.build = _chunkWIBRZ6QGcjs.build; exports.cleanOutputPath = _chunkWIBRZ6QGcjs.cleanOutputPath; exports.copyBuildAssets = _chunkWIBRZ6QGcjs.copyBuildAssets; exports.executeUnbuild = _chunkWIBRZ6QGcjs.executeUnbuild; exports.generatePackageJson = _chunkWIBRZ6QGcjs.generatePackageJson; exports.resolveOptions = _chunkWIBRZ6QGcjs.resolveOptions;
|
package/dist/build.js
CHANGED
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
executeUnbuild,
|
|
6
6
|
generatePackageJson,
|
|
7
7
|
resolveOptions
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4VAP3O4T.js";
|
|
9
9
|
import "./chunk-RBYYB7X2.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-FLMNRVR2.js";
|
|
11
|
+
import "./chunk-XRMMVXZP.js";
|
|
12
|
+
import "./chunk-R6HJQ5XB.js";
|
|
13
|
+
import "./chunk-FRURXT64.js";
|
|
14
|
+
import "./chunk-A7ULBMR4.js";
|
|
15
15
|
import "./chunk-3GQAWCBQ.js";
|
|
16
16
|
export {
|
|
17
17
|
build,
|