@storm-software/workspace-tools 1.266.9 → 1.267.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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/dist/{chunk-Z2D5X5KJ.mjs → chunk-2C37GBZ2.mjs} +2 -2
- package/dist/{chunk-5AVEZVE5.mjs → chunk-2TEC7IFE.mjs} +4 -4
- package/dist/{chunk-WBNGMFYP.js → chunk-4Y6B6JDH.js} +11 -11
- package/dist/{chunk-K7B7YVQF.mjs → chunk-5I7ULQZF.mjs} +1 -1
- package/dist/{chunk-JL5QGFBX.js → chunk-6CGAYKQL.js} +20 -20
- package/dist/{chunk-BJ6UNKNM.js → chunk-6JJB5AYA.js} +9 -9
- package/dist/{chunk-TKGD3SNO.mjs → chunk-7FHFHZRB.mjs} +1 -1
- package/dist/{chunk-Z255YQZR.js → chunk-7NNHBZC5.js} +2 -2
- package/dist/{chunk-HYRQEEMO.js → chunk-7PRHEOCT.js} +2 -2
- package/dist/{chunk-UBMOQCNN.js → chunk-B3DVFXXD.js} +2 -2
- package/dist/{chunk-5G2XZTUU.mjs → chunk-BFGWJ7BS.mjs} +4 -4
- package/dist/{chunk-YWAH4DHJ.mjs → chunk-BJMT4ECA.mjs} +3 -3
- package/dist/chunk-BUPROWVS.js +653 -0
- package/dist/{chunk-4UPFP6EX.mjs → chunk-CM2FQCBL.mjs} +3 -3
- package/dist/{chunk-VUIT3ZAI.mjs → chunk-CNCYVRZ4.mjs} +1 -1
- package/dist/{chunk-NCTH2PTP.mjs → chunk-EHFWY65U.mjs} +3 -3
- package/dist/{chunk-XGSZL5N7.mjs → chunk-FM2TFXVW.mjs} +4 -4
- package/dist/{chunk-7LP6KWJ4.mjs → chunk-FPAOVOZX.mjs} +3 -3
- package/dist/{chunk-MP2P2MGP.js → chunk-G4QFSE5B.js} +8 -5
- package/dist/{chunk-2RRVYK6E.mjs → chunk-GNFQ5PGW.mjs} +1 -1
- package/dist/{chunk-E2GASAYN.js → chunk-HOXPAVCL.js} +2 -2
- package/dist/{chunk-TBE7H5P7.js → chunk-ICPUM2HS.js} +5 -5
- package/dist/{chunk-36QIKTAL.mjs → chunk-IXHY3ZPO.mjs} +3 -3
- package/dist/{chunk-TCZC6XD6.mjs → chunk-IZHZKPHV.mjs} +12 -9
- package/dist/{chunk-SORZ4BJW.mjs → chunk-KP5JD22G.mjs} +4 -4
- package/dist/{chunk-A2Z3X5GK.mjs → chunk-LS27TGDZ.mjs} +2 -2
- package/dist/chunk-LUR7U35A.mjs +653 -0
- package/dist/{chunk-QDLQJ3QS.mjs → chunk-MFSIJSBW.mjs} +3 -3
- package/dist/{chunk-L6BH2OLB.mjs → chunk-MIVNJALE.mjs} +1 -1
- package/dist/{chunk-XRZPNGM5.mjs → chunk-N4QRXJLZ.mjs} +2 -2
- package/dist/{chunk-VGSUCQ2S.mjs → chunk-N7GSKHH2.mjs} +1 -1
- package/dist/{chunk-4CLX5NBT.js → chunk-NSCWEC2S.js} +2 -2
- package/dist/{chunk-YWHLDLKE.js → chunk-OKW5O5P4.js} +5 -5
- package/dist/{chunk-YT3ECNTF.js → chunk-OQPX75CG.js} +2 -2
- package/dist/{chunk-5NTNN2XK.mjs → chunk-OW6VGYDT.mjs} +1 -1
- package/dist/{chunk-TPWVZZWY.js → chunk-P4OVFIT6.js} +2 -2
- package/dist/{chunk-YMFIVYHZ.mjs → chunk-PGEZGCU2.mjs} +2 -2
- package/dist/{chunk-GEIXDGFR.mjs → chunk-PZL7IZ7I.mjs} +2 -2
- package/dist/{chunk-4FJCOFII.mjs → chunk-Q7WXH4GA.mjs} +3 -3
- package/dist/{chunk-LY5IGOQR.mjs → chunk-QXE7GTBY.mjs} +3 -3
- package/dist/{chunk-KWARMR7G.mjs → chunk-RMLZO26I.mjs} +4 -4
- package/dist/{chunk-USRO6ZCF.mjs → chunk-RPMGDH44.mjs} +2 -2
- package/dist/{chunk-G4S2HWXN.js → chunk-RUKOOSWL.js} +2 -2
- package/dist/{chunk-474QFQKX.mjs → chunk-SYTBJXTM.mjs} +1 -1
- package/dist/{chunk-NYP6AVTV.js → chunk-TET4GF3D.js} +2 -2
- package/dist/{chunk-IOUCRBHV.mjs → chunk-TPK3STUY.mjs} +4 -4
- package/dist/{chunk-WHITLY6G.mjs → chunk-TRD4W5ZK.mjs} +4 -4
- package/dist/{chunk-TMCMTZPP.mjs → chunk-UY3Q5IDT.mjs} +1 -1
- package/dist/{chunk-KDQGKQHN.mjs → chunk-V42FQ4FR.mjs} +3 -3
- package/dist/{chunk-FJ3HUDJN.mjs → chunk-WAXAZ5PV.mjs} +3 -3
- package/dist/{chunk-VFXWLOY7.mjs → chunk-WDFR6LVR.mjs} +2 -2
- package/dist/{chunk-D2OJX4DZ.mjs → chunk-XCBLUQPM.mjs} +3 -3
- package/dist/{chunk-QIF3QXOA.mjs → chunk-XYRHMXLC.mjs} +3 -3
- package/dist/{chunk-Z4WOCHYB.mjs → chunk-YHPRTWSY.mjs} +2 -2
- package/dist/{chunk-PKL7UOGQ.js → chunk-YW4UN25U.js} +4 -4
- package/dist/{chunk-NCV26VAW.js → chunk-Z4NKRWWJ.js} +15 -15
- package/dist/{chunk-3DMOUTDH.mjs → chunk-Z6GV7C5U.mjs} +1 -1
- package/dist/{chunk-TIOK7TNA.mjs → chunk-ZJ3QSWTQ.mjs} +4 -4
- package/dist/executors.js +14 -14
- package/dist/executors.mjs +28 -28
- package/dist/generators.js +10 -10
- package/dist/generators.mjs +21 -21
- package/dist/index.js +22 -22
- package/dist/index.mjs +51 -51
- package/dist/src/base/base-executor.js +3 -3
- package/dist/src/base/base-executor.mjs +6 -6
- package/dist/src/base/base-executor.untyped.mjs +1 -1
- package/dist/src/base/base-generator.js +3 -3
- package/dist/src/base/base-generator.mjs +6 -6
- package/dist/src/base/base-generator.untyped.mjs +1 -1
- package/dist/src/base/cargo-base-executor.untyped.mjs +1 -1
- package/dist/src/base/index.js +4 -4
- package/dist/src/base/index.mjs +10 -10
- package/dist/src/base/typescript-build-executor.untyped.mjs +2 -2
- package/dist/src/base/typescript-library-generator.untyped.mjs +1 -1
- package/dist/src/executors/cargo-build/executor.js +4 -4
- package/dist/src/executors/cargo-build/executor.mjs +8 -8
- package/dist/src/executors/cargo-build/untyped.mjs +1 -1
- package/dist/src/executors/cargo-check/executor.js +4 -4
- package/dist/src/executors/cargo-check/executor.mjs +8 -8
- package/dist/src/executors/cargo-check/untyped.mjs +1 -1
- package/dist/src/executors/cargo-clippy/executor.js +4 -4
- package/dist/src/executors/cargo-clippy/executor.mjs +8 -8
- package/dist/src/executors/cargo-clippy/untyped.mjs +1 -1
- package/dist/src/executors/cargo-doc/executor.js +4 -4
- package/dist/src/executors/cargo-doc/executor.mjs +8 -8
- package/dist/src/executors/cargo-doc/untyped.mjs +1 -1
- package/dist/src/executors/cargo-format/executor.js +4 -4
- package/dist/src/executors/cargo-format/executor.mjs +8 -8
- package/dist/src/executors/cargo-format/untyped.mjs +1 -1
- package/dist/src/executors/cargo-publish/executor.mjs +3 -3
- package/dist/src/executors/cargo-publish/untyped.mjs +1 -1
- package/dist/src/executors/clean-package/executor.js +5 -5
- package/dist/src/executors/clean-package/executor.mjs +6 -6
- package/dist/src/executors/clean-package/untyped.mjs +1 -1
- package/dist/src/executors/esbuild/executor.js +4 -4
- package/dist/src/executors/esbuild/executor.mjs +7 -7
- package/dist/src/executors/esbuild/untyped.mjs +2 -2
- package/dist/src/executors/npm-publish/executor.mjs +4 -4
- package/dist/src/executors/npm-publish/untyped.mjs +1 -1
- package/dist/src/executors/size-limit/executor.js +4 -4
- package/dist/src/executors/size-limit/executor.mjs +7 -7
- package/dist/src/executors/size-limit/untyped.mjs +1 -1
- package/dist/src/executors/typia/executor.js +4 -4
- package/dist/src/executors/typia/executor.mjs +7 -7
- package/dist/src/executors/typia/untyped.mjs +1 -1
- package/dist/src/executors/unbuild/executor.js +4 -4
- package/dist/src/executors/unbuild/executor.mjs +7 -7
- package/dist/src/executors/unbuild/untyped.mjs +2 -2
- package/dist/src/generators/browser-library/generator.js +4 -4
- package/dist/src/generators/browser-library/generator.mjs +9 -9
- package/dist/src/generators/browser-library/untyped.mjs +1 -1
- package/dist/src/generators/config-schema/generator.js +4 -4
- package/dist/src/generators/config-schema/generator.mjs +7 -7
- package/dist/src/generators/config-schema/untyped.mjs +1 -1
- package/dist/src/generators/init/init.mjs +2 -2
- package/dist/src/generators/init/untyped.mjs +1 -1
- package/dist/src/generators/neutral-library/generator.js +4 -4
- package/dist/src/generators/neutral-library/generator.mjs +9 -9
- package/dist/src/generators/neutral-library/untyped.mjs +1 -1
- package/dist/src/generators/node-library/generator.js +4 -4
- package/dist/src/generators/node-library/generator.mjs +9 -9
- package/dist/src/generators/node-library/untyped.mjs +1 -1
- package/dist/src/generators/preset/generator.js +4 -4
- package/dist/src/generators/preset/generator.mjs +7 -7
- package/dist/src/generators/preset/untyped.mjs +1 -1
- package/dist/src/generators/release-version/generator.js +3 -3
- package/dist/src/generators/release-version/generator.mjs +6 -6
- package/dist/src/generators/release-version/untyped.mjs +1 -1
- package/dist/src/plugins/rust/cargo-toml.mjs +4 -4
- package/dist/src/plugins/rust/index.mjs +4 -4
- package/dist/src/plugins/typescript/index.mjs +4 -4
- package/dist/src/plugins/typescript/project-config.mjs +4 -4
- package/dist/src/plugins/typescript/tsup.mjs +2 -2
- package/dist/src/plugins/typescript/untyped-schema.mjs +2 -2
- package/dist/src/types.mjs +1 -1
- package/dist/src/utils/apply-workspace-tokens.mjs +4 -4
- package/dist/src/utils/cargo.mjs +2 -2
- package/dist/src/utils/create-cli-options.mjs +2 -2
- package/dist/src/utils/get-project-configurations.mjs +4 -4
- package/dist/src/utils/index.mjs +14 -14
- package/dist/src/utils/lock-file.mjs +2 -2
- package/dist/src/utils/package-helpers.mjs +4 -4
- package/dist/src/utils/plugin-helpers.mjs +3 -3
- package/dist/src/utils/pnpm-deps-update.mjs +3 -3
- package/dist/src/utils/project-tags.mjs +2 -2
- package/dist/src/utils/toml.mjs +2 -2
- package/dist/src/utils/typia-transform.mjs +2 -2
- package/dist/src/utils/versions.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-JDFMHRPQ.mjs +0 -1533
- package/dist/chunk-OWBD5WVM.js +0 -1532
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
import {
|
|
2
|
+
withRunExecutor
|
|
3
|
+
} from "./chunk-2TEC7IFE.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getStopwatch,
|
|
6
|
+
getWorkspaceConfig,
|
|
7
|
+
writeDebug,
|
|
8
|
+
writeError,
|
|
9
|
+
writeFatal,
|
|
10
|
+
writeInfo,
|
|
11
|
+
writeSuccess,
|
|
12
|
+
writeTrace,
|
|
13
|
+
writeWarning
|
|
14
|
+
} from "./chunk-IZHZKPHV.mjs";
|
|
15
|
+
import {
|
|
16
|
+
findWorkspaceRoot
|
|
17
|
+
} from "./chunk-WDFR6LVR.mjs";
|
|
18
|
+
import {
|
|
19
|
+
joinPaths
|
|
20
|
+
} from "./chunk-5I7ULQZF.mjs";
|
|
21
|
+
import {
|
|
22
|
+
__name,
|
|
23
|
+
__require
|
|
24
|
+
} from "./chunk-N7GSKHH2.mjs";
|
|
25
|
+
|
|
26
|
+
// ../esbuild/src/build.ts
|
|
27
|
+
import { createProjectGraphAsync, readProjectsConfigurationFromProjectGraph as readProjectsConfigurationFromProjectGraph2, writeJsonFile } from "@nx/devkit";
|
|
28
|
+
|
|
29
|
+
// ../build-tools/src/config.ts
|
|
30
|
+
var DEFAULT_COMPILED_BANNER = `/*****************************************
|
|
31
|
+
*
|
|
32
|
+
* \u26A1 Built by Storm Software
|
|
33
|
+
*
|
|
34
|
+
*****************************************/
|
|
35
|
+
`;
|
|
36
|
+
var DEFAULT_ENVIRONMENT = "production";
|
|
37
|
+
var DEFAULT_TARGET = "esnext";
|
|
38
|
+
var DEFAULT_ORGANIZATION = "storm-software";
|
|
39
|
+
|
|
40
|
+
// ../build-tools/src/plugins/swc.ts
|
|
41
|
+
import { transform } from "@swc/core";
|
|
42
|
+
|
|
43
|
+
// ../build-tools/src/plugins/ts-resolve.ts
|
|
44
|
+
import fs from "node:fs";
|
|
45
|
+
import { builtinModules } from "node:module";
|
|
46
|
+
import path from "node:path";
|
|
47
|
+
import _resolve from "resolve";
|
|
48
|
+
|
|
49
|
+
// ../build-tools/src/plugins/type-definitions.ts
|
|
50
|
+
import { stripIndents } from "@nx/devkit";
|
|
51
|
+
import { relative } from "path";
|
|
52
|
+
|
|
53
|
+
// ../build-tools/src/utilities/copy-assets.ts
|
|
54
|
+
import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
|
|
55
|
+
import { glob } from "glob";
|
|
56
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
57
|
+
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
58
|
+
const pendingAssets = Array.from(assets ?? []);
|
|
59
|
+
pendingAssets.push({
|
|
60
|
+
input: projectRoot,
|
|
61
|
+
glob: "*.md",
|
|
62
|
+
output: "."
|
|
63
|
+
});
|
|
64
|
+
pendingAssets.push({
|
|
65
|
+
input: ".",
|
|
66
|
+
glob: "LICENSE",
|
|
67
|
+
output: "."
|
|
68
|
+
});
|
|
69
|
+
if (generatePackageJson2 === false) {
|
|
70
|
+
pendingAssets.push({
|
|
71
|
+
input: projectRoot,
|
|
72
|
+
glob: "package.json",
|
|
73
|
+
output: "."
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (includeSrc === true) {
|
|
77
|
+
pendingAssets.push({
|
|
78
|
+
input: sourceRoot,
|
|
79
|
+
glob: "**/{*.ts,*.tsx,*.js,*.jsx}",
|
|
80
|
+
output: "src/"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
|
|
84
|
+
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
85
|
+
const assetHandler = new CopyAssetsHandler({
|
|
86
|
+
projectDir: projectRoot,
|
|
87
|
+
rootDir: config.workspaceRoot,
|
|
88
|
+
outputDir: outputPath,
|
|
89
|
+
assets: pendingAssets
|
|
90
|
+
});
|
|
91
|
+
await assetHandler.processAllAssetsOnce();
|
|
92
|
+
if (includeSrc === true) {
|
|
93
|
+
writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
|
|
94
|
+
const files = await glob([
|
|
95
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.ts"),
|
|
96
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.tsx"),
|
|
97
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
98
|
+
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
99
|
+
]);
|
|
100
|
+
await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
101
|
+
|
|
102
|
+
${await readFile(file, "utf8")}
|
|
103
|
+
|
|
104
|
+
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
105
|
+
}
|
|
106
|
+
}, "copyAssets");
|
|
107
|
+
|
|
108
|
+
// ../build-tools/src/utilities/generate-package-json.ts
|
|
109
|
+
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
110
|
+
import { Glob } from "glob";
|
|
111
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
112
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
113
|
+
import { readCachedProjectGraph, readProjectsConfigurationFromProjectGraph } from "nx/src/project-graph/project-graph";
|
|
114
|
+
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
115
|
+
const projectGraph = readCachedProjectGraph();
|
|
116
|
+
const projectDependencies = calculateProjectBuildableDependencies(void 0, projectGraph, workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
117
|
+
const localPackages = [];
|
|
118
|
+
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data?.root !== projectRoot && dep.node.data?.root !== workspaceRoot)) {
|
|
119
|
+
const projectNode = project.node;
|
|
120
|
+
if (projectNode.data.root) {
|
|
121
|
+
const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
|
|
122
|
+
if (existsSync(projectPackageJsonPath)) {
|
|
123
|
+
const projectPackageJsonContent = await readFile2(projectPackageJsonPath, "utf8");
|
|
124
|
+
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
125
|
+
if (projectPackageJson.private !== true) {
|
|
126
|
+
localPackages.push(projectPackageJson);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (localPackages.length > 0) {
|
|
132
|
+
writeTrace(`\u{1F4E6} Adding local packages to package.json: ${localPackages.map((p) => p.name).join(", ")}`);
|
|
133
|
+
const projectJsonFile = await readFile2(joinPaths(projectRoot, "project.json"), "utf8");
|
|
134
|
+
const projectJson = JSON.parse(projectJsonFile);
|
|
135
|
+
const projectName2 = projectJson.name;
|
|
136
|
+
const projectConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
137
|
+
if (!projectConfigurations?.projects?.[projectName2]) {
|
|
138
|
+
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.");
|
|
139
|
+
}
|
|
140
|
+
const implicitDependencies = projectConfigurations.projects?.[projectName2].implicitDependencies?.reduce((ret, dep) => {
|
|
141
|
+
if (projectConfigurations.projects?.[dep]) {
|
|
142
|
+
const depPackageJsonPath = joinPaths(workspaceRoot, projectConfigurations.projects[dep].root, "package.json");
|
|
143
|
+
if (existsSync(depPackageJsonPath)) {
|
|
144
|
+
const depPackageJsonContent = readFileSync(depPackageJsonPath, "utf8");
|
|
145
|
+
const depPackageJson = JSON.parse(depPackageJsonContent);
|
|
146
|
+
if (depPackageJson.private !== true && !ret.includes(depPackageJson.name)) {
|
|
147
|
+
ret.push(depPackageJson.name);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return ret;
|
|
152
|
+
}, []);
|
|
153
|
+
packageJson.dependencies = localPackages.reduce((ret, localPackage) => {
|
|
154
|
+
if (!ret[localPackage.name] && !implicitDependencies?.includes(localPackage.name) && packageJson.devDependencies?.[localPackage.name] === void 0) {
|
|
155
|
+
ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
|
|
156
|
+
}
|
|
157
|
+
return ret;
|
|
158
|
+
}, packageJson.dependencies ?? {});
|
|
159
|
+
packageJson.devDependencies = localPackages.reduce((ret, localPackage) => {
|
|
160
|
+
if (!ret[localPackage.name] && implicitDependencies?.includes(localPackage.name) && packageJson.dependencies?.[localPackage.name] === void 0) {
|
|
161
|
+
ret[localPackage.name] = `^${localPackage.version || "0.0.1"}`;
|
|
162
|
+
}
|
|
163
|
+
return ret;
|
|
164
|
+
}, packageJson.devDependencies ?? {});
|
|
165
|
+
} else {
|
|
166
|
+
writeTrace("\u{1F4E6} No local packages dependencies to add to package.json");
|
|
167
|
+
}
|
|
168
|
+
return packageJson;
|
|
169
|
+
}, "addPackageDependencies");
|
|
170
|
+
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (workspaceConfig, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
171
|
+
const workspaceRoot = workspaceConfig.workspaceRoot ? workspaceConfig.workspaceRoot : findWorkspaceRoot();
|
|
172
|
+
const workspacePackageJsonContent = await readFile2(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
173
|
+
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
174
|
+
packageJson.type ??= "module";
|
|
175
|
+
packageJson.sideEffects ??= false;
|
|
176
|
+
if (includeSrc === true) {
|
|
177
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
178
|
+
if (distSrc.startsWith("/")) {
|
|
179
|
+
distSrc = distSrc.substring(1);
|
|
180
|
+
}
|
|
181
|
+
packageJson.source ??= `${joinPaths(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
182
|
+
}
|
|
183
|
+
packageJson.files ??= [
|
|
184
|
+
"dist/**/*"
|
|
185
|
+
];
|
|
186
|
+
if (includeSrc === true && !packageJson.files.includes("src")) {
|
|
187
|
+
packageJson.files.push("src/**/*");
|
|
188
|
+
}
|
|
189
|
+
packageJson.publishConfig ??= {
|
|
190
|
+
access: "public"
|
|
191
|
+
};
|
|
192
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
193
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
194
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
195
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
196
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
197
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
198
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
199
|
+
packageJson.maintainers ??= workspacePackageJson.maintainers;
|
|
200
|
+
if (!packageJson.maintainers && packageJson.author) {
|
|
201
|
+
packageJson.maintainers = [
|
|
202
|
+
packageJson.author
|
|
203
|
+
];
|
|
204
|
+
}
|
|
205
|
+
packageJson.contributors ??= workspacePackageJson.contributors;
|
|
206
|
+
if (!packageJson.contributors && packageJson.author) {
|
|
207
|
+
packageJson.contributors = [
|
|
208
|
+
packageJson.author
|
|
209
|
+
];
|
|
210
|
+
}
|
|
211
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
212
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : joinPaths("packages", projectName);
|
|
213
|
+
return packageJson;
|
|
214
|
+
}, "addWorkspacePackageJsonFields");
|
|
215
|
+
|
|
216
|
+
// ../build-tools/src/utilities/get-entry-points.ts
|
|
217
|
+
import { glob as glob2 } from "glob";
|
|
218
|
+
|
|
219
|
+
// ../build-tools/src/utilities/get-env.ts
|
|
220
|
+
var getEnv = /* @__PURE__ */ __name((builder, options) => {
|
|
221
|
+
return {
|
|
222
|
+
STORM_BUILD: builder,
|
|
223
|
+
STORM_ORG: options.orgName || DEFAULT_ORGANIZATION,
|
|
224
|
+
STORM_NAME: options.name,
|
|
225
|
+
STORM_MODE: options.mode || DEFAULT_ENVIRONMENT,
|
|
226
|
+
STORM_PLATFORM: options.platform,
|
|
227
|
+
STORM_FORMAT: JSON.stringify(options.format),
|
|
228
|
+
STORM_TARGET: JSON.stringify(options.target),
|
|
229
|
+
...options.env
|
|
230
|
+
};
|
|
231
|
+
}, "getEnv");
|
|
232
|
+
|
|
233
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
234
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
235
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
236
|
+
|
|
237
|
+
// ../build-tools/src/utilities/task-graph.ts
|
|
238
|
+
import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-runner/create-task-graph";
|
|
239
|
+
|
|
240
|
+
// ../esbuild/src/build.ts
|
|
241
|
+
import { watch as createWatcher } from "chokidar";
|
|
242
|
+
import defu from "defu";
|
|
243
|
+
import { debounce } from "es-toolkit";
|
|
244
|
+
import * as esbuild from "esbuild";
|
|
245
|
+
import { globbySync } from "globby";
|
|
246
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
247
|
+
import hf from "node:fs/promises";
|
|
248
|
+
import { findWorkspaceRoot as findWorkspaceRoot2 } from "nx/src/utils/find-workspace-root";
|
|
249
|
+
import { build as tsup } from "tsup";
|
|
250
|
+
|
|
251
|
+
// ../esbuild/src/clean.ts
|
|
252
|
+
import { rm } from "node:fs/promises";
|
|
253
|
+
async function cleanDirectories(directory) {
|
|
254
|
+
await rm(directory, {
|
|
255
|
+
recursive: true,
|
|
256
|
+
force: true
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
__name(cleanDirectories, "cleanDirectories");
|
|
260
|
+
|
|
261
|
+
// ../esbuild/src/config.ts
|
|
262
|
+
var DEFAULT_BUILD_OPTIONS = {
|
|
263
|
+
assets: [],
|
|
264
|
+
platform: "node",
|
|
265
|
+
target: [
|
|
266
|
+
"esnext"
|
|
267
|
+
],
|
|
268
|
+
format: "esm",
|
|
269
|
+
tsconfig: "tsconfig.json",
|
|
270
|
+
mode: "production",
|
|
271
|
+
generatePackageJson: true,
|
|
272
|
+
includeSrc: false,
|
|
273
|
+
keepNames: true,
|
|
274
|
+
metafile: false,
|
|
275
|
+
treeshake: true,
|
|
276
|
+
shims: false,
|
|
277
|
+
watch: false,
|
|
278
|
+
bundle: true,
|
|
279
|
+
loader: {
|
|
280
|
+
".aac": "file",
|
|
281
|
+
".css": "file",
|
|
282
|
+
".eot": "file",
|
|
283
|
+
".flac": "file",
|
|
284
|
+
".gif": "file",
|
|
285
|
+
".jpeg": "file",
|
|
286
|
+
".jpg": "file",
|
|
287
|
+
".mp3": "file",
|
|
288
|
+
".mp4": "file",
|
|
289
|
+
".ogg": "file",
|
|
290
|
+
".otf": "file",
|
|
291
|
+
".png": "file",
|
|
292
|
+
".svg": "file",
|
|
293
|
+
".ttf": "file",
|
|
294
|
+
".wav": "file",
|
|
295
|
+
".webm": "file",
|
|
296
|
+
".webp": "file",
|
|
297
|
+
".woff": "file",
|
|
298
|
+
".woff2": "file"
|
|
299
|
+
},
|
|
300
|
+
banner: {
|
|
301
|
+
js: DEFAULT_COMPILED_BANNER,
|
|
302
|
+
css: DEFAULT_COMPILED_BANNER
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
// ../esbuild/src/plugins/deps-check.ts
|
|
307
|
+
import { builtinModules as builtinModules2 } from "node:module";
|
|
308
|
+
import path2 from "node:path";
|
|
309
|
+
var unusedIgnore = [
|
|
310
|
+
// these are our dev dependencies
|
|
311
|
+
/@types\/.*?/,
|
|
312
|
+
/@typescript-eslint.*?/,
|
|
313
|
+
/eslint.*?/,
|
|
314
|
+
"esbuild",
|
|
315
|
+
"husky",
|
|
316
|
+
"is-ci",
|
|
317
|
+
"lint-staged",
|
|
318
|
+
"prettier",
|
|
319
|
+
"typescript",
|
|
320
|
+
"ts-node",
|
|
321
|
+
"ts-jest",
|
|
322
|
+
"@swc/core",
|
|
323
|
+
"@swc/jest",
|
|
324
|
+
"jest",
|
|
325
|
+
// these are missing 3rd party deps
|
|
326
|
+
"spdx-exceptions",
|
|
327
|
+
"spdx-license-ids",
|
|
328
|
+
// type-only, so it is not detected
|
|
329
|
+
"ts-toolbelt",
|
|
330
|
+
// these are indirectly used by build
|
|
331
|
+
"buffer"
|
|
332
|
+
];
|
|
333
|
+
var missingIgnore = [
|
|
334
|
+
".prisma",
|
|
335
|
+
"@prisma/client",
|
|
336
|
+
"ts-toolbelt"
|
|
337
|
+
];
|
|
338
|
+
var depsCheckPlugin = /* @__PURE__ */ __name((bundle) => ({
|
|
339
|
+
name: "storm:deps-check",
|
|
340
|
+
setup(build3) {
|
|
341
|
+
const pkgJsonPath = path2.join(process.cwd(), "package.json");
|
|
342
|
+
const pkgContents = __require(pkgJsonPath);
|
|
343
|
+
const regDependencies = Object.keys(pkgContents["dependencies"] ?? {});
|
|
344
|
+
const devDependencies = Object.keys(pkgContents["devDependencies"] ?? {});
|
|
345
|
+
const peerDependencies = Object.keys(pkgContents["peerDependencies"] ?? {});
|
|
346
|
+
const dependencies = [
|
|
347
|
+
...regDependencies,
|
|
348
|
+
...bundle ? devDependencies : []
|
|
349
|
+
];
|
|
350
|
+
const collectedDependencies = /* @__PURE__ */ new Set();
|
|
351
|
+
const onlyPackages = /^[^./](?!:)|^\.[^./]|^\.\.[^/]/;
|
|
352
|
+
build3.onResolve({
|
|
353
|
+
filter: onlyPackages
|
|
354
|
+
}, (args) => {
|
|
355
|
+
if (args.importer.includes(process.cwd())) {
|
|
356
|
+
if (args.path[0] === "@") {
|
|
357
|
+
const [org, pkg] = args.path.split("/");
|
|
358
|
+
collectedDependencies.add(`${org}/${pkg}`);
|
|
359
|
+
} else {
|
|
360
|
+
const [pkg] = args.path.split("/");
|
|
361
|
+
collectedDependencies.add(pkg);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return {
|
|
365
|
+
external: true
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
build3.onEnd(() => {
|
|
369
|
+
const unusedDependencies = [
|
|
370
|
+
...dependencies
|
|
371
|
+
].filter((dep) => {
|
|
372
|
+
return !collectedDependencies.has(dep) || builtinModules2.includes(dep);
|
|
373
|
+
});
|
|
374
|
+
const missingDependencies = [
|
|
375
|
+
...collectedDependencies
|
|
376
|
+
].filter((dep) => {
|
|
377
|
+
return !dependencies.includes(dep) && !builtinModules2.includes(dep);
|
|
378
|
+
});
|
|
379
|
+
const filteredUnusedDeps = unusedDependencies.filter((dep) => {
|
|
380
|
+
return !unusedIgnore.some((pattern) => dep.match(pattern));
|
|
381
|
+
});
|
|
382
|
+
const filteredMissingDeps = missingDependencies.filter((dep) => {
|
|
383
|
+
return !missingIgnore.some((pattern) => dep.match(pattern)) && !peerDependencies.includes(dep);
|
|
384
|
+
});
|
|
385
|
+
writeWarning(`Unused Dependencies: ${JSON.stringify(filteredUnusedDeps)}`);
|
|
386
|
+
writeError(`Missing Dependencies: ${JSON.stringify(filteredMissingDeps)}`);
|
|
387
|
+
if (filteredMissingDeps.length > 0) {
|
|
388
|
+
throw new Error(`Missing dependencies detected - please install them:
|
|
389
|
+
${JSON.stringify(filteredMissingDeps)}
|
|
390
|
+
`);
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}), "depsCheckPlugin");
|
|
395
|
+
|
|
396
|
+
// ../esbuild/src/build.ts
|
|
397
|
+
async function resolveContext(userOptions) {
|
|
398
|
+
const projectRoot = userOptions.projectRoot;
|
|
399
|
+
const workspaceRoot = findWorkspaceRoot2(projectRoot);
|
|
400
|
+
if (!workspaceRoot) {
|
|
401
|
+
throw new Error("Cannot find Nx workspace root");
|
|
402
|
+
}
|
|
403
|
+
const workspaceConfig = await getWorkspaceConfig(true, {
|
|
404
|
+
workspaceRoot: workspaceRoot.dir
|
|
405
|
+
});
|
|
406
|
+
writeDebug(" \u2699\uFE0F Resolving build options", workspaceConfig);
|
|
407
|
+
const stopwatch = getStopwatch("Build options resolution");
|
|
408
|
+
const projectGraph = await createProjectGraphAsync({
|
|
409
|
+
exitOnError: true
|
|
410
|
+
});
|
|
411
|
+
const projectJsonPath = joinPaths(workspaceRoot.dir, projectRoot, "project.json");
|
|
412
|
+
if (!existsSync3(projectJsonPath)) {
|
|
413
|
+
throw new Error("Cannot find project.json configuration");
|
|
414
|
+
}
|
|
415
|
+
const projectJsonFile = await hf.readFile(projectJsonPath, "utf8");
|
|
416
|
+
const projectJson = JSON.parse(projectJsonFile);
|
|
417
|
+
const projectName = projectJson.name || userOptions.name;
|
|
418
|
+
const projectConfigurations = readProjectsConfigurationFromProjectGraph2(projectGraph);
|
|
419
|
+
if (!projectConfigurations?.projects?.[projectName]) {
|
|
420
|
+
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.");
|
|
421
|
+
}
|
|
422
|
+
const options = defu(userOptions, DEFAULT_BUILD_OPTIONS);
|
|
423
|
+
options.name ??= `${projectName}-${options.format}`;
|
|
424
|
+
options.target ??= DEFAULT_TARGET;
|
|
425
|
+
const packageJsonPath = joinPaths(workspaceRoot.dir, options.projectRoot, "package.json");
|
|
426
|
+
if (!existsSync3(packageJsonPath)) {
|
|
427
|
+
throw new Error("Cannot find package.json configuration");
|
|
428
|
+
}
|
|
429
|
+
const env = getEnv("esbuild", options);
|
|
430
|
+
const resolvedOptions = {
|
|
431
|
+
...options,
|
|
432
|
+
tsconfig: joinPaths(projectRoot, userOptions.tsconfig ? userOptions.tsconfig.replace(projectRoot, "") : "tsconfig.json"),
|
|
433
|
+
distDir: "dist",
|
|
434
|
+
name: projectName,
|
|
435
|
+
metafile: userOptions.mode === "development",
|
|
436
|
+
...userOptions,
|
|
437
|
+
clean: false,
|
|
438
|
+
target: userOptions.target || options.target,
|
|
439
|
+
splitting: options.format === "iife" ? false : options.treeshake === void 0 ? options.splitting : true,
|
|
440
|
+
env,
|
|
441
|
+
define: {
|
|
442
|
+
STORM_FORMAT: JSON.stringify(options.format),
|
|
443
|
+
...options.define,
|
|
444
|
+
...Object.keys(env || {}).reduce((res, key) => {
|
|
445
|
+
const value = JSON.stringify(env[key]);
|
|
446
|
+
const safeKey = key.replaceAll("(", "").replaceAll(")", "");
|
|
447
|
+
return {
|
|
448
|
+
...res,
|
|
449
|
+
[`process.env.${safeKey}`]: value,
|
|
450
|
+
[`import.meta.env.${safeKey}`]: value
|
|
451
|
+
};
|
|
452
|
+
}, {})
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
stopwatch();
|
|
456
|
+
return {
|
|
457
|
+
options: resolvedOptions,
|
|
458
|
+
clean: userOptions.clean !== false,
|
|
459
|
+
workspaceConfig,
|
|
460
|
+
projectConfigurations,
|
|
461
|
+
projectName,
|
|
462
|
+
projectGraph,
|
|
463
|
+
sourceRoot: resolvedOptions.sourceRoot || projectJson.sourceRoot || joinPaths(resolvedOptions.projectRoot, "src"),
|
|
464
|
+
outputPath: resolvedOptions.outputPath || joinPaths(workspaceConfig.workspaceRoot, "dist", resolvedOptions.projectRoot),
|
|
465
|
+
minify: resolvedOptions.minify || resolvedOptions.mode === "production"
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
__name(resolveContext, "resolveContext");
|
|
469
|
+
async function generatePackageJson(context) {
|
|
470
|
+
if (context.options.generatePackageJson !== false && existsSync3(joinPaths(context.options.projectRoot, "package.json"))) {
|
|
471
|
+
writeDebug(" \u270D\uFE0F Writing package.json file", context.workspaceConfig);
|
|
472
|
+
const stopwatch = getStopwatch("Write package.json file");
|
|
473
|
+
const packageJsonPath = joinPaths(context.options.projectRoot, "project.json");
|
|
474
|
+
if (!existsSync3(packageJsonPath)) {
|
|
475
|
+
throw new Error("Cannot find package.json configuration");
|
|
476
|
+
}
|
|
477
|
+
const packageJsonFile = await hf.readFile(joinPaths(context.workspaceConfig.workspaceRoot, context.options.projectRoot, "package.json"), "utf8");
|
|
478
|
+
let packageJson = JSON.parse(packageJsonFile);
|
|
479
|
+
if (!packageJson) {
|
|
480
|
+
throw new Error("Cannot find package.json configuration file");
|
|
481
|
+
}
|
|
482
|
+
packageJson = await addPackageDependencies(context.workspaceConfig.workspaceRoot, context.options.projectRoot, context.projectName, packageJson);
|
|
483
|
+
packageJson = await addWorkspacePackageJsonFields(context.workspaceConfig, context.options.projectRoot, context.sourceRoot, context.projectName, false, packageJson);
|
|
484
|
+
if (context.options.entry) {
|
|
485
|
+
packageJson.exports ??= {};
|
|
486
|
+
packageJson.exports["./package.json"] ??= "./package.json";
|
|
487
|
+
packageJson.exports["."] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js`;
|
|
488
|
+
const entryPoints = Array.isArray(context.options.entry) ? context.options.entry : Object.keys(context.options.entry);
|
|
489
|
+
for (const entryPoint of entryPoints) {
|
|
490
|
+
if (context.options.entry[entryPoint]) {
|
|
491
|
+
const entry = context.options.entry[entryPoint].replaceAll("\\", "/").replaceAll(/^(\.\/)*/g, "").replace(/\.([cm])?[jt]s(x)?$/g, "");
|
|
492
|
+
packageJson.exports[`./${entry}`] ??= `.${context.options.distDir ? `/${context.options.distDir}` : ""}/${entry}.js`;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
if (context.options.format === "esm") {
|
|
496
|
+
packageJson.module = packageJson.type === "module" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.mjs`;
|
|
497
|
+
} else {
|
|
498
|
+
packageJson.main = packageJson.type === "commonjs" ? `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.js` : `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.cjs`;
|
|
499
|
+
}
|
|
500
|
+
packageJson.types = `.${context.options.distDir ? `/${context.options.distDir}` : ""}/index.d.ts`;
|
|
501
|
+
packageJson.exports = Object.keys(packageJson.exports).reduce((ret, key) => {
|
|
502
|
+
if (key.endsWith("/index") && !ret[key.replace("/index", "")]) {
|
|
503
|
+
ret[key.replace("/index", "")] = packageJson.exports[key];
|
|
504
|
+
}
|
|
505
|
+
return ret;
|
|
506
|
+
}, packageJson.exports);
|
|
507
|
+
}
|
|
508
|
+
await writeJsonFile(joinPaths(context.outputPath, "package.json"), packageJson);
|
|
509
|
+
stopwatch();
|
|
510
|
+
}
|
|
511
|
+
return context;
|
|
512
|
+
}
|
|
513
|
+
__name(generatePackageJson, "generatePackageJson");
|
|
514
|
+
async function executeTsup(context) {
|
|
515
|
+
writeDebug(` \u{1F680} Running ${context.options.name} build`, context.workspaceConfig);
|
|
516
|
+
const stopwatch = getStopwatch(`${context.options.name} build`);
|
|
517
|
+
await tsup({
|
|
518
|
+
...context.options,
|
|
519
|
+
outDir: context.outputPath,
|
|
520
|
+
workspaceConfig: context.workspaceConfig
|
|
521
|
+
});
|
|
522
|
+
stopwatch();
|
|
523
|
+
return context;
|
|
524
|
+
}
|
|
525
|
+
__name(executeTsup, "executeTsup");
|
|
526
|
+
async function copyBuildAssets(context) {
|
|
527
|
+
if (context.result?.errors.length === 0) {
|
|
528
|
+
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${context.outputPath}`, context.workspaceConfig);
|
|
529
|
+
const stopwatch = getStopwatch(`${context.options.name} asset copy`);
|
|
530
|
+
await copyAssets(context.workspaceConfig, context.options.assets ?? [], context.outputPath, context.options.projectRoot, context.sourceRoot, true, false);
|
|
531
|
+
stopwatch();
|
|
532
|
+
}
|
|
533
|
+
return context;
|
|
534
|
+
}
|
|
535
|
+
__name(copyBuildAssets, "copyBuildAssets");
|
|
536
|
+
async function reportResults(context) {
|
|
537
|
+
if (context.result?.errors.length === 0) {
|
|
538
|
+
if (context.result.warnings.length > 0) {
|
|
539
|
+
writeWarning(` \u{1F6A7} The following warnings occurred during the build: ${context.result.warnings.map((warning) => warning.text).join("\n")}`, context.workspaceConfig);
|
|
540
|
+
}
|
|
541
|
+
writeSuccess(` \u{1F4E6} The ${context.options.name} build completed successfully`, context.workspaceConfig);
|
|
542
|
+
} else if (context.result?.errors && context.result?.errors.length > 0) {
|
|
543
|
+
writeError(` \u274C The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`, context.workspaceConfig);
|
|
544
|
+
throw new Error(`The ${context.options.name} build failed with the following errors: ${context.result.errors.map((error) => error.text).join("\n")}`);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
__name(reportResults, "reportResults");
|
|
548
|
+
async function dependencyCheck(options) {
|
|
549
|
+
if (process.env.DEV === "true") {
|
|
550
|
+
return void 0;
|
|
551
|
+
}
|
|
552
|
+
if (process.env.CI && !process.env.BUILDKITE) {
|
|
553
|
+
return void 0;
|
|
554
|
+
}
|
|
555
|
+
const buildPromise = esbuild.build({
|
|
556
|
+
entryPoints: globbySync("**/*.{j,t}s", {
|
|
557
|
+
// We don't check dependencies in ecosystem tests because tests are isolated from the build.
|
|
558
|
+
ignore: [
|
|
559
|
+
"./src/__tests__/**/*",
|
|
560
|
+
"./tests/e2e/**/*",
|
|
561
|
+
"./dist/**/*"
|
|
562
|
+
],
|
|
563
|
+
gitignore: true
|
|
564
|
+
}),
|
|
565
|
+
logLevel: "silent",
|
|
566
|
+
bundle: true,
|
|
567
|
+
write: false,
|
|
568
|
+
outdir: "out",
|
|
569
|
+
plugins: [
|
|
570
|
+
depsCheckPlugin(options.bundle)
|
|
571
|
+
]
|
|
572
|
+
});
|
|
573
|
+
await buildPromise.catch(() => {
|
|
574
|
+
});
|
|
575
|
+
return void 0;
|
|
576
|
+
}
|
|
577
|
+
__name(dependencyCheck, "dependencyCheck");
|
|
578
|
+
async function cleanOutputPath(context) {
|
|
579
|
+
if (context.clean !== false && context.outputPath) {
|
|
580
|
+
writeDebug(` \u{1F9F9} Cleaning ${context.options.name} output path: ${context.outputPath}`, context.workspaceConfig);
|
|
581
|
+
const stopwatch = getStopwatch(`${context.options.name} output clean`);
|
|
582
|
+
await cleanDirectories(context.outputPath);
|
|
583
|
+
stopwatch();
|
|
584
|
+
}
|
|
585
|
+
return context;
|
|
586
|
+
}
|
|
587
|
+
__name(cleanOutputPath, "cleanOutputPath");
|
|
588
|
+
async function build2(options) {
|
|
589
|
+
writeDebug(` \u26A1 Executing Storm ESBuild pipeline`);
|
|
590
|
+
const stopwatch = getStopwatch("ESBuild pipeline");
|
|
591
|
+
try {
|
|
592
|
+
const opts = Array.isArray(options) ? options : [
|
|
593
|
+
options
|
|
594
|
+
];
|
|
595
|
+
if (opts.length === 0) {
|
|
596
|
+
throw new Error("No build options were provided");
|
|
597
|
+
}
|
|
598
|
+
const context = await resolveContext(options);
|
|
599
|
+
await cleanOutputPath(context);
|
|
600
|
+
await Promise.all([
|
|
601
|
+
dependencyCheck(context.options),
|
|
602
|
+
generatePackageJson(context),
|
|
603
|
+
copyBuildAssets(context),
|
|
604
|
+
executeTsup(context)
|
|
605
|
+
]);
|
|
606
|
+
await reportResults(context);
|
|
607
|
+
writeSuccess(" \u{1F3C1} ESBuild pipeline build completed successfully");
|
|
608
|
+
} catch (error) {
|
|
609
|
+
writeFatal("Fatal errors that the build process could not recover from have occured. The build process has been terminated.");
|
|
610
|
+
throw error;
|
|
611
|
+
} finally {
|
|
612
|
+
stopwatch();
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
__name(build2, "build");
|
|
616
|
+
|
|
617
|
+
// src/executors/esbuild/executor.ts
|
|
618
|
+
async function esbuildExecutorFn(options, context, config) {
|
|
619
|
+
writeInfo("\u{1F4E6} Running Storm ESBuild executor on the workspace", config);
|
|
620
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
|
|
621
|
+
throw new Error("The Build process failed because the context is not valid. Please run this command from a workspace.");
|
|
622
|
+
}
|
|
623
|
+
await build2({
|
|
624
|
+
...options,
|
|
625
|
+
projectRoot: context.projectsConfigurations.projects?.[context.projectName].root,
|
|
626
|
+
name: context.projectName,
|
|
627
|
+
sourceRoot: context.projectsConfigurations.projects?.[context.projectName]?.sourceRoot,
|
|
628
|
+
format: options.format,
|
|
629
|
+
platform: options.format
|
|
630
|
+
});
|
|
631
|
+
return {
|
|
632
|
+
success: true
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
__name(esbuildExecutorFn, "esbuildExecutorFn");
|
|
636
|
+
var executor_default = withRunExecutor("Storm ESBuild build", esbuildExecutorFn, {
|
|
637
|
+
skipReadingConfig: false,
|
|
638
|
+
hooks: {
|
|
639
|
+
applyDefaultOptions: /* @__PURE__ */ __name(async (options, config) => {
|
|
640
|
+
options.entry ??= [
|
|
641
|
+
"src/index.ts"
|
|
642
|
+
];
|
|
643
|
+
options.outputPath ??= "dist/{projectRoot}";
|
|
644
|
+
options.tsconfig ??= "{projectRoot}/tsconfig.json";
|
|
645
|
+
return options;
|
|
646
|
+
}, "applyDefaultOptions")
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
export {
|
|
651
|
+
esbuildExecutorFn,
|
|
652
|
+
executor_default
|
|
653
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildCargoCommand,
|
|
3
3
|
cargoCommand
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GNFQ5PGW.mjs";
|
|
5
5
|
import {
|
|
6
6
|
withRunExecutor
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2TEC7IFE.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__name
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-N7GSKHH2.mjs";
|
|
11
11
|
|
|
12
12
|
// src/executors/cargo-build/executor.ts
|
|
13
13
|
async function cargoBuildExecutor(options, context) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findWorkspaceRoot
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WDFR6LVR.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-N7GSKHH2.mjs";
|
|
7
7
|
|
|
8
8
|
// src/utils/get-project-configurations.ts
|
|
9
9
|
import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/project-graph/utils/retrieve-workspace-files";
|