@storm-software/unbuild 0.30.6 → 0.31.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 +32 -69
- package/bin/unbuild.js +28 -65
- package/dist/build.cjs +2 -2
- package/dist/build.js +1 -1
- package/dist/{chunk-6K2BOPQA.js → chunk-BZJA6TK2.js} +153 -190
- package/dist/{chunk-2FZRLS3Z.cjs → chunk-N2XPKSKO.cjs} +163 -200
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/package.json +4 -4
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
|
@@ -1180,8 +1180,8 @@ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
|
|
|
1180
1180
|
var import_commander = require("commander");
|
|
1181
1181
|
|
|
1182
1182
|
// src/build.ts
|
|
1183
|
-
var
|
|
1184
|
-
var
|
|
1183
|
+
var import_devkit5 = require("@nx/devkit");
|
|
1184
|
+
var import_js = require("@nx/js");
|
|
1185
1185
|
var import_buildable_libs_utils4 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
1186
1186
|
|
|
1187
1187
|
// ../build-tools/src/plugins/swc.ts
|
|
@@ -1198,38 +1198,18 @@ var import_devkit2 = require("@nx/devkit");
|
|
|
1198
1198
|
var import_path = require("path");
|
|
1199
1199
|
|
|
1200
1200
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
1201
|
-
var
|
|
1202
|
-
var import_js = require("@nx/js");
|
|
1201
|
+
var import_copy_assets_handler = require("@nx/js/src/utils/assets/copy-assets-handler");
|
|
1203
1202
|
var import_glob = require("glob");
|
|
1204
|
-
var import_promises3 = require("fs/promises");
|
|
1205
|
-
|
|
1206
|
-
// ../build-tools/src/utilities/read-nx-config.ts
|
|
1207
|
-
var import_node_fs4 = require("fs");
|
|
1208
1203
|
var import_promises2 = require("fs/promises");
|
|
1209
|
-
var
|
|
1210
|
-
let rootDir = workspaceRoot;
|
|
1211
|
-
if (!rootDir) {
|
|
1212
|
-
const config = await getConfig();
|
|
1213
|
-
rootDir = config.workspaceRoot;
|
|
1214
|
-
}
|
|
1215
|
-
const nxJsonPath = joinPaths(rootDir, "nx.json");
|
|
1216
|
-
if (!(0, import_node_fs4.existsSync)(nxJsonPath)) {
|
|
1217
|
-
throw new Error("Cannot find project.json configuration");
|
|
1218
|
-
}
|
|
1219
|
-
const configContent = await (0, import_promises2.readFile)(nxJsonPath, "utf8");
|
|
1220
|
-
return JSON.parse(configContent);
|
|
1221
|
-
}, "readNxConfig");
|
|
1222
|
-
|
|
1223
|
-
// ../build-tools/src/utilities/copy-assets.ts
|
|
1224
|
-
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1204
|
+
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1225
1205
|
const pendingAssets = Array.from(assets ?? []);
|
|
1226
1206
|
pendingAssets.push({
|
|
1227
|
-
input:
|
|
1207
|
+
input: projectRoot,
|
|
1228
1208
|
glob: "*.md",
|
|
1229
1209
|
output: "."
|
|
1230
1210
|
});
|
|
1231
1211
|
pendingAssets.push({
|
|
1232
|
-
input:
|
|
1212
|
+
input: ".",
|
|
1233
1213
|
glob: "LICENSE",
|
|
1234
1214
|
output: "."
|
|
1235
1215
|
});
|
|
@@ -1247,36 +1227,15 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
1247
1227
|
output: "src/"
|
|
1248
1228
|
});
|
|
1249
1229
|
}
|
|
1250
|
-
const nxJson = readNxConfig(config.workspaceRoot);
|
|
1251
|
-
const projectGraph = (0, import_devkit3.readCachedProjectGraph)();
|
|
1252
|
-
const projectsConfigurations = (0, import_devkit3.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
1253
|
-
if (!projectsConfigurations?.projects?.[projectName]) {
|
|
1254
|
-
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.");
|
|
1255
|
-
}
|
|
1256
|
-
const buildTarget = projectsConfigurations.projects[projectName].targets?.build;
|
|
1257
|
-
if (!buildTarget) {
|
|
1258
|
-
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")}`);
|
|
1259
|
-
}
|
|
1260
1230
|
writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
|
|
1261
1231
|
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
outputPath
|
|
1266
|
-
|
|
1267
|
-
root: config.workspaceRoot,
|
|
1268
|
-
targetName: "build",
|
|
1269
|
-
target: buildTarget,
|
|
1270
|
-
projectName,
|
|
1271
|
-
projectGraph,
|
|
1272
|
-
projectsConfigurations,
|
|
1273
|
-
nxJsonConfiguration: nxJson,
|
|
1274
|
-
cwd: config.workspaceRoot,
|
|
1275
|
-
isVerbose: isVerbose(config.logLevel)
|
|
1232
|
+
const assetHandler = new import_copy_assets_handler.CopyAssetsHandler({
|
|
1233
|
+
projectDir: projectRoot,
|
|
1234
|
+
rootDir: config.workspaceRoot,
|
|
1235
|
+
outputDir: outputPath,
|
|
1236
|
+
assets: pendingAssets
|
|
1276
1237
|
});
|
|
1277
|
-
|
|
1278
|
-
throw new Error("The Build process failed trying to copy assets");
|
|
1279
|
-
}
|
|
1238
|
+
await assetHandler.processAllAssetsOnce();
|
|
1280
1239
|
if (includeSrc === true) {
|
|
1281
1240
|
writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
|
|
1282
1241
|
const files = await (0, import_glob.glob)([
|
|
@@ -1285,9 +1244,9 @@ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${p
|
|
|
1285
1244
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.js"),
|
|
1286
1245
|
joinPaths(config.workspaceRoot, outputPath, "src/**/*.jsx")
|
|
1287
1246
|
]);
|
|
1288
|
-
await Promise.allSettled(files.map(async (file) => (0,
|
|
1247
|
+
await Promise.allSettled(files.map(async (file) => (0, import_promises2.writeFile)(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
1289
1248
|
|
|
1290
|
-
${await (0,
|
|
1249
|
+
${await (0, import_promises2.readFile)(file, "utf8")}
|
|
1291
1250
|
|
|
1292
1251
|
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
1293
1252
|
}
|
|
@@ -1296,8 +1255,8 @@ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `//
|
|
|
1296
1255
|
// ../build-tools/src/utilities/generate-package-json.ts
|
|
1297
1256
|
var import_buildable_libs_utils = require("@nx/js/src/utils/buildable-libs-utils");
|
|
1298
1257
|
var import_glob2 = require("glob");
|
|
1299
|
-
var
|
|
1300
|
-
var
|
|
1258
|
+
var import_node_fs4 = require("fs");
|
|
1259
|
+
var import_promises3 = require("fs/promises");
|
|
1301
1260
|
var import_project_graph = require("nx/src/project-graph/project-graph");
|
|
1302
1261
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
1303
1262
|
const projectDependencies = (0, import_buildable_libs_utils.calculateProjectBuildableDependencies)(void 0, (0, import_project_graph.readCachedProjectGraph)(), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
@@ -1306,8 +1265,8 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
1306
1265
|
const projectNode = project.node;
|
|
1307
1266
|
if (projectNode.data.root) {
|
|
1308
1267
|
const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
|
|
1309
|
-
if ((0,
|
|
1310
|
-
const projectPackageJsonContent = await (0,
|
|
1268
|
+
if ((0, import_node_fs4.existsSync)(projectPackageJsonPath)) {
|
|
1269
|
+
const projectPackageJsonContent = await (0, import_promises3.readFile)(projectPackageJsonPath, "utf8");
|
|
1311
1270
|
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
1312
1271
|
if (projectPackageJson.private !== false) {
|
|
1313
1272
|
localPackages.push(projectPackageJson);
|
|
@@ -1344,7 +1303,7 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
1344
1303
|
}, "addPackageDependencies");
|
|
1345
1304
|
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
1346
1305
|
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
|
|
1347
|
-
const workspacePackageJsonContent = await (0,
|
|
1306
|
+
const workspacePackageJsonContent = await (0, import_promises3.readFile)(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
1348
1307
|
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
1349
1308
|
packageJson.type ??= "module";
|
|
1350
1309
|
packageJson.sideEffects ??= false;
|
|
@@ -1391,6 +1350,10 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projec
|
|
|
1391
1350
|
// ../build-tools/src/utilities/get-entry-points.ts
|
|
1392
1351
|
var import_glob3 = require("glob");
|
|
1393
1352
|
|
|
1353
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
1354
|
+
var import_node_fs5 = require("fs");
|
|
1355
|
+
var import_promises4 = require("fs/promises");
|
|
1356
|
+
|
|
1394
1357
|
// ../build-tools/src/utilities/task-graph.ts
|
|
1395
1358
|
var import_create_task_graph = require("nx/src/tasks-runner/create-task-graph");
|
|
1396
1359
|
|
|
@@ -2897,13 +2860,13 @@ ${error ? error.message : "Unknown build error"}
|
|
|
2897
2860
|
}), "onErrorPlugin");
|
|
2898
2861
|
|
|
2899
2862
|
// src/plugins/tsc.ts
|
|
2900
|
-
var
|
|
2863
|
+
var import_devkit4 = require("@nx/devkit");
|
|
2901
2864
|
var import_buildable_libs_utils3 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
2902
2865
|
var import_compiler_helper_dependency = require("@nx/js/src/utils/compiler-helper-dependency");
|
|
2903
2866
|
var import_rollup_plugin_typescript2 = __toESM(require("rollup-plugin-typescript2"), 1);
|
|
2904
2867
|
|
|
2905
2868
|
// src/utilities/helpers.ts
|
|
2906
|
-
var
|
|
2869
|
+
var import_devkit3 = require("@nx/devkit");
|
|
2907
2870
|
var import_buildable_libs_utils2 = require("@nx/js/src/utils/buildable-libs-utils");
|
|
2908
2871
|
var import_node_path4 = require("path");
|
|
2909
2872
|
var import_node_url = require("url");
|
|
@@ -2916,8 +2879,8 @@ async function loadConfig2(configPath) {
|
|
|
2916
2879
|
}
|
|
2917
2880
|
__name(loadConfig2, "loadConfig");
|
|
2918
2881
|
async function createTsCompilerOptions(config, tsConfigPath, projectRoot, dependencies) {
|
|
2919
|
-
const tsConfigFile = import_typescript.default.readConfigFile((0,
|
|
2920
|
-
const tsConfig = import_typescript.default.parseJsonConfigFileContent(tsConfigFile.config, import_typescript.default.sys, (0, import_node_path4.dirname)((0,
|
|
2882
|
+
const tsConfigFile = import_typescript.default.readConfigFile((0, import_devkit3.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath), import_typescript.default.sys.readFile);
|
|
2883
|
+
const tsConfig = import_typescript.default.parseJsonConfigFileContent(tsConfigFile.config, import_typescript.default.sys, (0, import_node_path4.dirname)((0, import_devkit3.joinPathFragments)(config.workspaceRoot, projectRoot, tsConfigPath)));
|
|
2921
2884
|
const compilerOptions = {
|
|
2922
2885
|
rootDir: projectRoot,
|
|
2923
2886
|
declaration: true,
|
|
@@ -2930,7 +2893,7 @@ __name(createTsCompilerOptions, "createTsCompilerOptions");
|
|
|
2930
2893
|
|
|
2931
2894
|
// src/plugins/tsc.ts
|
|
2932
2895
|
var tscPlugin = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
|
|
2933
|
-
const projectGraph = (0,
|
|
2896
|
+
const projectGraph = (0, import_devkit4.readCachedProjectGraph)();
|
|
2934
2897
|
const result = (0, import_buildable_libs_utils3.calculateProjectBuildableDependencies)(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
2935
2898
|
let dependencies = result.dependencies;
|
|
2936
2899
|
const tsLibDependency = (0, import_compiler_helper_dependency.getHelperDependency)(import_compiler_helper_dependency.HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
|
|
@@ -2997,7 +2960,7 @@ async function resolveOptions(options, config) {
|
|
|
2997
2960
|
}
|
|
2998
2961
|
}
|
|
2999
2962
|
const outputPath = options.outputPath || joinPaths("dist", options.projectRoot);
|
|
3000
|
-
const projectGraph = (0,
|
|
2963
|
+
const projectGraph = (0, import_devkit5.readCachedProjectGraph)();
|
|
3001
2964
|
const projectJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "project.json");
|
|
3002
2965
|
if (!(0, import_node_fs8.existsSync)(projectJsonPath)) {
|
|
3003
2966
|
throw new Error("Cannot find project.json configuration");
|
|
@@ -3027,7 +2990,7 @@ async function resolveOptions(options, config) {
|
|
|
3027
2990
|
}
|
|
3028
2991
|
const result = (0, import_buildable_libs_utils4.calculateProjectBuildableDependencies)(void 0, projectGraph, config.workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
3029
2992
|
let dependencies = result.dependencies;
|
|
3030
|
-
const tsLibDependency = (0,
|
|
2993
|
+
const tsLibDependency = (0, import_js.getHelperDependency)(import_js.HelperDependency.tsc, tsconfig, dependencies, projectGraph, true);
|
|
3031
2994
|
if (tsLibDependency) {
|
|
3032
2995
|
dependencies = dependencies.filter((deps) => deps.name !== tsLibDependency.name);
|
|
3033
2996
|
dependencies.push(tsLibDependency);
|
|
@@ -3246,7 +3209,7 @@ async function generatePackageJson(options) {
|
|
|
3246
3209
|
}, packageJson.exports);
|
|
3247
3210
|
packageJson.exports["./package.json"] ??= "./package.json";
|
|
3248
3211
|
packageJson.exports["."] ??= addPackageJsonExport("index", packageJson.type, options.sourceRoot, options.projectRoot);
|
|
3249
|
-
await (0,
|
|
3212
|
+
await (0, import_devkit5.writeJsonFile)(joinPaths(options.outDir, "package.json"), packageJson);
|
|
3250
3213
|
stopwatch();
|
|
3251
3214
|
}
|
|
3252
3215
|
return options;
|
|
@@ -3274,7 +3237,7 @@ __name(executeUnbuild, "executeUnbuild");
|
|
|
3274
3237
|
async function copyBuildAssets(options) {
|
|
3275
3238
|
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
|
|
3276
3239
|
const stopwatch = getStopwatch(`${options.name} asset copy`);
|
|
3277
|
-
await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.
|
|
3240
|
+
await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.sourceRoot, options.generatePackageJson, options.includeSrc);
|
|
3278
3241
|
stopwatch();
|
|
3279
3242
|
return options;
|
|
3280
3243
|
}
|
package/bin/unbuild.js
CHANGED
|
@@ -1155,7 +1155,7 @@ var getConfig = /* @__PURE__ */ __name((workspaceRoot, skipLogs = false) => {
|
|
|
1155
1155
|
import { Command, Option } from "commander";
|
|
1156
1156
|
|
|
1157
1157
|
// src/build.ts
|
|
1158
|
-
import { readCachedProjectGraph as
|
|
1158
|
+
import { readCachedProjectGraph as readCachedProjectGraph3, writeJsonFile } from "@nx/devkit";
|
|
1159
1159
|
import { getHelperDependency as getHelperDependency2, HelperDependency as HelperDependency2 } from "@nx/js";
|
|
1160
1160
|
import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies3 } from "@nx/js/src/utils/buildable-libs-utils";
|
|
1161
1161
|
|
|
@@ -1173,38 +1173,18 @@ import { stripIndents } from "@nx/devkit";
|
|
|
1173
1173
|
import { relative } from "path";
|
|
1174
1174
|
|
|
1175
1175
|
// ../build-tools/src/utilities/copy-assets.ts
|
|
1176
|
-
import {
|
|
1177
|
-
import { copyAssets as copyAssetsBase } from "@nx/js";
|
|
1176
|
+
import { CopyAssetsHandler } from "@nx/js/src/utils/assets/copy-assets-handler";
|
|
1178
1177
|
import { glob } from "glob";
|
|
1179
|
-
import { readFile as
|
|
1180
|
-
|
|
1181
|
-
// ../build-tools/src/utilities/read-nx-config.ts
|
|
1182
|
-
import { existsSync as existsSync3 } from "node:fs";
|
|
1183
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
1184
|
-
var readNxConfig = /* @__PURE__ */ __name(async (workspaceRoot) => {
|
|
1185
|
-
let rootDir = workspaceRoot;
|
|
1186
|
-
if (!rootDir) {
|
|
1187
|
-
const config = await getConfig();
|
|
1188
|
-
rootDir = config.workspaceRoot;
|
|
1189
|
-
}
|
|
1190
|
-
const nxJsonPath = joinPaths(rootDir, "nx.json");
|
|
1191
|
-
if (!existsSync3(nxJsonPath)) {
|
|
1192
|
-
throw new Error("Cannot find project.json configuration");
|
|
1193
|
-
}
|
|
1194
|
-
const configContent = await readFile2(nxJsonPath, "utf8");
|
|
1195
|
-
return JSON.parse(configContent);
|
|
1196
|
-
}, "readNxConfig");
|
|
1197
|
-
|
|
1198
|
-
// ../build-tools/src/utilities/copy-assets.ts
|
|
1199
|
-
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, projectName, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1178
|
+
import { readFile as readFile2, writeFile } from "node:fs/promises";
|
|
1179
|
+
var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, projectRoot, sourceRoot, generatePackageJson2 = true, includeSrc = false, banner, footer) => {
|
|
1200
1180
|
const pendingAssets = Array.from(assets ?? []);
|
|
1201
1181
|
pendingAssets.push({
|
|
1202
|
-
input:
|
|
1182
|
+
input: projectRoot,
|
|
1203
1183
|
glob: "*.md",
|
|
1204
1184
|
output: "."
|
|
1205
1185
|
});
|
|
1206
1186
|
pendingAssets.push({
|
|
1207
|
-
input:
|
|
1187
|
+
input: ".",
|
|
1208
1188
|
glob: "LICENSE",
|
|
1209
1189
|
output: "."
|
|
1210
1190
|
});
|
|
@@ -1222,36 +1202,15 @@ var copyAssets = /* @__PURE__ */ __name(async (config, assets, outputPath, proje
|
|
|
1222
1202
|
output: "src/"
|
|
1223
1203
|
});
|
|
1224
1204
|
}
|
|
1225
|
-
const nxJson = readNxConfig(config.workspaceRoot);
|
|
1226
|
-
const projectGraph = readCachedProjectGraph();
|
|
1227
|
-
const projectsConfigurations = readProjectsConfigurationFromProjectGraph(projectGraph);
|
|
1228
|
-
if (!projectsConfigurations?.projects?.[projectName]) {
|
|
1229
|
-
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.");
|
|
1230
|
-
}
|
|
1231
|
-
const buildTarget = projectsConfigurations.projects[projectName].targets?.build;
|
|
1232
|
-
if (!buildTarget) {
|
|
1233
|
-
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")}`);
|
|
1234
|
-
}
|
|
1235
1205
|
writeTrace(`\u{1F4DD} Copying the following assets to the output directory:
|
|
1236
1206
|
${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${pendingAsset} -> ${outputPath}` : ` - ${pendingAsset.input}/${pendingAsset.glob} -> ${joinPaths(outputPath, pendingAsset.output)}`).join("\n")}`, config);
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
outputPath
|
|
1241
|
-
|
|
1242
|
-
root: config.workspaceRoot,
|
|
1243
|
-
targetName: "build",
|
|
1244
|
-
target: buildTarget,
|
|
1245
|
-
projectName,
|
|
1246
|
-
projectGraph,
|
|
1247
|
-
projectsConfigurations,
|
|
1248
|
-
nxJsonConfiguration: nxJson,
|
|
1249
|
-
cwd: config.workspaceRoot,
|
|
1250
|
-
isVerbose: isVerbose(config.logLevel)
|
|
1207
|
+
const assetHandler = new CopyAssetsHandler({
|
|
1208
|
+
projectDir: projectRoot,
|
|
1209
|
+
rootDir: config.workspaceRoot,
|
|
1210
|
+
outputDir: outputPath,
|
|
1211
|
+
assets: pendingAssets
|
|
1251
1212
|
});
|
|
1252
|
-
|
|
1253
|
-
throw new Error("The Build process failed trying to copy assets");
|
|
1254
|
-
}
|
|
1213
|
+
await assetHandler.processAllAssetsOnce();
|
|
1255
1214
|
if (includeSrc === true) {
|
|
1256
1215
|
writeDebug(`\u{1F4DD} Adding banner and writing source files: ${joinPaths(outputPath, "src")}`, config);
|
|
1257
1216
|
const files = await glob([
|
|
@@ -1262,7 +1221,7 @@ ${pendingAssets.map((pendingAsset) => typeof pendingAsset === "string" ? ` - ${p
|
|
|
1262
1221
|
]);
|
|
1263
1222
|
await Promise.allSettled(files.map(async (file) => writeFile(file, `${banner && typeof banner === "string" ? banner.startsWith("//") ? banner : `// ${banner}` : ""}
|
|
1264
1223
|
|
|
1265
|
-
${await
|
|
1224
|
+
${await readFile2(file, "utf8")}
|
|
1266
1225
|
|
|
1267
1226
|
${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `// ${footer}` : ""}`)));
|
|
1268
1227
|
}
|
|
@@ -1271,18 +1230,18 @@ ${footer && typeof footer === "string" ? footer.startsWith("//") ? footer : `//
|
|
|
1271
1230
|
// ../build-tools/src/utilities/generate-package-json.ts
|
|
1272
1231
|
import { calculateProjectBuildableDependencies } from "@nx/js/src/utils/buildable-libs-utils";
|
|
1273
1232
|
import { Glob } from "glob";
|
|
1274
|
-
import { existsSync as
|
|
1275
|
-
import { readFile as
|
|
1276
|
-
import { readCachedProjectGraph
|
|
1233
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
1234
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
1235
|
+
import { readCachedProjectGraph } from "nx/src/project-graph/project-graph";
|
|
1277
1236
|
var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projectRoot, projectName, packageJson) => {
|
|
1278
|
-
const projectDependencies = calculateProjectBuildableDependencies(void 0,
|
|
1237
|
+
const projectDependencies = calculateProjectBuildableDependencies(void 0, readCachedProjectGraph(), workspaceRoot, projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
1279
1238
|
const localPackages = [];
|
|
1280
1239
|
for (const project of projectDependencies.dependencies.filter((dep) => dep.node.type === "lib" && dep.node.data.root !== projectRoot && dep.node.data.root !== workspaceRoot)) {
|
|
1281
1240
|
const projectNode = project.node;
|
|
1282
1241
|
if (projectNode.data.root) {
|
|
1283
1242
|
const projectPackageJsonPath = joinPaths(workspaceRoot, projectNode.data.root, "package.json");
|
|
1284
|
-
if (
|
|
1285
|
-
const projectPackageJsonContent = await
|
|
1243
|
+
if (existsSync3(projectPackageJsonPath)) {
|
|
1244
|
+
const projectPackageJsonContent = await readFile3(projectPackageJsonPath, "utf8");
|
|
1286
1245
|
const projectPackageJson = JSON.parse(projectPackageJsonContent);
|
|
1287
1246
|
if (projectPackageJson.private !== false) {
|
|
1288
1247
|
localPackages.push(projectPackageJson);
|
|
@@ -1319,7 +1278,7 @@ var addPackageDependencies = /* @__PURE__ */ __name(async (workspaceRoot, projec
|
|
|
1319
1278
|
}, "addPackageDependencies");
|
|
1320
1279
|
var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projectRoot, sourceRoot, projectName, includeSrc = false, packageJson) => {
|
|
1321
1280
|
const workspaceRoot = config.workspaceRoot ? config.workspaceRoot : findWorkspaceRoot();
|
|
1322
|
-
const workspacePackageJsonContent = await
|
|
1281
|
+
const workspacePackageJsonContent = await readFile3(joinPaths(workspaceRoot, "package.json"), "utf8");
|
|
1323
1282
|
const workspacePackageJson = JSON.parse(workspacePackageJsonContent);
|
|
1324
1283
|
packageJson.type ??= "module";
|
|
1325
1284
|
packageJson.sideEffects ??= false;
|
|
@@ -1366,6 +1325,10 @@ var addWorkspacePackageJsonFields = /* @__PURE__ */ __name(async (config, projec
|
|
|
1366
1325
|
// ../build-tools/src/utilities/get-entry-points.ts
|
|
1367
1326
|
import { glob as glob2 } from "glob";
|
|
1368
1327
|
|
|
1328
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
1329
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
1330
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
1331
|
+
|
|
1369
1332
|
// ../build-tools/src/utilities/task-graph.ts
|
|
1370
1333
|
import { createTaskGraph, mapTargetDefaultsToDependencies } from "nx/src/tasks-runner/create-task-graph";
|
|
1371
1334
|
|
|
@@ -2872,7 +2835,7 @@ ${error ? error.message : "Unknown build error"}
|
|
|
2872
2835
|
}), "onErrorPlugin");
|
|
2873
2836
|
|
|
2874
2837
|
// src/plugins/tsc.ts
|
|
2875
|
-
import { readCachedProjectGraph as
|
|
2838
|
+
import { readCachedProjectGraph as readCachedProjectGraph2 } from "@nx/devkit";
|
|
2876
2839
|
import { calculateProjectBuildableDependencies as calculateProjectBuildableDependencies2 } from "@nx/js/src/utils/buildable-libs-utils";
|
|
2877
2840
|
import { getHelperDependency, HelperDependency } from "@nx/js/src/utils/compiler-helper-dependency";
|
|
2878
2841
|
import ts2Plugin from "rollup-plugin-typescript2";
|
|
@@ -2905,7 +2868,7 @@ __name(createTsCompilerOptions, "createTsCompilerOptions");
|
|
|
2905
2868
|
|
|
2906
2869
|
// src/plugins/tsc.ts
|
|
2907
2870
|
var tscPlugin = /* @__PURE__ */ __name(async (options, resolvedOptions) => {
|
|
2908
|
-
const projectGraph =
|
|
2871
|
+
const projectGraph = readCachedProjectGraph2();
|
|
2909
2872
|
const result = calculateProjectBuildableDependencies2(void 0, projectGraph, resolvedOptions.config.workspaceRoot, resolvedOptions.projectName, process.env.NX_TASK_TARGET_TARGET || "build", process.env.NX_TASK_TARGET_CONFIGURATION || "production", true);
|
|
2910
2873
|
let dependencies = result.dependencies;
|
|
2911
2874
|
const tsLibDependency = getHelperDependency(HelperDependency.tsc, resolvedOptions.tsconfig, dependencies, projectGraph, true);
|
|
@@ -2972,7 +2935,7 @@ async function resolveOptions(options, config) {
|
|
|
2972
2935
|
}
|
|
2973
2936
|
}
|
|
2974
2937
|
const outputPath = options.outputPath || joinPaths("dist", options.projectRoot);
|
|
2975
|
-
const projectGraph =
|
|
2938
|
+
const projectGraph = readCachedProjectGraph3();
|
|
2976
2939
|
const projectJsonPath = joinPaths(config.workspaceRoot, options.projectRoot, "project.json");
|
|
2977
2940
|
if (!existsSync6(projectJsonPath)) {
|
|
2978
2941
|
throw new Error("Cannot find project.json configuration");
|
|
@@ -3249,7 +3212,7 @@ __name(executeUnbuild, "executeUnbuild");
|
|
|
3249
3212
|
async function copyBuildAssets(options) {
|
|
3250
3213
|
writeDebug(` \u{1F4CB} Copying asset files to output directory: ${options.outDir}`, options.config);
|
|
3251
3214
|
const stopwatch = getStopwatch(`${options.name} asset copy`);
|
|
3252
|
-
await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.
|
|
3215
|
+
await copyAssets(options.config, options.assets ?? [], options.outDir, options.projectRoot, options.sourceRoot, options.generatePackageJson, options.includeSrc);
|
|
3253
3216
|
stopwatch();
|
|
3254
3217
|
return options;
|
|
3255
3218
|
}
|
package/dist/build.cjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkN2XPKSKOcjs = require('./chunk-N2XPKSKO.cjs');
|
|
9
9
|
require('./chunk-CUQLNBV5.cjs');
|
|
10
10
|
require('./chunk-O45RUFL3.cjs');
|
|
11
11
|
require('./chunk-26OHEX55.cjs');
|
|
@@ -21,4 +21,4 @@ require('./chunk-YDYGZTJK.cjs');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
exports.build =
|
|
24
|
+
exports.build = _chunkN2XPKSKOcjs.build; exports.cleanOutputPath = _chunkN2XPKSKOcjs.cleanOutputPath; exports.copyBuildAssets = _chunkN2XPKSKOcjs.copyBuildAssets; exports.executeUnbuild = _chunkN2XPKSKOcjs.executeUnbuild; exports.generatePackageJson = _chunkN2XPKSKOcjs.generatePackageJson; exports.resolveOptions = _chunkN2XPKSKOcjs.resolveOptions;
|