@storm-software/workspace-tools 1.41.0 → 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 +14 -0
- package/README.md +1 -1
- package/config/nx.json +10 -15
- package/index.js +88 -81
- package/meta.json +1 -1
- package/package.json +3 -1
- package/src/base/index.js +21 -38
- package/src/executors/design-tokens/executor.js +21 -38
- package/src/executors/tsup/executor.js +90853 -90846
- package/src/executors/tsup-browser/executor.js +79 -73
- package/src/executors/tsup-neutral/executor.js +84 -76
- package/src/executors/tsup-node/executor.js +80 -74
- 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;
|
|
@@ -131922,14 +131924,13 @@ var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
|
131922
131924
|
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
131923
131925
|
skipReadingConfig: false,
|
|
131924
131926
|
hooks: {}
|
|
131925
|
-
}) => async (
|
|
131927
|
+
}) => async (_options, context) => {
|
|
131926
131928
|
const startTime = Date.now();
|
|
131929
|
+
let options = _options;
|
|
131927
131930
|
try {
|
|
131928
|
-
console.info(
|
|
131929
|
-
chalk.bold.hex("#1fb2a6")(`\u26A1 Running the ${name} executor...
|
|
131931
|
+
console.info(chalk.bold.hex("#1fb2a6")(`\u26A1 Running the ${name} executor...
|
|
131930
131932
|
|
|
131931
|
-
`)
|
|
131932
|
-
);
|
|
131933
|
+
`));
|
|
131933
131934
|
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
131934
131935
|
throw new Error(
|
|
131935
131936
|
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
@@ -131954,19 +131955,11 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
|
|
|
131954
131955
|
);
|
|
131955
131956
|
}
|
|
131956
131957
|
if (executorOptions?.hooks?.applyDefaultOptions) {
|
|
131957
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(
|
|
131958
|
-
options = await Promise.resolve(
|
|
131959
|
-
|
|
131960
|
-
);
|
|
131961
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the applyDefaultOptions hook...`));
|
|
131958
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the applyDefaultOptions hook..."));
|
|
131959
|
+
options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
|
|
131960
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the applyDefaultOptions hook..."));
|
|
131962
131961
|
}
|
|
131963
|
-
getLogLevel(config.logLevel) >= LogLevel.INFO && console.info(
|
|
131964
|
-
chalk.hex("#0ea5e9").italic(`
|
|
131965
|
-
|
|
131966
|
-
\u2699\uFE0F Executor schema options:
|
|
131967
|
-
`),
|
|
131968
|
-
options
|
|
131969
|
-
);
|
|
131962
|
+
getLogLevel(config.logLevel) >= LogLevel.INFO && console.info(chalk.hex("#0ea5e9").italic("\n\n \u2699\uFE0F Executor schema options: \n"), options);
|
|
131970
131963
|
const tokenized = applyWorkspaceTokens(
|
|
131971
131964
|
options,
|
|
131972
131965
|
{
|
|
@@ -131981,44 +131974,34 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
|
|
|
131981
131974
|
applyWorkspaceExecutorTokens
|
|
131982
131975
|
);
|
|
131983
131976
|
if (executorOptions?.hooks?.preProcess) {
|
|
131984
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(
|
|
131985
|
-
await Promise.resolve(
|
|
131986
|
-
|
|
131987
|
-
);
|
|
131988
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the preProcess hook...`));
|
|
131977
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the preProcess hook..."));
|
|
131978
|
+
await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
|
|
131979
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the preProcess hook..."));
|
|
131989
131980
|
}
|
|
131990
|
-
const result = await Promise.resolve(
|
|
131991
|
-
executorFn(tokenized, context, config)
|
|
131992
|
-
);
|
|
131981
|
+
const result = await Promise.resolve(executorFn(tokenized, context, config));
|
|
131993
131982
|
if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
|
|
131994
131983
|
throw new Error(`The ${name} executor failed to run`, {
|
|
131995
|
-
cause: result
|
|
131984
|
+
cause: result?.error
|
|
131996
131985
|
});
|
|
131997
131986
|
}
|
|
131998
131987
|
if (executorOptions?.hooks?.postProcess) {
|
|
131999
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(
|
|
131988
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the postProcess hook..."));
|
|
132000
131989
|
await Promise.resolve(executorOptions.hooks.postProcess(config));
|
|
132001
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(
|
|
131990
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the postProcess hook..."));
|
|
132002
131991
|
}
|
|
132003
131992
|
console.info(
|
|
132004
|
-
chalk.bold.hex("#087f5b")(
|
|
132005
|
-
`
|
|
131993
|
+
chalk.bold.hex("#087f5b")(`
|
|
132006
131994
|
|
|
132007
131995
|
\u{1F389} Successfully completed running the ${name} executor!
|
|
132008
131996
|
|
|
132009
|
-
`
|
|
132010
|
-
)
|
|
131997
|
+
`)
|
|
132011
131998
|
);
|
|
132012
131999
|
return {
|
|
132013
132000
|
success: true
|
|
132014
132001
|
};
|
|
132015
132002
|
} catch (error) {
|
|
132016
132003
|
console.error(
|
|
132017
|
-
chalk.bold.hex("#7d1a1a")(
|
|
132018
|
-
`\u274C An error occurred while running the executor
|
|
132019
|
-
|
|
132020
|
-
`
|
|
132021
|
-
),
|
|
132004
|
+
chalk.bold.hex("#7d1a1a")("\u274C An error occurred while running the executor\n\n"),
|
|
132022
132005
|
error
|
|
132023
132006
|
);
|
|
132024
132007
|
return {
|
|
@@ -138429,10 +138412,10 @@ var import_transform = __toESM(require_transform());
|
|
|
138429
138412
|
var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(program, {}, { addDiagnostic: (input) => diagnostics.push(input) });
|
|
138430
138413
|
|
|
138431
138414
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
138432
|
-
async function tsupExecutorFn(options, context) {
|
|
138415
|
+
async function tsupExecutorFn(options, context, config) {
|
|
138433
138416
|
try {
|
|
138434
138417
|
console.log("\u{1F4E6} Running Storm build executor on the workspace");
|
|
138435
|
-
|
|
138418
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.log(
|
|
138436
138419
|
`\u2699\uFE0F Executor options:
|
|
138437
138420
|
${Object.keys(options).map(
|
|
138438
138421
|
(key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
|
|
@@ -138448,7 +138431,9 @@ ${Object.keys(options).map(
|
|
|
138448
138431
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
138449
138432
|
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
138450
138433
|
if (options.clean !== false) {
|
|
138451
|
-
|
|
138434
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138435
|
+
console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
138436
|
+
}
|
|
138452
138437
|
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
138453
138438
|
}
|
|
138454
138439
|
const assets = Array.from(options.assets);
|
|
@@ -138517,11 +138502,15 @@ ${Object.keys(options).map(
|
|
|
138517
138502
|
const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
|
|
138518
138503
|
const internalDependencies = [];
|
|
138519
138504
|
const projectConfigs = await Promise.resolve(getProjectConfigurations());
|
|
138520
|
-
|
|
138521
|
-
|
|
138505
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138506
|
+
console.log("Project Configs:");
|
|
138507
|
+
console.log(projectConfigs);
|
|
138508
|
+
}
|
|
138522
138509
|
if (implicitDependencies && implicitDependencies.length > 0) {
|
|
138523
138510
|
options.external = implicitDependencies.reduce((ret, key) => {
|
|
138524
|
-
|
|
138511
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138512
|
+
console.log(`\u26A1 Adding implicit dependency: ${key}`);
|
|
138513
|
+
}
|
|
138525
138514
|
const projectConfig = projectConfigs[key];
|
|
138526
138515
|
if (projectConfig?.targets?.build) {
|
|
138527
138516
|
const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
|
|
@@ -138547,10 +138536,12 @@ ${Object.keys(options).map(
|
|
|
138547
138536
|
}
|
|
138548
138537
|
}
|
|
138549
138538
|
}
|
|
138550
|
-
|
|
138539
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138540
|
+
console.log(`Building with the following dependencies marked as external:
|
|
138551
138541
|
${externalDependencies.map((dep) => {
|
|
138552
|
-
|
|
138553
|
-
|
|
138542
|
+
return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
|
|
138543
|
+
}).join("\n")}`);
|
|
138544
|
+
}
|
|
138554
138545
|
const prettierOptions = {
|
|
138555
138546
|
plugins: ["prettier-plugin-packagejson"],
|
|
138556
138547
|
trailingComma: "none",
|
|
@@ -138587,12 +138578,14 @@ ${externalDependencies.map((dep) => {
|
|
|
138587
138578
|
while (propertyKey.startsWith("/")) {
|
|
138588
138579
|
propertyKey = propertyKey.substring(1);
|
|
138589
138580
|
}
|
|
138590
|
-
|
|
138591
|
-
|
|
138592
|
-
|
|
138593
|
-
|
|
138594
|
-
|
|
138595
|
-
|
|
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
|
+
}
|
|
138596
138589
|
if (!(propertyKey in ret)) {
|
|
138597
138590
|
ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
|
|
138598
138591
|
}
|
|
@@ -138708,7 +138701,9 @@ ${externalDependencies.map((dep) => {
|
|
|
138708
138701
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
138709
138702
|
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
138710
138703
|
const packageJsonPath = (0, import_path4.join)(context.root, options.outputPath, "package.json");
|
|
138711
|
-
|
|
138704
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138705
|
+
console.debug(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
138706
|
+
}
|
|
138712
138707
|
(0, import_fs4.writeFileSync)(
|
|
138713
138708
|
packageJsonPath,
|
|
138714
138709
|
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
@@ -138771,7 +138766,7 @@ ${(0, import_fs4.readFileSync)(file, "utf-8")}`,
|
|
|
138771
138766
|
...options,
|
|
138772
138767
|
watch: false,
|
|
138773
138768
|
main: options.entry,
|
|
138774
|
-
transformers: ["typia/lib/transform"]
|
|
138769
|
+
transformers: options.skipTypia ? [] : ["typia/lib/transform"]
|
|
138775
138770
|
},
|
|
138776
138771
|
context.root,
|
|
138777
138772
|
sourceRoot,
|
|
@@ -138795,21 +138790,26 @@ ${options.banner}
|
|
|
138795
138790
|
getTransform: options.skipTypia ? void 0 : getTypiaTransform
|
|
138796
138791
|
};
|
|
138797
138792
|
if (options.getConfig) {
|
|
138793
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
|
|
138794
|
+
console.log("\u26A1 Running the Build process");
|
|
138795
|
+
}
|
|
138798
138796
|
const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
|
|
138799
|
-
const
|
|
138797
|
+
const tsupConfig = (0, import_tsup.defineConfig)(
|
|
138800
138798
|
getConfigFns.map(
|
|
138801
138799
|
(getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
|
|
138802
138800
|
)
|
|
138803
138801
|
);
|
|
138804
|
-
if (_isFunction(
|
|
138805
|
-
await build(await Promise.resolve(
|
|
138802
|
+
if (_isFunction(tsupConfig)) {
|
|
138803
|
+
await build(await Promise.resolve(tsupConfig({})), config);
|
|
138806
138804
|
} else {
|
|
138807
|
-
await build(config);
|
|
138805
|
+
await build(tsupConfig, config);
|
|
138808
138806
|
}
|
|
138809
|
-
} else {
|
|
138810
|
-
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");
|
|
138811
138812
|
}
|
|
138812
|
-
console.log("\u26A1 The Build process has completed successfully");
|
|
138813
138813
|
return {
|
|
138814
138814
|
success: true
|
|
138815
138815
|
};
|
|
@@ -138835,6 +138835,7 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
138835
138835
|
esModuleInterop: true,
|
|
138836
138836
|
downlevelIteration: true,
|
|
138837
138837
|
forceConsistentCasingInFileNames: true,
|
|
138838
|
+
emitDeclarationOnly: true,
|
|
138838
138839
|
declaration: true,
|
|
138839
138840
|
declarationMap: true,
|
|
138840
138841
|
declarationDir: (0, import_path4.join)(workspaceRoot, "tmp", ".tsup", "declaration")
|
|
@@ -138849,12 +138850,19 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
138849
138850
|
}
|
|
138850
138851
|
return tsConfig;
|
|
138851
138852
|
}
|
|
138852
|
-
var build = async (options) => {
|
|
138853
|
-
|
|
138854
|
-
|
|
138855
|
-
|
|
138856
|
-
|
|
138857
|
-
|
|
138853
|
+
var build = async (options, config) => {
|
|
138854
|
+
try {
|
|
138855
|
+
if (Array.isArray(options)) {
|
|
138856
|
+
await Promise.all(options.map((buildOptions) => build(buildOptions, config)));
|
|
138857
|
+
} else {
|
|
138858
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE && !options.silent) {
|
|
138859
|
+
console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
|
|
138860
|
+
}
|
|
138861
|
+
await (0, import_tsup.build)(options);
|
|
138862
|
+
}
|
|
138863
|
+
} catch (e) {
|
|
138864
|
+
console.error("\u26A0\uFE0F A failure occured during the Tsup Build executor");
|
|
138865
|
+
console.error(e);
|
|
138858
138866
|
}
|
|
138859
138867
|
};
|
|
138860
138868
|
var applyDefaultOptions = (options) => {
|
|
@@ -138884,7 +138892,6 @@ var applyDefaultOptions = (options) => {
|
|
|
138884
138892
|
options.skipTypia ??= false;
|
|
138885
138893
|
options.define ??= {};
|
|
138886
138894
|
options.env ??= {};
|
|
138887
|
-
options.verbose ??= !!process.env.CI;
|
|
138888
138895
|
options.getConfig ??= { dist: defaultConfig };
|
|
138889
138896
|
return options;
|
|
138890
138897
|
};
|
|
@@ -139082,9 +139089,7 @@ var tsupBrowserBuildExecutorFn = (options, context, config) => {
|
|
|
139082
139089
|
},
|
|
139083
139090
|
platform: "browser",
|
|
139084
139091
|
banner: getFileBanner(
|
|
139085
|
-
context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map(
|
|
139086
|
-
(s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : ""
|
|
139087
|
-
).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)"
|
|
139088
139093
|
),
|
|
139089
139094
|
define: {
|
|
139090
139095
|
...options.define
|
|
@@ -139093,7 +139098,8 @@ var tsupBrowserBuildExecutorFn = (options, context, config) => {
|
|
|
139093
139098
|
...process.env
|
|
139094
139099
|
}
|
|
139095
139100
|
},
|
|
139096
|
-
context
|
|
139101
|
+
context,
|
|
139102
|
+
config
|
|
139097
139103
|
);
|
|
139098
139104
|
};
|
|
139099
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;
|
|
@@ -131922,14 +131924,13 @@ var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
|
131922
131924
|
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
131923
131925
|
skipReadingConfig: false,
|
|
131924
131926
|
hooks: {}
|
|
131925
|
-
}) => async (
|
|
131927
|
+
}) => async (_options, context) => {
|
|
131926
131928
|
const startTime = Date.now();
|
|
131929
|
+
let options = _options;
|
|
131927
131930
|
try {
|
|
131928
|
-
console.info(
|
|
131929
|
-
chalk.bold.hex("#1fb2a6")(`\u26A1 Running the ${name} executor...
|
|
131931
|
+
console.info(chalk.bold.hex("#1fb2a6")(`\u26A1 Running the ${name} executor...
|
|
131930
131932
|
|
|
131931
|
-
`)
|
|
131932
|
-
);
|
|
131933
|
+
`));
|
|
131933
131934
|
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
131934
131935
|
throw new Error(
|
|
131935
131936
|
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
@@ -131954,19 +131955,11 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
|
|
|
131954
131955
|
);
|
|
131955
131956
|
}
|
|
131956
131957
|
if (executorOptions?.hooks?.applyDefaultOptions) {
|
|
131957
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(
|
|
131958
|
-
options = await Promise.resolve(
|
|
131959
|
-
|
|
131960
|
-
);
|
|
131961
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the applyDefaultOptions hook...`));
|
|
131958
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the applyDefaultOptions hook..."));
|
|
131959
|
+
options = await Promise.resolve(executorOptions.hooks.applyDefaultOptions(options, config));
|
|
131960
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the applyDefaultOptions hook..."));
|
|
131962
131961
|
}
|
|
131963
|
-
getLogLevel(config.logLevel) >= LogLevel.INFO && console.info(
|
|
131964
|
-
chalk.hex("#0ea5e9").italic(`
|
|
131965
|
-
|
|
131966
|
-
\u2699\uFE0F Executor schema options:
|
|
131967
|
-
`),
|
|
131968
|
-
options
|
|
131969
|
-
);
|
|
131962
|
+
getLogLevel(config.logLevel) >= LogLevel.INFO && console.info(chalk.hex("#0ea5e9").italic("\n\n \u2699\uFE0F Executor schema options: \n"), options);
|
|
131970
131963
|
const tokenized = applyWorkspaceTokens(
|
|
131971
131964
|
options,
|
|
131972
131965
|
{
|
|
@@ -131981,44 +131974,34 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\
|
|
|
131981
131974
|
applyWorkspaceExecutorTokens
|
|
131982
131975
|
);
|
|
131983
131976
|
if (executorOptions?.hooks?.preProcess) {
|
|
131984
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(
|
|
131985
|
-
await Promise.resolve(
|
|
131986
|
-
|
|
131987
|
-
);
|
|
131988
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(`Completed the preProcess hook...`));
|
|
131977
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the preProcess hook..."));
|
|
131978
|
+
await Promise.resolve(executorOptions.hooks.preProcess(tokenized, config));
|
|
131979
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the preProcess hook..."));
|
|
131989
131980
|
}
|
|
131990
|
-
const result = await Promise.resolve(
|
|
131991
|
-
executorFn(tokenized, context, config)
|
|
131992
|
-
);
|
|
131981
|
+
const result = await Promise.resolve(executorFn(tokenized, context, config));
|
|
131993
131982
|
if (result && (!result.success || result.error && result?.error?.message && typeof result?.error?.message === "string" && result?.error?.name && typeof result?.error?.name === "string")) {
|
|
131994
131983
|
throw new Error(`The ${name} executor failed to run`, {
|
|
131995
|
-
cause: result
|
|
131984
|
+
cause: result?.error
|
|
131996
131985
|
});
|
|
131997
131986
|
}
|
|
131998
131987
|
if (executorOptions?.hooks?.postProcess) {
|
|
131999
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(
|
|
131988
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Running the postProcess hook..."));
|
|
132000
131989
|
await Promise.resolve(executorOptions.hooks.postProcess(config));
|
|
132001
|
-
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim(
|
|
131990
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.debug(chalk.dim("Completed the postProcess hook..."));
|
|
132002
131991
|
}
|
|
132003
131992
|
console.info(
|
|
132004
|
-
chalk.bold.hex("#087f5b")(
|
|
132005
|
-
`
|
|
131993
|
+
chalk.bold.hex("#087f5b")(`
|
|
132006
131994
|
|
|
132007
131995
|
\u{1F389} Successfully completed running the ${name} executor!
|
|
132008
131996
|
|
|
132009
|
-
`
|
|
132010
|
-
)
|
|
131997
|
+
`)
|
|
132011
131998
|
);
|
|
132012
131999
|
return {
|
|
132013
132000
|
success: true
|
|
132014
132001
|
};
|
|
132015
132002
|
} catch (error) {
|
|
132016
132003
|
console.error(
|
|
132017
|
-
chalk.bold.hex("#7d1a1a")(
|
|
132018
|
-
`\u274C An error occurred while running the executor
|
|
132019
|
-
|
|
132020
|
-
`
|
|
132021
|
-
),
|
|
132004
|
+
chalk.bold.hex("#7d1a1a")("\u274C An error occurred while running the executor\n\n"),
|
|
132022
132005
|
error
|
|
132023
132006
|
);
|
|
132024
132007
|
return {
|
|
@@ -138429,10 +138412,10 @@ var import_transform = __toESM(require_transform());
|
|
|
138429
138412
|
var getTypiaTransform = (program, diagnostics) => (0, import_transform.default)(program, {}, { addDiagnostic: (input) => diagnostics.push(input) });
|
|
138430
138413
|
|
|
138431
138414
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
138432
|
-
async function tsupExecutorFn(options, context) {
|
|
138415
|
+
async function tsupExecutorFn(options, context, config) {
|
|
138433
138416
|
try {
|
|
138434
138417
|
console.log("\u{1F4E6} Running Storm build executor on the workspace");
|
|
138435
|
-
|
|
138418
|
+
getLogLevel(config?.logLevel) >= LogLevel.TRACE && console.log(
|
|
138436
138419
|
`\u2699\uFE0F Executor options:
|
|
138437
138420
|
${Object.keys(options).map(
|
|
138438
138421
|
(key) => `${key}: ${!options[key] || _isPrimitive(options[key]) ? options[key] : JSON.stringify(options[key])}`
|
|
@@ -138448,7 +138431,9 @@ ${Object.keys(options).map(
|
|
|
138448
138431
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
138449
138432
|
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
138450
138433
|
if (options.clean !== false) {
|
|
138451
|
-
|
|
138434
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138435
|
+
console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
138436
|
+
}
|
|
138452
138437
|
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
138453
138438
|
}
|
|
138454
138439
|
const assets = Array.from(options.assets);
|
|
@@ -138517,11 +138502,15 @@ ${Object.keys(options).map(
|
|
|
138517
138502
|
const implicitDependencies = context.projectsConfigurations.projects[context.projectName].implicitDependencies;
|
|
138518
138503
|
const internalDependencies = [];
|
|
138519
138504
|
const projectConfigs = await Promise.resolve(getProjectConfigurations());
|
|
138520
|
-
|
|
138521
|
-
|
|
138505
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138506
|
+
console.log("Project Configs:");
|
|
138507
|
+
console.log(projectConfigs);
|
|
138508
|
+
}
|
|
138522
138509
|
if (implicitDependencies && implicitDependencies.length > 0) {
|
|
138523
138510
|
options.external = implicitDependencies.reduce((ret, key) => {
|
|
138524
|
-
|
|
138511
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138512
|
+
console.log(`\u26A1 Adding implicit dependency: ${key}`);
|
|
138513
|
+
}
|
|
138525
138514
|
const projectConfig = projectConfigs[key];
|
|
138526
138515
|
if (projectConfig?.targets?.build) {
|
|
138527
138516
|
const projectPackageJson = (0, import_devkit2.readJsonFile)(projectConfig.targets?.build.options.project);
|
|
@@ -138547,10 +138536,12 @@ ${Object.keys(options).map(
|
|
|
138547
138536
|
}
|
|
138548
138537
|
}
|
|
138549
138538
|
}
|
|
138550
|
-
|
|
138539
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE) {
|
|
138540
|
+
console.log(`Building with the following dependencies marked as external:
|
|
138551
138541
|
${externalDependencies.map((dep) => {
|
|
138552
|
-
|
|
138553
|
-
|
|
138542
|
+
return `name: ${dep.name}, node: ${dep.node}, outputs: ${dep.outputs}`;
|
|
138543
|
+
}).join("\n")}`);
|
|
138544
|
+
}
|
|
138554
138545
|
const prettierOptions = {
|
|
138555
138546
|
plugins: ["prettier-plugin-packagejson"],
|
|
138556
138547
|
trailingComma: "none",
|
|
@@ -138587,12 +138578,14 @@ ${externalDependencies.map((dep) => {
|
|
|
138587
138578
|
while (propertyKey.startsWith("/")) {
|
|
138588
138579
|
propertyKey = propertyKey.substring(1);
|
|
138589
138580
|
}
|
|
138590
|
-
|
|
138591
|
-
|
|
138592
|
-
|
|
138593
|
-
|
|
138594
|
-
|
|
138595
|
-
|
|
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
|
+
}
|
|
138596
138589
|
if (!(propertyKey in ret)) {
|
|
138597
138590
|
ret[propertyKey] = (0, import_devkit2.joinPathFragments)(filePath.path, filePath.name);
|
|
138598
138591
|
}
|
|
@@ -138708,7 +138701,9 @@ ${externalDependencies.map((dep) => {
|
|
|
138708
138701
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
138709
138702
|
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
138710
138703
|
const packageJsonPath = (0, import_path4.join)(context.root, options.outputPath, "package.json");
|
|
138711
|
-
|
|
138704
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.DEBUG) {
|
|
138705
|
+
console.debug(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
138706
|
+
}
|
|
138712
138707
|
(0, import_fs4.writeFileSync)(
|
|
138713
138708
|
packageJsonPath,
|
|
138714
138709
|
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
@@ -138771,7 +138766,7 @@ ${(0, import_fs4.readFileSync)(file, "utf-8")}`,
|
|
|
138771
138766
|
...options,
|
|
138772
138767
|
watch: false,
|
|
138773
138768
|
main: options.entry,
|
|
138774
|
-
transformers: ["typia/lib/transform"]
|
|
138769
|
+
transformers: options.skipTypia ? [] : ["typia/lib/transform"]
|
|
138775
138770
|
},
|
|
138776
138771
|
context.root,
|
|
138777
138772
|
sourceRoot,
|
|
@@ -138795,21 +138790,26 @@ ${options.banner}
|
|
|
138795
138790
|
getTransform: options.skipTypia ? void 0 : getTypiaTransform
|
|
138796
138791
|
};
|
|
138797
138792
|
if (options.getConfig) {
|
|
138793
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.INFO) {
|
|
138794
|
+
console.log("\u26A1 Running the Build process");
|
|
138795
|
+
}
|
|
138798
138796
|
const getConfigFns = _isFunction(options.getConfig) ? [options.getConfig] : Object.keys(options.getConfig).map((key) => options.getConfig[key]);
|
|
138799
|
-
const
|
|
138797
|
+
const tsupConfig = (0, import_tsup.defineConfig)(
|
|
138800
138798
|
getConfigFns.map(
|
|
138801
138799
|
(getConfigFn) => getConfig(context.root, projectRoot, getConfigFn, getConfigOptions)
|
|
138802
138800
|
)
|
|
138803
138801
|
);
|
|
138804
|
-
if (_isFunction(
|
|
138805
|
-
await build(await Promise.resolve(
|
|
138802
|
+
if (_isFunction(tsupConfig)) {
|
|
138803
|
+
await build(await Promise.resolve(tsupConfig({})), config);
|
|
138806
138804
|
} else {
|
|
138807
|
-
await build(config);
|
|
138805
|
+
await build(tsupConfig, config);
|
|
138808
138806
|
}
|
|
138809
|
-
} else {
|
|
138810
|
-
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");
|
|
138811
138812
|
}
|
|
138812
|
-
console.log("\u26A1 The Build process has completed successfully");
|
|
138813
138813
|
return {
|
|
138814
138814
|
success: true
|
|
138815
138815
|
};
|
|
@@ -138835,6 +138835,7 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
138835
138835
|
esModuleInterop: true,
|
|
138836
138836
|
downlevelIteration: true,
|
|
138837
138837
|
forceConsistentCasingInFileNames: true,
|
|
138838
|
+
emitDeclarationOnly: true,
|
|
138838
138839
|
declaration: true,
|
|
138839
138840
|
declarationMap: true,
|
|
138840
138841
|
declarationDir: (0, import_path4.join)(workspaceRoot, "tmp", ".tsup", "declaration")
|
|
@@ -138849,12 +138850,19 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
138849
138850
|
}
|
|
138850
138851
|
return tsConfig;
|
|
138851
138852
|
}
|
|
138852
|
-
var build = async (options) => {
|
|
138853
|
-
|
|
138854
|
-
|
|
138855
|
-
|
|
138856
|
-
|
|
138857
|
-
|
|
138853
|
+
var build = async (options, config) => {
|
|
138854
|
+
try {
|
|
138855
|
+
if (Array.isArray(options)) {
|
|
138856
|
+
await Promise.all(options.map((buildOptions) => build(buildOptions, config)));
|
|
138857
|
+
} else {
|
|
138858
|
+
if (getLogLevel(config?.logLevel) >= LogLevel.TRACE && !options.silent) {
|
|
138859
|
+
console.log("\u2699\uFE0F Tsup build config: \n", options, "\n");
|
|
138860
|
+
}
|
|
138861
|
+
await (0, import_tsup.build)(options);
|
|
138862
|
+
}
|
|
138863
|
+
} catch (e) {
|
|
138864
|
+
console.error("\u26A0\uFE0F A failure occured during the Tsup Build executor");
|
|
138865
|
+
console.error(e);
|
|
138858
138866
|
}
|
|
138859
138867
|
};
|
|
138860
138868
|
var applyDefaultOptions = (options) => {
|
|
@@ -138884,7 +138892,6 @@ var applyDefaultOptions = (options) => {
|
|
|
138884
138892
|
options.skipTypia ??= false;
|
|
138885
138893
|
options.define ??= {};
|
|
138886
138894
|
options.env ??= {};
|
|
138887
|
-
options.verbose ??= !!process.env.CI;
|
|
138888
138895
|
options.getConfig ??= { dist: defaultConfig };
|
|
138889
138896
|
return options;
|
|
138890
138897
|
};
|
|
@@ -138928,6 +138935,9 @@ function neutralConfig({
|
|
|
138928
138935
|
metafile = false,
|
|
138929
138936
|
define: define2,
|
|
138930
138937
|
env,
|
|
138938
|
+
apiReport = true,
|
|
138939
|
+
docModel = true,
|
|
138940
|
+
tsdocMetadata = true,
|
|
138931
138941
|
plugins,
|
|
138932
138942
|
generatePackageJson,
|
|
138933
138943
|
dtsTsConfig,
|
|
@@ -138968,9 +138978,9 @@ function neutralConfig({
|
|
|
138968
138978
|
}
|
|
138969
138979
|
}
|
|
138970
138980
|
},
|
|
138971
|
-
apiReport
|
|
138972
|
-
docModel
|
|
138973
|
-
tsdocMetadata
|
|
138981
|
+
apiReport,
|
|
138982
|
+
docModel,
|
|
138983
|
+
tsdocMetadata,
|
|
138974
138984
|
sourcemap: debug,
|
|
138975
138985
|
clean: false,
|
|
138976
138986
|
tsconfigDecoratorMetadata: true,
|
|
@@ -138996,13 +139006,11 @@ var tsupNeutralBuildExecutorFn = (options, context, config) => {
|
|
|
138996
139006
|
{
|
|
138997
139007
|
...options,
|
|
138998
139008
|
getConfig: {
|
|
138999
|
-
|
|
139009
|
+
dist: neutralConfig
|
|
139000
139010
|
},
|
|
139001
139011
|
platform: "neutral",
|
|
139002
139012
|
banner: getFileBanner(
|
|
139003
|
-
context.projectName ? context.projectName.split(/(?=[A-Z])|[\.\-\s_]/).map((s) => s.trim()).filter((s) => !!s).map(
|
|
139004
|
-
(s) => s ? s.toUpperCase()[0] + s.toLowerCase().slice(1) : ""
|
|
139005
|
-
).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)"
|
|
139006
139014
|
),
|
|
139007
139015
|
define: {
|
|
139008
139016
|
...options.define
|