@storm-software/build-tools 0.126.0 → 0.128.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-D4GFM7T3.js → chunk-35CAZTPP.js} +5 -5
- package/dist/{chunk-MFNKAXYD.js → chunk-6DW2UIEM.js} +8 -8
- package/dist/{chunk-WII65MJ7.mjs → chunk-6ZO43IAV.mjs} +10 -10
- package/dist/{chunk-D4OKH6T7.mjs → chunk-DRADRPMM.mjs} +1 -1
- package/dist/{chunk-TRLJJTHR.mjs → chunk-FCBGCDK3.mjs} +8 -10
- package/dist/{chunk-JA25ZINV.js → chunk-FNPD6F2G.js} +15 -17
- package/dist/{chunk-WNPKRTXM.js → chunk-GNHY7YOD.js} +49 -49
- package/dist/{chunk-2PC2NR2O.mjs → chunk-HTJ3E2HO.mjs} +1 -1
- package/dist/{chunk-WS5C3L62.mjs → chunk-ICR2RWVX.mjs} +10 -21
- package/dist/{chunk-SHSM74JR.mjs → chunk-JTAFRAI6.mjs} +1 -1
- package/dist/{chunk-XVCITQCZ.js → chunk-NJSGHMCU.js} +16 -27
- package/dist/{chunk-7YLFK6HP.js → chunk-NYV6SVCQ.js} +2 -2
- package/dist/{chunk-A24RXGCW.mjs → chunk-RRZETOZV.mjs} +9 -8
- package/dist/{chunk-45ZDIGOF.js → chunk-XBT3NCKQ.js} +9 -8
- package/dist/index.js +8 -8
- package/dist/index.mjs +7 -7
- package/dist/plugins/analyze.d.mts +6 -0
- package/dist/plugins/analyze.d.ts +6 -0
- package/dist/plugins/analyze.js +8 -0
- package/dist/plugins/analyze.mjs +8 -0
- package/dist/plugins/index.d.mts +5 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +21 -0
- package/dist/plugins/index.mjs +21 -0
- package/dist/plugins/swc.d.mts +5 -0
- package/dist/plugins/swc.d.ts +5 -0
- package/dist/plugins/swc.js +7 -0
- package/dist/plugins/swc.mjs +7 -0
- package/dist/plugins/ts-resolve.d.mts +9 -0
- package/dist/plugins/ts-resolve.d.ts +9 -0
- package/dist/plugins/ts-resolve.js +8 -0
- package/dist/plugins/ts-resolve.mjs +8 -0
- package/dist/plugins/type-definitions.d.mts +10 -0
- package/dist/plugins/type-definitions.d.ts +10 -0
- package/dist/plugins/type-definitions.js +7 -0
- package/dist/plugins/type-definitions.mjs +7 -0
- package/dist/utilities/copy-assets.d.mts +7 -0
- package/dist/utilities/copy-assets.d.ts +7 -0
- package/dist/utilities/copy-assets.js +9 -0
- package/dist/utilities/copy-assets.mjs +9 -0
- package/dist/utilities/generate-package-json.d.mts +9 -0
- package/dist/utilities/generate-package-json.d.ts +9 -0
- package/dist/utilities/generate-package-json.js +14 -0
- package/dist/utilities/generate-package-json.mjs +14 -0
- package/dist/utilities/get-entry-points.d.mts +20 -0
- package/dist/utilities/get-entry-points.d.ts +20 -0
- package/dist/utilities/get-entry-points.js +8 -0
- package/dist/utilities/get-entry-points.mjs +8 -0
- package/dist/utilities/get-env.d.mts +7 -0
- package/dist/utilities/get-env.d.ts +7 -0
- package/dist/utilities/get-env.js +8 -0
- package/dist/utilities/get-env.mjs +8 -0
- package/dist/utilities/get-file-banner.d.mts +10 -0
- package/dist/utilities/get-file-banner.d.ts +10 -0
- package/dist/utilities/get-file-banner.js +7 -0
- package/dist/utilities/get-file-banner.mjs +7 -0
- package/dist/utilities/get-out-extension.d.mts +13 -0
- package/dist/utilities/get-out-extension.d.ts +13 -0
- package/dist/utilities/get-out-extension.js +7 -0
- package/dist/utilities/get-out-extension.mjs +7 -0
- package/dist/utilities/get-project-deps.d.mts +8 -0
- package/dist/utilities/get-project-deps.d.ts +8 -0
- package/dist/utilities/get-project-deps.js +11 -0
- package/dist/utilities/get-project-deps.mjs +11 -0
- package/dist/utilities/index.d.mts +14 -0
- package/dist/utilities/index.d.ts +14 -0
- package/dist/utilities/index.js +54 -0
- package/dist/utilities/index.mjs +54 -0
- package/dist/utilities/read-nx-config.d.mts +11 -0
- package/dist/utilities/read-nx-config.d.ts +11 -0
- package/dist/utilities/read-nx-config.js +8 -0
- package/dist/utilities/read-nx-config.mjs +8 -0
- package/dist/utilities/task-graph.d.mts +9 -0
- package/dist/utilities/task-graph.d.ts +9 -0
- package/dist/utilities/task-graph.js +9 -0
- package/dist/utilities/task-graph.mjs +9 -0
- 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 -->
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkXBT3NCKQjs = require('./chunk-XBT3NCKQ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkSHUYVCIDjs = require('./chunk-SHUYVCID.js');
|
|
@@ -11,7 +11,7 @@ var _chunkSHUYVCIDjs = require('./chunk-SHUYVCID.js');
|
|
|
11
11
|
// src/utilities/get-entry-points.ts
|
|
12
12
|
var _glob = require('glob');
|
|
13
13
|
var getEntryPoints = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async (config, projectRoot, sourceRoot, entry, emitOnAll = false) => {
|
|
14
|
-
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot :
|
|
14
|
+
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : _chunkXBT3NCKQjs.findWorkspaceRoot.call(void 0, );
|
|
15
15
|
const entryPoints = [];
|
|
16
16
|
if (entry) {
|
|
17
17
|
if (Array.isArray(entry)) {
|
|
@@ -23,7 +23,7 @@ var getEntryPoints = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
if (emitOnAll) {
|
|
26
|
-
entryPoints.push(
|
|
26
|
+
entryPoints.push(_chunkXBT3NCKQjs.joinPaths.call(void 0, workspaceRoot, sourceRoot || projectRoot, "**/*.{ts,tsx}"));
|
|
27
27
|
}
|
|
28
28
|
const results = [];
|
|
29
29
|
for (const entryPoint in entryPoints) {
|
|
@@ -32,9 +32,9 @@ var getEntryPoints = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async
|
|
|
32
32
|
withFileTypes: true
|
|
33
33
|
});
|
|
34
34
|
results.push(...files.reduce((ret, filePath) => {
|
|
35
|
-
const result =
|
|
35
|
+
const result = _chunkXBT3NCKQjs.correctPaths.call(void 0, _chunkXBT3NCKQjs.joinPaths.call(void 0, filePath.path, filePath.name).replaceAll(_chunkXBT3NCKQjs.correctPaths.call(void 0, workspaceRoot), "").replaceAll(_chunkXBT3NCKQjs.correctPaths.call(void 0, projectRoot), ""));
|
|
36
36
|
if (result) {
|
|
37
|
-
|
|
37
|
+
_chunkXBT3NCKQjs.writeDebug.call(void 0, `Trying to add entry point ${result} at "${_chunkXBT3NCKQjs.joinPaths.call(void 0, filePath.path, filePath.name)}"`, config);
|
|
38
38
|
if (!results.includes(result)) {
|
|
39
39
|
results.push(result);
|
|
40
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkXBT3NCKQjs = require('./chunk-XBT3NCKQ.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkSHUYVCIDjs = require('./chunk-SHUYVCID.js');
|
|
@@ -25,8 +25,8 @@ var tsResolvePlugin = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, ({ re
|
|
|
25
25
|
return {
|
|
26
26
|
name: `storm:ts-resolve`,
|
|
27
27
|
async resolveId(source, importer) {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
_chunkXBT3NCKQjs.writeDebug.call(void 0, `ts-resolve - resolveId source: ${source}`);
|
|
29
|
+
_chunkXBT3NCKQjs.writeDebug.call(void 0, `ts-resolve - resolveId importer: ${importer}`);
|
|
30
30
|
if (!importer) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
@@ -37,7 +37,7 @@ var tsResolvePlugin = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, ({ re
|
|
|
37
37
|
return false;
|
|
38
38
|
}
|
|
39
39
|
if (ignore && ignore(source, importer)) {
|
|
40
|
-
|
|
40
|
+
_chunkXBT3NCKQjs.writeDebug.call(void 0, `ts-resolve - ignored ${source}`);
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
if (resolveOnly) {
|
|
@@ -46,12 +46,12 @@ var tsResolvePlugin = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, ({ re
|
|
|
46
46
|
return v.test(source);
|
|
47
47
|
});
|
|
48
48
|
if (!shouldResolve) {
|
|
49
|
-
|
|
49
|
+
_chunkXBT3NCKQjs.writeDebug.call(void 0, `ts-resolve - skipped by matching resolveOnly ${source}`);
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
if (_path2.default.isAbsolute(source)) {
|
|
54
|
-
|
|
54
|
+
_chunkXBT3NCKQjs.writeDebug.call(void 0, `ts-resolve - skipped absolute path: ${source}`);
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
57
57
|
const basedir = importer ? await _fs2.default.promises.realpath(_path2.default.dirname(importer)) : process.cwd();
|
|
@@ -83,10 +83,10 @@ var tsResolvePlugin = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, ({ re
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
if (id) {
|
|
86
|
-
|
|
86
|
+
_chunkXBT3NCKQjs.writeDebug.call(void 0, `ts-resolve - resolved ${source} to ${id}`);
|
|
87
87
|
return id;
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
_chunkXBT3NCKQjs.writeDebug.call(void 0, `ts-resolve - mark ${source} as external`);
|
|
90
90
|
return false;
|
|
91
91
|
}
|
|
92
92
|
};
|
|
@@ -14,39 +14,36 @@ import {
|
|
|
14
14
|
writeSystem,
|
|
15
15
|
writeTrace,
|
|
16
16
|
writeWarning
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-RRZETOZV.mjs";
|
|
18
18
|
import {
|
|
19
19
|
__name
|
|
20
20
|
} from "./chunk-O6YSETKJ.mjs";
|
|
21
21
|
|
|
22
|
-
// src/utilities/read-nx-config.ts
|
|
23
|
-
import { hfs } from "@humanfs/node";
|
|
24
|
-
|
|
25
22
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
26
23
|
import { loadConfig } from "c12";
|
|
27
24
|
import defu from "defu";
|
|
28
25
|
var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, options = {}) => {
|
|
29
26
|
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
30
|
-
let config = loadConfig({
|
|
27
|
+
let config = await loadConfig({
|
|
31
28
|
cwd: workspacePath,
|
|
32
29
|
packageJson: true,
|
|
33
30
|
name: fileName,
|
|
34
31
|
envName: fileName?.toUpperCase(),
|
|
35
32
|
jitiOptions: {
|
|
36
33
|
debug: false,
|
|
37
|
-
|
|
34
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "config")
|
|
38
35
|
},
|
|
39
36
|
...options
|
|
40
37
|
});
|
|
41
38
|
if (!config || Object.keys(config).length === 0) {
|
|
42
|
-
config = loadConfig({
|
|
39
|
+
config = await loadConfig({
|
|
43
40
|
cwd: workspacePath,
|
|
44
41
|
packageJson: true,
|
|
45
42
|
name: fileName,
|
|
46
43
|
envName: fileName?.toUpperCase(),
|
|
47
44
|
jitiOptions: {
|
|
48
45
|
debug: false,
|
|
49
|
-
|
|
46
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "config")
|
|
50
47
|
},
|
|
51
48
|
configFile: fileName,
|
|
52
49
|
...options
|
|
@@ -500,6 +497,8 @@ ${formatLogMessage(config)}`, config);
|
|
|
500
497
|
}, "loadStormConfig");
|
|
501
498
|
|
|
502
499
|
// src/utilities/read-nx-config.ts
|
|
500
|
+
import { existsSync } from "node:fs";
|
|
501
|
+
import { readFile } from "node:fs/promises";
|
|
503
502
|
var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
504
503
|
let rootDir = workspaceRoot;
|
|
505
504
|
if (!rootDir) {
|
|
@@ -507,10 +506,11 @@ var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
|
507
506
|
rootDir = config.workspaceRoot;
|
|
508
507
|
}
|
|
509
508
|
const nxJsonPath = joinPaths(rootDir, "nx.json");
|
|
510
|
-
if (!
|
|
509
|
+
if (!existsSync(nxJsonPath)) {
|
|
511
510
|
throw new Error("Cannot find project.json configuration");
|
|
512
511
|
}
|
|
513
|
-
|
|
512
|
+
const configContent = await readFile(nxJsonPath, "utf8");
|
|
513
|
+
return JSON.parse(configContent);
|
|
514
514
|
}, "readNxConfig");
|
|
515
515
|
|
|
516
516
|
export {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readNxConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6ZO43IAV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
isVerbose,
|
|
6
6
|
joinPaths,
|
|
7
7
|
writeDebug
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RRZETOZV.mjs";
|
|
9
9
|
import {
|
|
10
10
|
__name
|
|
11
11
|
} from "./chunk-O6YSETKJ.mjs";
|
|
12
12
|
|
|
13
13
|
// src/utilities/copy-assets.ts
|
|
14
|
-
import {
|
|
15
|
-
import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph } from "@nx/devkit";
|
|
14
|
+
import { readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "@nx/devkit";
|
|
16
15
|
import { copyAssets as copyAssetsBase } from "@nx/js";
|
|
17
16
|
import { glob } from "glob";
|
|
17
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
18
18
|
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson = true, includeSrc = false, banner, footer) => {
|
|
19
19
|
const pendingAssets = Array.from(assets ?? []);
|
|
20
20
|
if (!pendingAssets?.some((asset) => asset?.glob === "*.md")) {
|
|
@@ -46,14 +46,12 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
const nxJson = readNxConfig(config.workspaceRoot);
|
|
49
|
-
const projectGraph =
|
|
50
|
-
exitOnError: true
|
|
51
|
-
});
|
|
49
|
+
const projectGraph = readCachedProjectGraph();
|
|
52
50
|
const projectsConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
53
51
|
if (!projectsConfigurations?.projects?.[projectName]) {
|
|
54
52
|
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.");
|
|
55
53
|
}
|
|
56
|
-
const buildTarget = projectsConfigurations.projects[projectName]
|
|
54
|
+
const buildTarget = projectsConfigurations.projects[projectName].targets?.build;
|
|
57
55
|
if (!buildTarget) {
|
|
58
56
|
throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${joinPaths(projectRoot, "project.json")}`);
|
|
59
57
|
}
|
|
@@ -83,9 +81,9 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
83
81
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
84
82
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
85
83
|
]);
|
|
86
|
-
await Promise.allSettled(files.map(async (file) =>
|
|
84
|
+
await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
87
85
|
|
|
88
|
-
${await
|
|
86
|
+
${await readFile(file, "utf8")}
|
|
89
87
|
|
|
90
88
|
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
91
89
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkGNHY7YODjs = require('./chunk-GNHY7YOD.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkXBT3NCKQjs = require('./chunk-XBT3NCKQ.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
var _chunkSHUYVCIDjs = require('./chunk-SHUYVCID.js');
|
|
12
12
|
|
|
13
13
|
// src/utilities/copy-assets.ts
|
|
14
|
-
var _node = require('@humanfs/node');
|
|
15
14
|
var _devkit = require('@nx/devkit');
|
|
16
15
|
var _js = require('@nx/js');
|
|
17
16
|
var _glob = require('glob');
|
|
17
|
+
var _promises = require('fs/promises');
|
|
18
18
|
var copyAssets = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson = true, includeSrc = false, banner, footer) => {
|
|
19
19
|
const pendingAssets = Array.from(_nullishCoalesce(assets, () => ( [])));
|
|
20
20
|
if (!_optionalChain([pendingAssets, 'optionalAccess', _ => _.some, 'call', _2 => _2((asset) => _optionalChain([asset, 'optionalAccess', _3 => _3.glob]) === "*.md")])) {
|
|
@@ -45,17 +45,15 @@ var copyAssets = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async (con
|
|
|
45
45
|
output: "src/"
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
const nxJson =
|
|
49
|
-
const projectGraph =
|
|
50
|
-
exitOnError: true
|
|
51
|
-
});
|
|
48
|
+
const nxJson = _chunkGNHY7YODjs.readNxConfig.call(void 0, config.workspaceRoot);
|
|
49
|
+
const projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
|
|
52
50
|
const projectsConfigurations = _devkit.readProjectsConfigurationFromProjectGraph.call(void 0, projectGraph);
|
|
53
51
|
if (!_optionalChain([projectsConfigurations, 'optionalAccess', _7 => _7.projects, 'optionalAccess', _8 => _8[projectName]])) {
|
|
54
52
|
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.");
|
|
55
53
|
}
|
|
56
|
-
const buildTarget = _optionalChain([projectsConfigurations, 'access', _9 => _9.projects, 'access', _10 => _10[projectName], '
|
|
54
|
+
const buildTarget = _optionalChain([projectsConfigurations, 'access', _9 => _9.projects, 'access', _10 => _10[projectName], 'access', _11 => _11.targets, 'optionalAccess', _12 => _12.build]);
|
|
57
55
|
if (!buildTarget) {
|
|
58
|
-
throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${
|
|
56
|
+
throw new Error(`The Build process failed because the project does not have a valid build target in the project.json file. Check if the file exists in the root of the project at ${_chunkXBT3NCKQjs.joinPaths.call(void 0, projectRoot, "project.json")}`);
|
|
59
57
|
}
|
|
60
58
|
const result = await _js.copyAssets.call(void 0, {
|
|
61
59
|
assets,
|
|
@@ -70,22 +68,22 @@ var copyAssets = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async (con
|
|
|
70
68
|
projectsConfigurations,
|
|
71
69
|
nxJsonConfiguration: nxJson,
|
|
72
70
|
cwd: config.workspaceRoot,
|
|
73
|
-
isVerbose:
|
|
71
|
+
isVerbose: _chunkXBT3NCKQjs.isVerbose.call(void 0, config.logLevel)
|
|
74
72
|
});
|
|
75
73
|
if (!result.success) {
|
|
76
74
|
throw new Error("The Build process failed trying to copy assets");
|
|
77
75
|
}
|
|
78
76
|
if (includeSrc === true) {
|
|
79
|
-
|
|
77
|
+
_chunkXBT3NCKQjs.writeDebug.call(void 0, `\u{1F4DD} Adding banner and writing source files: ${_chunkXBT3NCKQjs.joinPaths.call(void 0, outputPath, "src")}`, config);
|
|
80
78
|
const files = await _glob.glob.call(void 0, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
_chunkXBT3NCKQjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
80
|
+
_chunkXBT3NCKQjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
81
|
+
_chunkXBT3NCKQjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
82
|
+
_chunkXBT3NCKQjs.joinPaths.call(void 0, config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
85
83
|
]);
|
|
86
|
-
await Promise.allSettled(files.map(async (file) =>
|
|
84
|
+
await Promise.allSettled(files.map(async (file) => _promises.writeFile.call(void 0, file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
87
85
|
|
|
88
|
-
${await
|
|
86
|
+
${await _promises.readFile.call(void 0, file, "utf8")}
|
|
89
87
|
|
|
90
88
|
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
91
89
|
}
|
|
@@ -14,39 +14,36 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkXBT3NCKQjs = require('./chunk-XBT3NCKQ.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
var _chunkSHUYVCIDjs = require('./chunk-SHUYVCID.js');
|
|
21
21
|
|
|
22
|
-
// src/utilities/read-nx-config.ts
|
|
23
|
-
var _node = require('@humanfs/node');
|
|
24
|
-
|
|
25
22
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
26
23
|
var _c12 = require('c12');
|
|
27
24
|
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
|
|
28
25
|
var getConfigFileByName = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async (fileName, filePath, options = {}) => {
|
|
29
|
-
const workspacePath = filePath ||
|
|
30
|
-
let config = _c12.loadConfig.call(void 0, {
|
|
26
|
+
const workspacePath = filePath || _chunkXBT3NCKQjs.findWorkspaceRoot.call(void 0, filePath);
|
|
27
|
+
let config = await _c12.loadConfig.call(void 0, {
|
|
31
28
|
cwd: workspacePath,
|
|
32
29
|
packageJson: true,
|
|
33
30
|
name: fileName,
|
|
34
31
|
envName: _optionalChain([fileName, 'optionalAccess', _ => _.toUpperCase, 'call', _2 => _2()]),
|
|
35
32
|
jitiOptions: {
|
|
36
33
|
debug: false,
|
|
37
|
-
|
|
34
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkXBT3NCKQjs.joinPaths.call(void 0, process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "config")
|
|
38
35
|
},
|
|
39
36
|
...options
|
|
40
37
|
});
|
|
41
38
|
if (!config || Object.keys(config).length === 0) {
|
|
42
|
-
config = _c12.loadConfig.call(void 0, {
|
|
39
|
+
config = await _c12.loadConfig.call(void 0, {
|
|
43
40
|
cwd: workspacePath,
|
|
44
41
|
packageJson: true,
|
|
45
42
|
name: fileName,
|
|
46
43
|
envName: _optionalChain([fileName, 'optionalAccess', _3 => _3.toUpperCase, 'call', _4 => _4()]),
|
|
47
44
|
jitiOptions: {
|
|
48
45
|
debug: false,
|
|
49
|
-
|
|
46
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkXBT3NCKQjs.joinPaths.call(void 0, process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "config")
|
|
50
47
|
},
|
|
51
48
|
configFile: fileName,
|
|
52
49
|
...options
|
|
@@ -55,12 +52,12 @@ var getConfigFileByName = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, a
|
|
|
55
52
|
return config;
|
|
56
53
|
}, "getConfigFileByName");
|
|
57
54
|
var getConfigFile = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async (filePath, additionalFileNames = []) => {
|
|
58
|
-
const workspacePath = filePath ? filePath :
|
|
55
|
+
const workspacePath = filePath ? filePath : _chunkXBT3NCKQjs.findWorkspaceRoot.call(void 0, filePath);
|
|
59
56
|
const result = await getConfigFileByName("storm", workspacePath);
|
|
60
57
|
let config = result.config;
|
|
61
58
|
const configFile = result.configFile;
|
|
62
59
|
if (config && configFile && Object.keys(config).length > 0) {
|
|
63
|
-
|
|
60
|
+
_chunkXBT3NCKQjs.writeSystem.call(void 0, `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, {
|
|
64
61
|
logLevel: "all"
|
|
65
62
|
});
|
|
66
63
|
}
|
|
@@ -68,7 +65,7 @@ var getConfigFile = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async (
|
|
|
68
65
|
const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
|
|
69
66
|
for (const result2 of results) {
|
|
70
67
|
if (_optionalChain([result2, 'optionalAccess', _5 => _5.config]) && _optionalChain([result2, 'optionalAccess', _6 => _6.configFile]) && Object.keys(result2.config).length > 0) {
|
|
71
|
-
|
|
68
|
+
_chunkXBT3NCKQjs.writeSystem.call(void 0, `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`, {
|
|
72
69
|
logLevel: "all"
|
|
73
70
|
});
|
|
74
71
|
config = _defu2.default.call(void 0, _nullishCoalesce(result2.config, () => ( {})), _nullishCoalesce(config, () => ( {})));
|
|
@@ -105,15 +102,15 @@ var getConfigEnv = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, () => {
|
|
|
105
102
|
licensing: process.env[`${prefix}LICENSING`] || void 0,
|
|
106
103
|
timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
|
|
107
104
|
locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
|
|
108
|
-
configFile: process.env[`${prefix}CONFIG_FILE`] ?
|
|
109
|
-
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ?
|
|
105
|
+
configFile: process.env[`${prefix}CONFIG_FILE`] ? _chunkXBT3NCKQjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_FILE`]) : void 0,
|
|
106
|
+
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? _chunkXBT3NCKQjs.correctPaths.call(void 0, process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
|
|
110
107
|
directories: {
|
|
111
|
-
cache: process.env[`${prefix}CACHE_DIR`] ?
|
|
112
|
-
data: process.env[`${prefix}DATA_DIR`] ?
|
|
113
|
-
config: process.env[`${prefix}CONFIG_DIR`] ?
|
|
114
|
-
temp: process.env[`${prefix}TEMP_DIR`] ?
|
|
115
|
-
log: process.env[`${prefix}LOG_DIR`] ?
|
|
116
|
-
build: process.env[`${prefix}BUILD_DIR`] ?
|
|
108
|
+
cache: process.env[`${prefix}CACHE_DIR`] ? _chunkXBT3NCKQjs.correctPaths.call(void 0, process.env[`${prefix}CACHE_DIR`]) : void 0,
|
|
109
|
+
data: process.env[`${prefix}DATA_DIR`] ? _chunkXBT3NCKQjs.correctPaths.call(void 0, process.env[`${prefix}DATA_DIR`]) : void 0,
|
|
110
|
+
config: process.env[`${prefix}CONFIG_DIR`] ? _chunkXBT3NCKQjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_DIR`]) : void 0,
|
|
111
|
+
temp: process.env[`${prefix}TEMP_DIR`] ? _chunkXBT3NCKQjs.correctPaths.call(void 0, process.env[`${prefix}TEMP_DIR`]) : void 0,
|
|
112
|
+
log: process.env[`${prefix}LOG_DIR`] ? _chunkXBT3NCKQjs.correctPaths.call(void 0, process.env[`${prefix}LOG_DIR`]) : void 0,
|
|
113
|
+
build: process.env[`${prefix}BUILD_DIR`] ? _chunkXBT3NCKQjs.correctPaths.call(void 0, process.env[`${prefix}BUILD_DIR`]) : void 0
|
|
117
114
|
},
|
|
118
115
|
skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
|
|
119
116
|
env: (_nullishCoalesce(_nullishCoalesce(process.env[`${prefix}ENV`], () => ( process.env.NODE_ENV)), () => ( process.env.ENVIRONMENT))) || void 0,
|
|
@@ -136,23 +133,23 @@ var getConfigEnv = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, () => {
|
|
|
136
133
|
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
137
134
|
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
138
135
|
},
|
|
139
|
-
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`])) ?
|
|
136
|
+
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`])) ? _chunkXBT3NCKQjs.getLogLevelLabel.call(void 0, Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0
|
|
140
137
|
};
|
|
141
|
-
const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) &&
|
|
138
|
+
const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && _chunkXBT3NCKQjs.COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
|
|
142
139
|
config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
|
|
143
140
|
ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
|
|
144
141
|
return ret;
|
|
145
142
|
}, {}) : getThemeColorConfigEnv(prefix);
|
|
146
|
-
if (config.docs ===
|
|
147
|
-
if (config.homepage ===
|
|
148
|
-
config.docs = `${
|
|
143
|
+
if (config.docs === _chunkXBT3NCKQjs.STORM_DEFAULT_DOCS) {
|
|
144
|
+
if (config.homepage === _chunkXBT3NCKQjs.STORM_DEFAULT_HOMEPAGE) {
|
|
145
|
+
config.docs = `${_chunkXBT3NCKQjs.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
149
146
|
} else {
|
|
150
147
|
config.docs = `${config.homepage}/docs`;
|
|
151
148
|
}
|
|
152
149
|
}
|
|
153
|
-
if (config.licensing ===
|
|
154
|
-
if (config.homepage ===
|
|
155
|
-
config.licensing = `${
|
|
150
|
+
if (config.licensing === _chunkXBT3NCKQjs.STORM_DEFAULT_LICENSING) {
|
|
151
|
+
if (config.homepage === _chunkXBT3NCKQjs.STORM_DEFAULT_HOMEPAGE) {
|
|
152
|
+
config.licensing = `${_chunkXBT3NCKQjs.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
|
|
156
153
|
} else {
|
|
157
154
|
config.licensing = `${config.homepage}/docs`;
|
|
158
155
|
}
|
|
@@ -290,31 +287,31 @@ var setConfigEnv = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, (config)
|
|
|
290
287
|
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
291
288
|
}
|
|
292
289
|
if (config.configFile) {
|
|
293
|
-
process.env[`${prefix}CONFIG_FILE`] =
|
|
290
|
+
process.env[`${prefix}CONFIG_FILE`] = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.configFile);
|
|
294
291
|
}
|
|
295
292
|
if (config.workspaceRoot) {
|
|
296
|
-
process.env[`${prefix}WORKSPACE_ROOT`] =
|
|
297
|
-
process.env.NX_WORKSPACE_ROOT =
|
|
298
|
-
process.env.NX_WORKSPACE_ROOT_PATH =
|
|
293
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.workspaceRoot);
|
|
294
|
+
process.env.NX_WORKSPACE_ROOT = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.workspaceRoot);
|
|
295
|
+
process.env.NX_WORKSPACE_ROOT_PATH = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.workspaceRoot);
|
|
299
296
|
}
|
|
300
297
|
if (config.directories) {
|
|
301
298
|
if (!config.skipCache && config.directories.cache) {
|
|
302
|
-
process.env[`${prefix}CACHE_DIR`] =
|
|
299
|
+
process.env[`${prefix}CACHE_DIR`] = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.directories.cache);
|
|
303
300
|
}
|
|
304
301
|
if (config.directories.data) {
|
|
305
|
-
process.env[`${prefix}DATA_DIR`] =
|
|
302
|
+
process.env[`${prefix}DATA_DIR`] = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.directories.data);
|
|
306
303
|
}
|
|
307
304
|
if (config.directories.config) {
|
|
308
|
-
process.env[`${prefix}CONFIG_DIR`] =
|
|
305
|
+
process.env[`${prefix}CONFIG_DIR`] = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.directories.config);
|
|
309
306
|
}
|
|
310
307
|
if (config.directories.temp) {
|
|
311
|
-
process.env[`${prefix}TEMP_DIR`] =
|
|
308
|
+
process.env[`${prefix}TEMP_DIR`] = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.directories.temp);
|
|
312
309
|
}
|
|
313
310
|
if (config.directories.log) {
|
|
314
|
-
process.env[`${prefix}LOG_DIR`] =
|
|
311
|
+
process.env[`${prefix}LOG_DIR`] = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.directories.log);
|
|
315
312
|
}
|
|
316
313
|
if (config.directories.build) {
|
|
317
|
-
process.env[`${prefix}BUILD_DIR`] =
|
|
314
|
+
process.env[`${prefix}BUILD_DIR`] = _chunkXBT3NCKQjs.correctPaths.call(void 0, config.directories.build);
|
|
318
315
|
}
|
|
319
316
|
}
|
|
320
317
|
if (config.skipCache !== void 0) {
|
|
@@ -368,8 +365,8 @@ var setConfigEnv = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, (config)
|
|
|
368
365
|
if (config.logLevel) {
|
|
369
366
|
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
370
367
|
process.env.LOG_LEVEL = String(config.logLevel);
|
|
371
|
-
process.env.NX_VERBOSE_LOGGING = String(
|
|
372
|
-
process.env.RUST_BACKTRACE =
|
|
368
|
+
process.env.NX_VERBOSE_LOGGING = String(_chunkXBT3NCKQjs.getLogLevel.call(void 0, config.logLevel) >= _chunkXBT3NCKQjs.LogLevel.DEBUG ? true : false);
|
|
369
|
+
process.env.RUST_BACKTRACE = _chunkXBT3NCKQjs.getLogLevel.call(void 0, config.logLevel) >= _chunkXBT3NCKQjs.LogLevel.DEBUG ? "full" : "none";
|
|
373
370
|
}
|
|
374
371
|
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
375
372
|
for (const key of Object.keys(_nullishCoalesce(config.extensions, () => ( {})))) {
|
|
@@ -479,38 +476,41 @@ var _static_cache = void 0;
|
|
|
479
476
|
var loadStormConfig = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async (workspaceRoot) => {
|
|
480
477
|
let config = {};
|
|
481
478
|
if (_optionalChain([_static_cache, 'optionalAccess', _29 => _29.data]) && _optionalChain([_static_cache, 'optionalAccess', _30 => _30.timestamp]) && _static_cache.timestamp >= Date.now() + 3e4) {
|
|
482
|
-
|
|
479
|
+
_chunkXBT3NCKQjs.writeTrace.call(void 0, `Configuration cache hit - ${_static_cache.timestamp}`, _static_cache.data);
|
|
483
480
|
return _static_cache.data;
|
|
484
481
|
}
|
|
485
482
|
let _workspaceRoot = workspaceRoot;
|
|
486
483
|
if (!_workspaceRoot) {
|
|
487
|
-
_workspaceRoot =
|
|
484
|
+
_workspaceRoot = _chunkXBT3NCKQjs.findWorkspaceRoot.call(void 0, );
|
|
488
485
|
}
|
|
489
486
|
const configFile = await getConfigFile(_workspaceRoot);
|
|
490
487
|
if (!configFile) {
|
|
491
|
-
|
|
488
|
+
_chunkXBT3NCKQjs.writeWarning.call(void 0, "No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", {
|
|
492
489
|
logLevel: "all"
|
|
493
490
|
});
|
|
494
491
|
}
|
|
495
|
-
config = _defu2.default.call(void 0, getConfigEnv(), configFile,
|
|
492
|
+
config = _defu2.default.call(void 0, getConfigEnv(), configFile, _chunkXBT3NCKQjs.getDefaultConfig.call(void 0, _workspaceRoot));
|
|
496
493
|
setConfigEnv(config);
|
|
497
|
-
|
|
498
|
-
${
|
|
494
|
+
_chunkXBT3NCKQjs.writeTrace.call(void 0, `\u2699\uFE0F Using Storm configuration:
|
|
495
|
+
${_chunkXBT3NCKQjs.formatLogMessage.call(void 0, config)}`, config);
|
|
499
496
|
return config;
|
|
500
497
|
}, "loadStormConfig");
|
|
501
498
|
|
|
502
499
|
// src/utilities/read-nx-config.ts
|
|
500
|
+
var _fs = require('fs');
|
|
501
|
+
var _promises = require('fs/promises');
|
|
503
502
|
var readNxConfig = /* @__PURE__ */ _chunkSHUYVCIDjs.__name.call(void 0, async (workspaceRoot) => {
|
|
504
503
|
let rootDir = workspaceRoot;
|
|
505
504
|
if (!rootDir) {
|
|
506
505
|
const config = await loadStormConfig();
|
|
507
506
|
rootDir = config.workspaceRoot;
|
|
508
507
|
}
|
|
509
|
-
const nxJsonPath =
|
|
510
|
-
if (!
|
|
508
|
+
const nxJsonPath = _chunkXBT3NCKQjs.joinPaths.call(void 0, rootDir, "nx.json");
|
|
509
|
+
if (!_fs.existsSync.call(void 0, nxJsonPath)) {
|
|
511
510
|
throw new Error("Cannot find project.json configuration");
|
|
512
511
|
}
|
|
513
|
-
|
|
512
|
+
const configContent = await _promises.readFile.call(void 0, nxJsonPath, "utf8");
|
|
513
|
+
return JSON.parse(configContent);
|
|
514
514
|
}, "readNxConfig");
|
|
515
515
|
|
|
516
516
|
|
|
@@ -2,39 +2,27 @@ import {
|
|
|
2
2
|
findWorkspaceRoot,
|
|
3
3
|
joinPaths,
|
|
4
4
|
writeTrace
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-RRZETOZV.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-O6YSETKJ.mjs";
|
|
9
9
|
|
|
10
10
|
// src/utilities/generate-package-json.ts
|
|
11
|
-
import { hfs } from "@humanfs/node";
|
|
12
11
|
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
13
12
|
import { Glob } from "glob";
|
|
14
|
-
import {
|
|
13
|
+
import { existsSync } from "node:fs";
|
|
14
|
+
import { readFile } from "node:fs/promises";
|
|
15
|
+
import { readCachedProjectGraph } from "nx/src/project-graph/project-graph";
|
|
15
16
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
16
|
-
const
|
|
17
|
-
exitOnError: true
|
|
18
|
-
});
|
|
19
|
-
const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
20
|
-
if (!projectConfigurations?.projects?.[projectName]) {
|
|
21
|
-
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.");
|
|
22
|
-
}
|
|
23
|
-
const projectJsonPath = joinPaths(workspaceRoot, projectRoot, "project.json");
|
|
24
|
-
if (!await hfs.isFile(projectJsonPath)) {
|
|
25
|
-
throw new Error("Cannot find project.json configuration");
|
|
26
|
-
}
|
|
27
|
-
if (!projectConfigurations?.projects?.[projectName]) {
|
|
28
|
-
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.");
|
|
29
|
-
}
|
|
30
|
-
const projectDependencies = calculateProjectBuildableDependencies(void 0, projectGraph, workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
17
|
+
const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph(), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
31
18
|
const localPackages = [];
|
|
32
19
|
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
33
20
|
const projectNode = project.node;
|
|
34
21
|
if (projectNode.data.root) {
|
|
35
22
|
const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
23
|
+
if (existsSync(projectPackageJsonPath)) {
|
|
24
|
+
const projectPackageJsonContent = await readFile(projectPackageJsonPath, "utf8");
|
|
25
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
38
26
|
if (projectPackageJson.private !== false) {
|
|
39
27
|
localPackages.push(projectPackageJson);
|
|
40
28
|
}
|
|
@@ -70,7 +58,8 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
70
58
|
}, "addPackageDependencies");
|
|
71
59
|
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
72
60
|
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
|
|
73
|
-
const
|
|
61
|
+
const workspacePackageJsonContent = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
62
|
+
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
74
63
|
packageJson.type ??= "module";
|
|
75
64
|
packageJson.sideEffects ??= false;
|
|
76
65
|
if (includeSrc === true) {
|