@storm-software/workspace-tools 1.41.1 → 1.42.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/config/nx.json +10 -15
- package/index.js +56 -38
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/base/index.js +3 -1
- package/src/executors/design-tokens/executor.js +3 -1
- package/src/executors/tsup/executor.js +83944 -83923
- package/src/executors/tsup-browser/executor.js +53 -33
- package/src/executors/tsup-neutral/executor.js +52 -33
- package/src/executors/tsup-node/executor.js +54 -34
- package/src/generators/browser-library/generator.js +3 -1
- package/src/generators/config-schema/generator.js +3 -1
- package/src/generators/neutral-library/generator.js +3 -1
- package/src/generators/node-library/generator.js +3 -1
- package/src/generators/preset/files/biome.json +4 -0
- package/src/generators/preset/files/lefthook.json +6 -0
- package/src/generators/preset/generator.js +3 -1
- package/src/generators/preset/files/.husky/post-checkout +0 -5
- package/src/generators/preset/files/.husky/post-commit +0 -4
- package/src/generators/preset/files/.husky/post-merge +0 -5
- package/src/generators/preset/files/.husky/pre-commit +0 -4
- package/src/generators/preset/files/.husky/pre-push +0 -4
- package/src/generators/preset/files/eslint.config.js +0 -59
|
@@ -127844,7 +127844,9 @@ var getConfigFile = async (filePath) => {
|
|
|
127844
127844
|
return void 0;
|
|
127845
127845
|
}
|
|
127846
127846
|
const config = cosmiconfigResult.config ?? {};
|
|
127847
|
-
|
|
127847
|
+
if (cosmiconfigResult.filepath) {
|
|
127848
|
+
config.configFile = cosmiconfigResult.filepath;
|
|
127849
|
+
}
|
|
127848
127850
|
config.runtimeVersion = "0.0.1";
|
|
127849
127851
|
_static_cache = config;
|
|
127850
127852
|
return config;
|
|
@@ -132045,6 +132047,8 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
132045
132047
|
};
|
|
132046
132048
|
|
|
132047
132049
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
132050
|
+
var import_fs4 = require("fs");
|
|
132051
|
+
var import_path4 = require("path");
|
|
132048
132052
|
var import_esbuild_decorators = __toESM(require_src());
|
|
132049
132053
|
var import_devkit2 = __toESM(require_devkit());
|
|
132050
132054
|
var import_js = __toESM(require_src2());
|
|
@@ -132093,7 +132097,6 @@ var environmentPlugin = (data) => ({
|
|
|
132093
132097
|
});
|
|
132094
132098
|
|
|
132095
132099
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
132096
|
-
var import_fs4 = require("fs");
|
|
132097
132100
|
var import_fs_extra = __toESM(require_lib6());
|
|
132098
132101
|
var import_promises2 = require("fs/promises");
|
|
132099
132102
|
|
|
@@ -138273,7 +138276,6 @@ glob.glob = glob;
|
|
|
138273
138276
|
|
|
138274
138277
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
138275
138278
|
var import_fileutils = require("nx/src/utils/fileutils");
|
|
138276
|
-
var import_path4 = require("path");
|
|
138277
138279
|
var import_prettier = require("prettier");
|
|
138278
138280
|
var import_tsup = __toESM(require_dist6());
|
|
138279
138281
|
var ts = __toESM(require("typescript"));
|
|
@@ -138410,10 +138412,10 @@ var import_transform = __toESM(require_transform());
|
|
|
138410
138412
|
var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(program, {}, { addDiagnostic: (input) => diagnostics.push(input) });
|
|
138411
138413
|
|
|
138412
138414
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
138413
|
-
async function tsupExecutorFn(options, context) {
|
|
138415
|
+
async function tsupExecutorFn(options, context, config) {
|
|
138414
138416
|
try {
|
|
138415
138417
|
console.log("\u{1F4E6} Running Storm build executor on the workspace");
|
|
138416
|
-
|
|
138418
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.log(
|
|
138417
138419
|
`\u2699\uFE0F Executor options:
|
|
138418
138420
|
${Object.keys(options).map(
|
|
138419
138421
|
(key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
|
|
@@ -138429,7 +138431,9 @@ ${Object.keys(options).map(
|
|
|
138429
138431
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
138430
138432
|
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
138431
138433
|
if (options.clean !== false) {
|
|
138432
|
-
|
|
138434
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138435
|
+
console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
138436
|
+
}
|
|
138433
138437
|
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
138434
138438
|
}
|
|
138435
138439
|
const assets = Array.from(options.assets);
|
|
@@ -138498,11 +138502,15 @@ ${Object.keys(options).map(
|
|
|
138498
138502
|
const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
|
|
138499
138503
|
const internalDependencies = [];
|
|
138500
138504
|
const projectConfigs = await Promise.resolve(getProjectConfigurations());
|
|
138501
|
-
|
|
138502
|
-
|
|
138505
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138506
|
+
console.log("Project Configs:");
|
|
138507
|
+
console.log(projectConfigs);
|
|
138508
|
+
}
|
|
138503
138509
|
if (implicitDependencies && implicitDependencies.length > 0) {
|
|
138504
138510
|
options.external = implicitDependencies.reduce((ret, key) => {
|
|
138505
|
-
|
|
138511
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138512
|
+
console.log(`\u26A1 Adding implicit dependency: ${key}`);
|
|
138513
|
+
}
|
|
138506
138514
|
const projectConfig = projectConfigs[key];
|
|
138507
138515
|
if (projectConfig?.targets?.build) {
|
|
138508
138516
|
const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
|
|
@@ -138528,10 +138536,12 @@ ${Object.keys(options).map(
|
|
|
138528
138536
|
}
|
|
138529
138537
|
}
|
|
138530
138538
|
}
|
|
138531
|
-
|
|
138539
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138540
|
+
console.log(`Building with the following dependencies marked as external:
|
|
138532
138541
|
${externalDependencies.map((dep) => {
|
|
138533
|
-
|
|
138534
|
-
|
|
138542
|
+
return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
|
|
138543
|
+
}).join("\n")}`);
|
|
138544
|
+
}
|
|
138535
138545
|
const prettierOptions = {
|
|
138536
138546
|
plugins: ["prettier-plugin-packagejson"],
|
|
138537
138547
|
trailingComma: "none",
|
|
@@ -138568,12 +138578,14 @@ ${externalDependencies.map((dep) => {
|
|
|
138568
138578
|
while (propertyKey.startsWith("/")) {
|
|
138569
138579
|
propertyKey = propertyKey.substring(1);
|
|
138570
138580
|
}
|
|
138571
|
-
|
|
138572
|
-
|
|
138573
|
-
|
|
138574
|
-
|
|
138575
|
-
|
|
138576
|
-
|
|
138581
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138582
|
+
console.debug(
|
|
138583
|
+
`Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
|
|
138584
|
+
filePath.path,
|
|
138585
|
+
filePath.name
|
|
138586
|
+
)}"`
|
|
138587
|
+
);
|
|
138588
|
+
}
|
|
138577
138589
|
if (!(propertyKey in ret)) {
|
|
138578
138590
|
ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
|
|
138579
138591
|
}
|
|
@@ -138689,7 +138701,9 @@ ${externalDependencies.map((dep) => {
|
|
|
138689
138701
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
138690
138702
|
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
138691
138703
|
const packageJsonPath = (0, import_path4.join)(context.root, options.outputPath, "package.json");
|
|
138692
|
-
|
|
138704
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138705
|
+
console.debug(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
138706
|
+
}
|
|
138693
138707
|
(0, import_fs4.writeFileSync)(
|
|
138694
138708
|
packageJsonPath,
|
|
138695
138709
|
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
@@ -138776,21 +138790,26 @@ ${options.banner}
|
|
|
138776
138790
|
getTransform: options.skipTypia ? void 0 : getTypiaTransform
|
|
138777
138791
|
};
|
|
138778
138792
|
if (options.getConfig) {
|
|
138793
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
|
|
138794
|
+
console.log("\u26A1 Running the Build process");
|
|
138795
|
+
}
|
|
138779
138796
|
const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
|
|
138780
|
-
const
|
|
138797
|
+
const tsupConfig = (0, import_tsup.defineConfig)(
|
|
138781
138798
|
getConfigFns.map(
|
|
138782
138799
|
(getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
|
|
138783
138800
|
)
|
|
138784
138801
|
);
|
|
138785
|
-
if (_isFunction(
|
|
138786
|
-
await build(await Promise.resolve(
|
|
138802
|
+
if (_isFunction(tsupConfig)) {
|
|
138803
|
+
await build(await Promise.resolve(tsupConfig({})), config);
|
|
138787
138804
|
} else {
|
|
138788
|
-
await build(config);
|
|
138805
|
+
await build(tsupConfig, config);
|
|
138789
138806
|
}
|
|
138790
|
-
} else {
|
|
138791
|
-
console.
|
|
138807
|
+
} else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
|
|
138808
|
+
console.warn("The Build process did not run because no `getConfig` parameter was provided");
|
|
138809
|
+
}
|
|
138810
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
|
|
138811
|
+
console.log("\u26A1 The Build process has completed successfully");
|
|
138792
138812
|
}
|
|
138793
|
-
console.log("\u26A1 The Build process has completed successfully");
|
|
138794
138813
|
return {
|
|
138795
138814
|
success: true
|
|
138796
138815
|
};
|
|
@@ -138831,12 +138850,14 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
138831
138850
|
}
|
|
138832
138851
|
return tsConfig;
|
|
138833
138852
|
}
|
|
138834
|
-
var build = async (options) => {
|
|
138853
|
+
var build = async (options, config) => {
|
|
138835
138854
|
try {
|
|
138836
|
-
Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
|
|
138837
138855
|
if (Array.isArray(options)) {
|
|
138838
|
-
await Promise.all(options.map((buildOptions) => (
|
|
138856
|
+
await Promise.all(options.map((buildOptions) => build(buildOptions, config)));
|
|
138839
138857
|
} else {
|
|
138858
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE && !options.silent) {
|
|
138859
|
+
console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
|
|
138860
|
+
}
|
|
138840
138861
|
await (0, import_tsup.build)(options);
|
|
138841
138862
|
}
|
|
138842
138863
|
} catch (e) {
|
|
@@ -139068,9 +139089,7 @@ var tsupBrowserBuildExecutorFn = (options, context, config) => {
|
|
|
139068
139089
|
},
|
|
139069
139090
|
platform: "browser",
|
|
139070
139091
|
banner: getFileBanner(
|
|
139071
|
-
context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map(
|
|
139072
|
-
(s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : ""
|
|
139073
|
-
).join(" ") : "TypeScript (Browser Platforms)"
|
|
139092
|
+
context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map((s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : "").join(" ") : "TypeScript (Browser Platforms)"
|
|
139074
139093
|
),
|
|
139075
139094
|
define: {
|
|
139076
139095
|
...options.define
|
|
@@ -139079,7 +139098,8 @@ var tsupBrowserBuildExecutorFn = (options, context, config) => {
|
|
|
139079
139098
|
...process.env
|
|
139080
139099
|
}
|
|
139081
139100
|
},
|
|
139082
|
-
context
|
|
139101
|
+
context,
|
|
139102
|
+
config
|
|
139083
139103
|
);
|
|
139084
139104
|
};
|
|
139085
139105
|
var applyDefaultOptions2 = (options) => {
|
|
@@ -127844,7 +127844,9 @@ var getConfigFile = async (filePath) => {
|
|
|
127844
127844
|
return void 0;
|
|
127845
127845
|
}
|
|
127846
127846
|
const config = cosmiconfigResult.config ?? {};
|
|
127847
|
-
|
|
127847
|
+
if (cosmiconfigResult.filepath) {
|
|
127848
|
+
config.configFile = cosmiconfigResult.filepath;
|
|
127849
|
+
}
|
|
127848
127850
|
config.runtimeVersion = "0.0.1";
|
|
127849
127851
|
_static_cache = config;
|
|
127850
127852
|
return config;
|
|
@@ -132045,6 +132047,8 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
132045
132047
|
};
|
|
132046
132048
|
|
|
132047
132049
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
132050
|
+
var import_fs4 = require("fs");
|
|
132051
|
+
var import_path4 = require("path");
|
|
132048
132052
|
var import_esbuild_decorators = __toESM(require_src());
|
|
132049
132053
|
var import_devkit2 = __toESM(require_devkit());
|
|
132050
132054
|
var import_js = __toESM(require_src2());
|
|
@@ -132093,7 +132097,6 @@ var environmentPlugin = (data) => ({
|
|
|
132093
132097
|
});
|
|
132094
132098
|
|
|
132095
132099
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
132096
|
-
var import_fs4 = require("fs");
|
|
132097
132100
|
var import_fs_extra = __toESM(require_lib6());
|
|
132098
132101
|
var import_promises2 = require("fs/promises");
|
|
132099
132102
|
|
|
@@ -138273,7 +138276,6 @@ glob.glob = glob;
|
|
|
138273
138276
|
|
|
138274
138277
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
138275
138278
|
var import_fileutils = require("nx/src/utils/fileutils");
|
|
138276
|
-
var import_path4 = require("path");
|
|
138277
138279
|
var import_prettier = require("prettier");
|
|
138278
138280
|
var import_tsup = __toESM(require_dist6());
|
|
138279
138281
|
var ts = __toESM(require("typescript"));
|
|
@@ -138410,10 +138412,10 @@ var import_transform = __toESM(require_transform());
|
|
|
138410
138412
|
var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(program, {}, { addDiagnostic: (input) => diagnostics.push(input) });
|
|
138411
138413
|
|
|
138412
138414
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
138413
|
-
async function tsupExecutorFn(options, context) {
|
|
138415
|
+
async function tsupExecutorFn(options, context, config) {
|
|
138414
138416
|
try {
|
|
138415
138417
|
console.log("\u{1F4E6} Running Storm build executor on the workspace");
|
|
138416
|
-
|
|
138418
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.log(
|
|
138417
138419
|
`\u2699\uFE0F Executor options:
|
|
138418
138420
|
${Object.keys(options).map(
|
|
138419
138421
|
(key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
|
|
@@ -138429,7 +138431,9 @@ ${Object.keys(options).map(
|
|
|
138429
138431
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
138430
138432
|
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
138431
138433
|
if (options.clean !== false) {
|
|
138432
|
-
|
|
138434
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138435
|
+
console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
138436
|
+
}
|
|
138433
138437
|
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
138434
138438
|
}
|
|
138435
138439
|
const assets = Array.from(options.assets);
|
|
@@ -138498,11 +138502,15 @@ ${Object.keys(options).map(
|
|
|
138498
138502
|
const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
|
|
138499
138503
|
const internalDependencies = [];
|
|
138500
138504
|
const projectConfigs = await Promise.resolve(getProjectConfigurations());
|
|
138501
|
-
|
|
138502
|
-
|
|
138505
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138506
|
+
console.log("Project Configs:");
|
|
138507
|
+
console.log(projectConfigs);
|
|
138508
|
+
}
|
|
138503
138509
|
if (implicitDependencies && implicitDependencies.length > 0) {
|
|
138504
138510
|
options.external = implicitDependencies.reduce((ret, key) => {
|
|
138505
|
-
|
|
138511
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138512
|
+
console.log(`\u26A1 Adding implicit dependency: ${key}`);
|
|
138513
|
+
}
|
|
138506
138514
|
const projectConfig = projectConfigs[key];
|
|
138507
138515
|
if (projectConfig?.targets?.build) {
|
|
138508
138516
|
const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
|
|
@@ -138528,10 +138536,12 @@ ${Object.keys(options).map(
|
|
|
138528
138536
|
}
|
|
138529
138537
|
}
|
|
138530
138538
|
}
|
|
138531
|
-
|
|
138539
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138540
|
+
console.log(`Building with the following dependencies marked as external:
|
|
138532
138541
|
${externalDependencies.map((dep) => {
|
|
138533
|
-
|
|
138534
|
-
|
|
138542
|
+
return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
|
|
138543
|
+
}).join("\n")}`);
|
|
138544
|
+
}
|
|
138535
138545
|
const prettierOptions = {
|
|
138536
138546
|
plugins: ["prettier-plugin-packagejson"],
|
|
138537
138547
|
trailingComma: "none",
|
|
@@ -138568,12 +138578,14 @@ ${externalDependencies.map((dep) => {
|
|
|
138568
138578
|
while (propertyKey.startsWith("/")) {
|
|
138569
138579
|
propertyKey = propertyKey.substring(1);
|
|
138570
138580
|
}
|
|
138571
|
-
|
|
138572
|
-
|
|
138573
|
-
|
|
138574
|
-
|
|
138575
|
-
|
|
138576
|
-
|
|
138581
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138582
|
+
console.debug(
|
|
138583
|
+
`Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
|
|
138584
|
+
filePath.path,
|
|
138585
|
+
filePath.name
|
|
138586
|
+
)}"`
|
|
138587
|
+
);
|
|
138588
|
+
}
|
|
138577
138589
|
if (!(propertyKey in ret)) {
|
|
138578
138590
|
ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
|
|
138579
138591
|
}
|
|
@@ -138689,7 +138701,9 @@ ${externalDependencies.map((dep) => {
|
|
|
138689
138701
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
138690
138702
|
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
138691
138703
|
const packageJsonPath = (0, import_path4.join)(context.root, options.outputPath, "package.json");
|
|
138692
|
-
|
|
138704
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138705
|
+
console.debug(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
138706
|
+
}
|
|
138693
138707
|
(0, import_fs4.writeFileSync)(
|
|
138694
138708
|
packageJsonPath,
|
|
138695
138709
|
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
@@ -138776,21 +138790,26 @@ ${options.banner}
|
|
|
138776
138790
|
getTransform: options.skipTypia ? void 0 : getTypiaTransform
|
|
138777
138791
|
};
|
|
138778
138792
|
if (options.getConfig) {
|
|
138793
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
|
|
138794
|
+
console.log("\u26A1 Running the Build process");
|
|
138795
|
+
}
|
|
138779
138796
|
const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
|
|
138780
|
-
const
|
|
138797
|
+
const tsupConfig = (0, import_tsup.defineConfig)(
|
|
138781
138798
|
getConfigFns.map(
|
|
138782
138799
|
(getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
|
|
138783
138800
|
)
|
|
138784
138801
|
);
|
|
138785
|
-
if (_isFunction(
|
|
138786
|
-
await build(await Promise.resolve(
|
|
138802
|
+
if (_isFunction(tsupConfig)) {
|
|
138803
|
+
await build(await Promise.resolve(tsupConfig({})), config);
|
|
138787
138804
|
} else {
|
|
138788
|
-
await build(config);
|
|
138805
|
+
await build(tsupConfig, config);
|
|
138789
138806
|
}
|
|
138790
|
-
} else {
|
|
138791
|
-
console.
|
|
138807
|
+
} else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
|
|
138808
|
+
console.warn("The Build process did not run because no `getConfig` parameter was provided");
|
|
138809
|
+
}
|
|
138810
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
|
|
138811
|
+
console.log("\u26A1 The Build process has completed successfully");
|
|
138792
138812
|
}
|
|
138793
|
-
console.log("\u26A1 The Build process has completed successfully");
|
|
138794
138813
|
return {
|
|
138795
138814
|
success: true
|
|
138796
138815
|
};
|
|
@@ -138831,12 +138850,14 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
138831
138850
|
}
|
|
138832
138851
|
return tsConfig;
|
|
138833
138852
|
}
|
|
138834
|
-
var build = async (options) => {
|
|
138853
|
+
var build = async (options, config) => {
|
|
138835
138854
|
try {
|
|
138836
|
-
Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
|
|
138837
138855
|
if (Array.isArray(options)) {
|
|
138838
|
-
await Promise.all(options.map((buildOptions) => (
|
|
138856
|
+
await Promise.all(options.map((buildOptions) => build(buildOptions, config)));
|
|
138839
138857
|
} else {
|
|
138858
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE && !options.silent) {
|
|
138859
|
+
console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
|
|
138860
|
+
}
|
|
138840
138861
|
await (0, import_tsup.build)(options);
|
|
138841
138862
|
}
|
|
138842
138863
|
} catch (e) {
|
|
@@ -138985,13 +139006,11 @@ var tsupNeutralBuildExecutorFn = (options, context, config) => {
|
|
|
138985
139006
|
{
|
|
138986
139007
|
...options,
|
|
138987
139008
|
getConfig: {
|
|
138988
|
-
|
|
139009
|
+
dist: neutralConfig
|
|
138989
139010
|
},
|
|
138990
139011
|
platform: "neutral",
|
|
138991
139012
|
banner: getFileBanner(
|
|
138992
|
-
context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map(
|
|
138993
|
-
(s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : ""
|
|
138994
|
-
).join(" ") : "TypeScript (Neutral Platform)"
|
|
139013
|
+
context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map((s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : "").join(" ") : "TypeScript (Neutral Platform)"
|
|
138995
139014
|
),
|
|
138996
139015
|
define: {
|
|
138997
139016
|
...options.define
|
|
@@ -127844,7 +127844,9 @@ var getConfigFile = async (filePath) => {
|
|
|
127844
127844
|
return void 0;
|
|
127845
127845
|
}
|
|
127846
127846
|
const config = cosmiconfigResult.config ?? {};
|
|
127847
|
-
|
|
127847
|
+
if (cosmiconfigResult.filepath) {
|
|
127848
|
+
config.configFile = cosmiconfigResult.filepath;
|
|
127849
|
+
}
|
|
127848
127850
|
config.runtimeVersion = "0.0.1";
|
|
127849
127851
|
_static_cache = config;
|
|
127850
127852
|
return config;
|
|
@@ -132045,6 +132047,8 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
132045
132047
|
};
|
|
132046
132048
|
|
|
132047
132049
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
132050
|
+
var import_fs4 = require("fs");
|
|
132051
|
+
var import_path4 = require("path");
|
|
132048
132052
|
var import_esbuild_decorators = __toESM(require_src());
|
|
132049
132053
|
var import_devkit2 = __toESM(require_devkit());
|
|
132050
132054
|
var import_js = __toESM(require_src2());
|
|
@@ -132093,7 +132097,6 @@ var environmentPlugin = (data) => ({
|
|
|
132093
132097
|
});
|
|
132094
132098
|
|
|
132095
132099
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
132096
|
-
var import_fs4 = require("fs");
|
|
132097
132100
|
var import_fs_extra = __toESM(require_lib6());
|
|
132098
132101
|
var import_promises2 = require("fs/promises");
|
|
132099
132102
|
|
|
@@ -138273,7 +138276,6 @@ glob.glob = glob;
|
|
|
138273
138276
|
|
|
138274
138277
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
138275
138278
|
var import_fileutils = require("nx/src/utils/fileutils");
|
|
138276
|
-
var import_path4 = require("path");
|
|
138277
138279
|
var import_prettier = require("prettier");
|
|
138278
138280
|
var import_tsup = __toESM(require_dist6());
|
|
138279
138281
|
var ts = __toESM(require("typescript"));
|
|
@@ -138410,10 +138412,10 @@ var import_transform = __toESM(require_transform());
|
|
|
138410
138412
|
var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(program, {}, { addDiagnostic: (input) => diagnostics.push(input) });
|
|
138411
138413
|
|
|
138412
138414
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
138413
|
-
async function tsupExecutorFn(options, context) {
|
|
138415
|
+
async function tsupExecutorFn(options, context, config) {
|
|
138414
138416
|
try {
|
|
138415
138417
|
console.log("\u{1F4E6} Running Storm build executor on the workspace");
|
|
138416
|
-
|
|
138418
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.log(
|
|
138417
138419
|
`\u2699\uFE0F Executor options:
|
|
138418
138420
|
${Object.keys(options).map(
|
|
138419
138421
|
(key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
|
|
@@ -138429,7 +138431,9 @@ ${Object.keys(options).map(
|
|
|
138429
138431
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
138430
138432
|
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
138431
138433
|
if (options.clean !== false) {
|
|
138432
|
-
|
|
138434
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138435
|
+
console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
138436
|
+
}
|
|
138433
138437
|
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
138434
138438
|
}
|
|
138435
138439
|
const assets = Array.from(options.assets);
|
|
@@ -138498,11 +138502,15 @@ ${Object.keys(options).map(
|
|
|
138498
138502
|
const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
|
|
138499
138503
|
const internalDependencies = [];
|
|
138500
138504
|
const projectConfigs = await Promise.resolve(getProjectConfigurations());
|
|
138501
|
-
|
|
138502
|
-
|
|
138505
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138506
|
+
console.log("Project Configs:");
|
|
138507
|
+
console.log(projectConfigs);
|
|
138508
|
+
}
|
|
138503
138509
|
if (implicitDependencies && implicitDependencies.length > 0) {
|
|
138504
138510
|
options.external = implicitDependencies.reduce((ret, key) => {
|
|
138505
|
-
|
|
138511
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138512
|
+
console.log(`\u26A1 Adding implicit dependency: ${key}`);
|
|
138513
|
+
}
|
|
138506
138514
|
const projectConfig = projectConfigs[key];
|
|
138507
138515
|
if (projectConfig?.targets?.build) {
|
|
138508
138516
|
const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
|
|
@@ -138528,10 +138536,12 @@ ${Object.keys(options).map(
|
|
|
138528
138536
|
}
|
|
138529
138537
|
}
|
|
138530
138538
|
}
|
|
138531
|
-
|
|
138539
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138540
|
+
console.log(`Building with the following dependencies marked as external:
|
|
138532
138541
|
${externalDependencies.map((dep) => {
|
|
138533
|
-
|
|
138534
|
-
|
|
138542
|
+
return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
|
|
138543
|
+
}).join("\n")}`);
|
|
138544
|
+
}
|
|
138535
138545
|
const prettierOptions = {
|
|
138536
138546
|
plugins: ["prettier-plugin-packagejson"],
|
|
138537
138547
|
trailingComma: "none",
|
|
@@ -138568,12 +138578,14 @@ ${externalDependencies.map((dep) => {
|
|
|
138568
138578
|
while (propertyKey.startsWith("/")) {
|
|
138569
138579
|
propertyKey = propertyKey.substring(1);
|
|
138570
138580
|
}
|
|
138571
|
-
|
|
138572
|
-
|
|
138573
|
-
|
|
138574
|
-
|
|
138575
|
-
|
|
138576
|
-
|
|
138581
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138582
|
+
console.debug(
|
|
138583
|
+
`Trying to add entry point ${propertyKey} at "${(0, import_devkit2.joinPathFragments)(
|
|
138584
|
+
filePath.path,
|
|
138585
|
+
filePath.name
|
|
138586
|
+
)}"`
|
|
138587
|
+
);
|
|
138588
|
+
}
|
|
138577
138589
|
if (!(propertyKey in ret)) {
|
|
138578
138590
|
ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
|
|
138579
138591
|
}
|
|
@@ -138689,7 +138701,9 @@ ${externalDependencies.map((dep) => {
|
|
|
138689
138701
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
138690
138702
|
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
138691
138703
|
const packageJsonPath = (0, import_path4.join)(context.root, options.outputPath, "package.json");
|
|
138692
|
-
|
|
138704
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138705
|
+
console.debug(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
138706
|
+
}
|
|
138693
138707
|
(0, import_fs4.writeFileSync)(
|
|
138694
138708
|
packageJsonPath,
|
|
138695
138709
|
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
@@ -138776,21 +138790,26 @@ ${options.banner}
|
|
|
138776
138790
|
getTransform: options.skipTypia ? void 0 : getTypiaTransform
|
|
138777
138791
|
};
|
|
138778
138792
|
if (options.getConfig) {
|
|
138793
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
|
|
138794
|
+
console.log("\u26A1 Running the Build process");
|
|
138795
|
+
}
|
|
138779
138796
|
const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
|
|
138780
|
-
const
|
|
138797
|
+
const tsupConfig = (0, import_tsup.defineConfig)(
|
|
138781
138798
|
getConfigFns.map(
|
|
138782
138799
|
(getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
|
|
138783
138800
|
)
|
|
138784
138801
|
);
|
|
138785
|
-
if (_isFunction(
|
|
138786
|
-
await build(await Promise.resolve(
|
|
138802
|
+
if (_isFunction(tsupConfig)) {
|
|
138803
|
+
await build(await Promise.resolve(tsupConfig({})), config);
|
|
138787
138804
|
} else {
|
|
138788
|
-
await build(config);
|
|
138805
|
+
await build(tsupConfig, config);
|
|
138789
138806
|
}
|
|
138790
|
-
} else {
|
|
138791
|
-
console.
|
|
138807
|
+
} else if (getLogLevel(config?.logLevel) >= LogLevel.WARN) {
|
|
138808
|
+
console.warn("The Build process did not run because no `getConfig` parameter was provided");
|
|
138809
|
+
}
|
|
138810
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
|
|
138811
|
+
console.log("\u26A1 The Build process has completed successfully");
|
|
138792
138812
|
}
|
|
138793
|
-
console.log("\u26A1 The Build process has completed successfully");
|
|
138794
138813
|
return {
|
|
138795
138814
|
success: true
|
|
138796
138815
|
};
|
|
@@ -138831,12 +138850,14 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
138831
138850
|
}
|
|
138832
138851
|
return tsConfig;
|
|
138833
138852
|
}
|
|
138834
|
-
var build = async (options) => {
|
|
138853
|
+
var build = async (options, config) => {
|
|
138835
138854
|
try {
|
|
138836
|
-
Array.isArray(options) ? options.length > 0 ? options[0].silent : false : options.silent && console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
|
|
138837
138855
|
if (Array.isArray(options)) {
|
|
138838
|
-
await Promise.all(options.map((buildOptions) => (
|
|
138856
|
+
await Promise.all(options.map((buildOptions) => build(buildOptions, config)));
|
|
138839
138857
|
} else {
|
|
138858
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE && !options.silent) {
|
|
138859
|
+
console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
|
|
138860
|
+
}
|
|
138840
138861
|
await (0, import_tsup.build)(options);
|
|
138841
138862
|
}
|
|
138842
138863
|
} catch (e) {
|
|
@@ -138985,12 +139006,10 @@ var tsupNodeBuildExecutorFn = (options, context, config) => {
|
|
|
138985
139006
|
return tsupExecutorFn(
|
|
138986
139007
|
{
|
|
138987
139008
|
...options,
|
|
138988
|
-
getConfig: {
|
|
139009
|
+
getConfig: { dist: nodeConfig },
|
|
138989
139010
|
platform: "node",
|
|
138990
139011
|
banner: getFileBanner(
|
|
138991
|
-
context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map(
|
|
138992
|
-
(s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : ""
|
|
138993
|
-
).join(" ") : "TypeScript (NodeJs Platform)"
|
|
139012
|
+
context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map((s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : "").join(" ") : "TypeScript (NodeJs Platform)"
|
|
138994
139013
|
),
|
|
138995
139014
|
define: {
|
|
138996
139015
|
...options.define
|
|
@@ -138999,7 +139018,8 @@ var tsupNodeBuildExecutorFn = (options, context, config) => {
|
|
|
138999
139018
|
...process.env
|
|
139000
139019
|
}
|
|
139001
139020
|
},
|
|
139002
|
-
context
|
|
139021
|
+
context,
|
|
139022
|
+
config
|
|
139003
139023
|
);
|
|
139004
139024
|
};
|
|
139005
139025
|
var applyDefaultOptions2 = (options) => {
|
|
@@ -43534,7 +43534,9 @@ var getConfigFile = async (filePath) => {
|
|
|
43534
43534
|
return void 0;
|
|
43535
43535
|
}
|
|
43536
43536
|
const config = cosmiconfigResult.config ?? {};
|
|
43537
|
-
|
|
43537
|
+
if (cosmiconfigResult.filepath) {
|
|
43538
|
+
config.configFile = cosmiconfigResult.filepath;
|
|
43539
|
+
}
|
|
43538
43540
|
config.runtimeVersion = "0.0.1";
|
|
43539
43541
|
_static_cache = config;
|
|
43540
43542
|
return config;
|
|
@@ -26292,7 +26292,9 @@ var getConfigFile = async (filePath) => {
|
|
|
26292
26292
|
return void 0;
|
|
26293
26293
|
}
|
|
26294
26294
|
const config = cosmiconfigResult.config ?? {};
|
|
26295
|
-
|
|
26295
|
+
if (cosmiconfigResult.filepath) {
|
|
26296
|
+
config.configFile = cosmiconfigResult.filepath;
|
|
26297
|
+
}
|
|
26296
26298
|
config.runtimeVersion = "0.0.1";
|
|
26297
26299
|
_static_cache = config;
|
|
26298
26300
|
return config;
|
|
@@ -43534,7 +43534,9 @@ var getConfigFile = async (filePath) => {
|
|
|
43534
43534
|
return void 0;
|
|
43535
43535
|
}
|
|
43536
43536
|
const config = cosmiconfigResult.config ?? {};
|
|
43537
|
-
|
|
43537
|
+
if (cosmiconfigResult.filepath) {
|
|
43538
|
+
config.configFile = cosmiconfigResult.filepath;
|
|
43539
|
+
}
|
|
43538
43540
|
config.runtimeVersion = "0.0.1";
|
|
43539
43541
|
_static_cache = config;
|
|
43540
43542
|
return config;
|
|
@@ -43534,7 +43534,9 @@ var getConfigFile = async (filePath) => {
|
|
|
43534
43534
|
return void 0;
|
|
43535
43535
|
}
|
|
43536
43536
|
const config = cosmiconfigResult.config ?? {};
|
|
43537
|
-
|
|
43537
|
+
if (cosmiconfigResult.filepath) {
|
|
43538
|
+
config.configFile = cosmiconfigResult.filepath;
|
|
43539
|
+
}
|
|
43538
43540
|
config.runtimeVersion = "0.0.1";
|
|
43539
43541
|
_static_cache = config;
|
|
43540
43542
|
return config;
|