@storm-software/workspace-tools 1.19.3 → 1.20.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/CHANGELOG.md +14 -0
- package/index.js +179 -72
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/base/index.js +104 -25
- package/src/executors/tsup/executor.js +6844 -105
- package/src/executors/tsup/schema.d.ts +3 -3
- package/src/executors/tsup-neutral/executor.js +131 -62
- package/src/executors/tsup-neutral/schema.d.ts +2 -1
- package/src/executors/tsup-node/executor.js +132 -64
- package/src/executors/tsup-node/schema.d.ts +4 -1
- package/src/generators/config-schema/generator.js +60 -15
- package/src/generators/node-library/generator.js +60 -3
- package/src/generators/preset/generator.js +60 -3
- package/src/utils/index.js +62 -8
|
@@ -19,7 +19,7 @@ export type TsupExecutorSchema = Omit<
|
|
|
19
19
|
| "esbuildConfig"
|
|
20
20
|
| "platform"
|
|
21
21
|
> & {
|
|
22
|
-
entry
|
|
22
|
+
entry: string;
|
|
23
23
|
options: Options;
|
|
24
24
|
clean: boolean;
|
|
25
25
|
debug: boolean;
|
|
@@ -31,6 +31,6 @@ export type TsupExecutorSchema = Omit<
|
|
|
31
31
|
docModel?: boolean;
|
|
32
32
|
tsdocMetadata?: boolean;
|
|
33
33
|
includeSrc?: boolean;
|
|
34
|
-
platform
|
|
35
|
-
plugins
|
|
34
|
+
platform: Platform;
|
|
35
|
+
plugins: any[];
|
|
36
36
|
};
|
|
@@ -105206,26 +105206,39 @@ var getWorkspaceRoot2 = () => {
|
|
|
105206
105206
|
};
|
|
105207
105207
|
|
|
105208
105208
|
// packages/workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
105209
|
-
var
|
|
105209
|
+
var applyWorkspaceExecutorTokens = (option, tokenizerOptions) => {
|
|
105210
|
+
console.log("applyWorkspaceExecutorTokens", option);
|
|
105210
105211
|
let result = option;
|
|
105211
105212
|
if (!result) {
|
|
105212
105213
|
return result;
|
|
105213
105214
|
}
|
|
105214
|
-
const workspaceRoot = getWorkspaceRoot2();
|
|
105215
105215
|
let projectName;
|
|
105216
105216
|
let projectRoot;
|
|
105217
105217
|
let sourceRoot;
|
|
105218
|
-
if (
|
|
105219
|
-
const context =
|
|
105218
|
+
if (tokenizerOptions?.projectName) {
|
|
105219
|
+
const context = tokenizerOptions;
|
|
105220
105220
|
projectName = context.projectName;
|
|
105221
|
-
projectRoot = context.
|
|
105222
|
-
sourceRoot = context.
|
|
105221
|
+
projectRoot = context.root;
|
|
105222
|
+
sourceRoot = context.sourceRoot;
|
|
105223
105223
|
} else {
|
|
105224
|
-
const projectConfig =
|
|
105224
|
+
const projectConfig = tokenizerOptions;
|
|
105225
105225
|
projectName = projectConfig.name;
|
|
105226
105226
|
projectRoot = projectConfig.root;
|
|
105227
105227
|
sourceRoot = projectConfig.sourceRoot;
|
|
105228
105228
|
}
|
|
105229
|
+
if (tokenizerOptions.config) {
|
|
105230
|
+
const configKeys = Object.keys(tokenizerOptions.config);
|
|
105231
|
+
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
105232
|
+
configKeys.forEach((configKey) => {
|
|
105233
|
+
if (result.includes(`{${configKey}}`)) {
|
|
105234
|
+
result = result.replaceAll(
|
|
105235
|
+
`{${configKey}}`,
|
|
105236
|
+
tokenizerOptions.config[configKey]
|
|
105237
|
+
);
|
|
105238
|
+
}
|
|
105239
|
+
});
|
|
105240
|
+
}
|
|
105241
|
+
}
|
|
105229
105242
|
if (result.includes("{projectName}")) {
|
|
105230
105243
|
result = result.replaceAll("{projectName}", projectName);
|
|
105231
105244
|
}
|
|
@@ -105236,28 +105249,56 @@ var applyWorkspaceTokens = (option, config) => {
|
|
|
105236
105249
|
result = result.replaceAll("{sourceRoot}", sourceRoot);
|
|
105237
105250
|
}
|
|
105238
105251
|
if (result.includes("{workspaceRoot}")) {
|
|
105239
|
-
result = result.replaceAll(
|
|
105252
|
+
result = result.replaceAll(
|
|
105253
|
+
"{workspaceRoot}",
|
|
105254
|
+
tokenizerOptions.workspaceRoot ?? getWorkspaceRoot2()
|
|
105255
|
+
);
|
|
105240
105256
|
}
|
|
105241
105257
|
return result;
|
|
105242
105258
|
};
|
|
105259
|
+
var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
105260
|
+
let result = options;
|
|
105261
|
+
if (!result) {
|
|
105262
|
+
return {};
|
|
105263
|
+
}
|
|
105264
|
+
return Object.keys(options).reduce(
|
|
105265
|
+
(ret, option) => {
|
|
105266
|
+
if (options[option] === void 0 || options[option] === null || typeof options[option] === "number" || typeof options[option] === "boolean" || typeof options[option] === "string") {
|
|
105267
|
+
ret[option] = tokenizerFn(option, config);
|
|
105268
|
+
} else if (Array.isArray(options[option])) {
|
|
105269
|
+
ret[option] = options[option].map(
|
|
105270
|
+
(item) => tokenizerFn(item, config)
|
|
105271
|
+
);
|
|
105272
|
+
} else if (typeof options[option] === "object") {
|
|
105273
|
+
ret[option] = tokenizerFn(options[option], config);
|
|
105274
|
+
}
|
|
105275
|
+
return ret;
|
|
105276
|
+
},
|
|
105277
|
+
{}
|
|
105278
|
+
);
|
|
105279
|
+
};
|
|
105243
105280
|
|
|
105244
105281
|
// packages/workspace-tools/src/base/base-executor.ts
|
|
105245
|
-
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
105282
|
+
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
105283
|
+
skipReadingConfig: false
|
|
105284
|
+
}) => async (options, context) => {
|
|
105246
105285
|
const startTime = Date.now();
|
|
105247
105286
|
try {
|
|
105248
105287
|
console.info(`\u26A1 Running the ${name} executor...`);
|
|
105249
|
-
|
|
105288
|
+
if (executorOptions?.applyDefaultFn) {
|
|
105289
|
+
options = executorOptions.applyDefaultFn(options);
|
|
105290
|
+
}
|
|
105291
|
+
console.debug(`\u2699\uFE0F Executor schema options:
|
|
105250
105292
|
`, options);
|
|
105251
|
-
|
|
105252
|
-
|
|
105253
|
-
|
|
105254
|
-
|
|
105255
|
-
|
|
105256
|
-
|
|
105257
|
-
|
|
105258
|
-
|
|
105259
|
-
|
|
105260
|
-
);
|
|
105293
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
105294
|
+
throw new Error(
|
|
105295
|
+
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
105296
|
+
);
|
|
105297
|
+
}
|
|
105298
|
+
const workspaceRoot = getWorkspaceRoot2();
|
|
105299
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
105300
|
+
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
105301
|
+
const projectName = context.projectsConfigurations.projects[context.projectName].name;
|
|
105261
105302
|
let config;
|
|
105262
105303
|
if (!executorOptions.skipReadingConfig) {
|
|
105263
105304
|
const configFile = await getConfigFile();
|
|
@@ -105268,8 +105309,21 @@ var withRunExecutor = (name, executorFn, executorOptions = { skipReadingConfig:
|
|
|
105268
105309
|
});
|
|
105269
105310
|
setConfigEnv(config);
|
|
105270
105311
|
console.debug(`Loaded Storm config into env:
|
|
105271
|
-
${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\n")}`);
|
|
105312
|
+
${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\n")}`);
|
|
105272
105313
|
}
|
|
105314
|
+
const tokenized = applyWorkspaceTokens(
|
|
105315
|
+
options,
|
|
105316
|
+
{
|
|
105317
|
+
config,
|
|
105318
|
+
workspaceRoot,
|
|
105319
|
+
projectRoot,
|
|
105320
|
+
sourceRoot,
|
|
105321
|
+
projectName,
|
|
105322
|
+
...context.projectsConfigurations.projects[context.projectName],
|
|
105323
|
+
...executorOptions
|
|
105324
|
+
},
|
|
105325
|
+
applyWorkspaceExecutorTokens
|
|
105326
|
+
);
|
|
105273
105327
|
const result = await Promise.resolve(
|
|
105274
105328
|
executorFn(tokenized, context, config)
|
|
105275
105329
|
);
|
|
@@ -111834,28 +111888,9 @@ var outExtension = ({ format: format2 }) => {
|
|
|
111834
111888
|
};
|
|
111835
111889
|
|
|
111836
111890
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
111837
|
-
async function
|
|
111891
|
+
async function tsupExecutorFn(options, context) {
|
|
111838
111892
|
try {
|
|
111839
111893
|
console.log("\u{1F4E6} Running Storm build executor on the workspace");
|
|
111840
|
-
options.entry ??= "{sourceRoot}/index.ts";
|
|
111841
|
-
options.outputPath ??= "dist/{projectRoot}";
|
|
111842
|
-
options.tsConfig ??= "tsconfig.json";
|
|
111843
|
-
options.platform ??= "neutral";
|
|
111844
|
-
options.verbose ??= false;
|
|
111845
|
-
options.external ??= [];
|
|
111846
|
-
options.additionalEntryPoints ??= [];
|
|
111847
|
-
options.assets ??= [];
|
|
111848
|
-
options.plugins ??= [];
|
|
111849
|
-
options.includeSrc ??= true;
|
|
111850
|
-
options.clean ??= true;
|
|
111851
|
-
options.bundle ??= true;
|
|
111852
|
-
options.debug ??= false;
|
|
111853
|
-
options.watch ??= false;
|
|
111854
|
-
options.apiReport ??= true;
|
|
111855
|
-
options.docModel ??= true;
|
|
111856
|
-
options.tsdocMetadata ??= true;
|
|
111857
|
-
options.define ??= {};
|
|
111858
|
-
options.env ??= {};
|
|
111859
111894
|
options.verbose && console.log(
|
|
111860
111895
|
`\u2699\uFE0F Executor options:
|
|
111861
111896
|
${Object.keys(options).map(
|
|
@@ -111871,17 +111906,9 @@ ${Object.keys(options).map(
|
|
|
111871
111906
|
const workspaceRoot = getWorkspaceRoot2();
|
|
111872
111907
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
111873
111908
|
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
111874
|
-
const outputPath = applyWorkspaceTokens(
|
|
111875
|
-
options.outputPath ? options.outputPath : "dist/{projectRoot}",
|
|
111876
|
-
context
|
|
111877
|
-
);
|
|
111878
|
-
options.entry = applyWorkspaceTokens(
|
|
111879
|
-
options.entry ? options.entry : "{sourceRoot}/index.ts",
|
|
111880
|
-
context
|
|
111881
|
-
);
|
|
111882
111909
|
if (options.clean !== false) {
|
|
111883
|
-
console.log(`\u{1F9F9} Cleaning output path: ${outputPath}`);
|
|
111884
|
-
(0, import_fs_extra.removeSync)(outputPath);
|
|
111910
|
+
console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
111911
|
+
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
111885
111912
|
}
|
|
111886
111913
|
const assets = Array.from(options.assets);
|
|
111887
111914
|
assets.push({
|
|
@@ -111902,7 +111929,7 @@ ${Object.keys(options).map(
|
|
|
111902
111929
|
});
|
|
111903
111930
|
}
|
|
111904
111931
|
const result = await (0, import_js.copyAssets)(
|
|
111905
|
-
{ assets, watch: options.watch, outputPath },
|
|
111932
|
+
{ assets, watch: options.watch, outputPath: options.outputPath },
|
|
111906
111933
|
context
|
|
111907
111934
|
);
|
|
111908
111935
|
if (!result.success) {
|
|
@@ -112031,7 +112058,11 @@ ${externalDependencies.map((dep) => {
|
|
|
112031
112058
|
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
112032
112059
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
112033
112060
|
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
112034
|
-
const packageJsonPath = (0, import_path4.join)(
|
|
112061
|
+
const packageJsonPath = (0, import_path4.join)(
|
|
112062
|
+
context.root,
|
|
112063
|
+
options.outputPath,
|
|
112064
|
+
"package.json"
|
|
112065
|
+
);
|
|
112035
112066
|
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
112036
112067
|
(0, import_fs3.writeFileSync)(
|
|
112037
112068
|
packageJsonPath,
|
|
@@ -112053,10 +112084,10 @@ ${externalDependencies.map((dep) => {
|
|
|
112053
112084
|
);
|
|
112054
112085
|
if (options.includeSrc !== false) {
|
|
112055
112086
|
const files = globSync([
|
|
112056
|
-
(0, import_devkit.joinPathFragments)(context.root, outputPath, "src/**/*.ts"),
|
|
112057
|
-
(0, import_devkit.joinPathFragments)(context.root, outputPath, "src/**/*.tsx"),
|
|
112058
|
-
(0, import_devkit.joinPathFragments)(context.root, outputPath, "src/**/*.js"),
|
|
112059
|
-
(0, import_devkit.joinPathFragments)(context.root, outputPath, "src/**/*.jsx")
|
|
112087
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
|
|
112088
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
|
|
112089
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
|
|
112090
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
|
|
112060
112091
|
]);
|
|
112061
112092
|
await Promise.allSettled(
|
|
112062
112093
|
files.map(
|
|
@@ -112082,7 +112113,7 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
|
|
|
112082
112113
|
...options,
|
|
112083
112114
|
dtsTsConfig: getNormalizedTsConfig(
|
|
112084
112115
|
context.root,
|
|
112085
|
-
outputPath,
|
|
112116
|
+
options.outputPath,
|
|
112086
112117
|
(0, import_tsc.createTypeScriptCompilationOptions)(
|
|
112087
112118
|
(0, import_normalize_options.normalizeOptions)(
|
|
112088
112119
|
{
|
|
@@ -112108,7 +112139,7 @@ ${options.banner}
|
|
|
112108
112139
|
|
|
112109
112140
|
`
|
|
112110
112141
|
} : void 0,
|
|
112111
|
-
outputPath
|
|
112142
|
+
outputPath: options.outputPath
|
|
112112
112143
|
});
|
|
112113
112144
|
if (typeof config === "function") {
|
|
112114
112145
|
await build(await Promise.resolve(config({})));
|
|
@@ -112171,12 +112202,41 @@ var isPrimitive = (value) => {
|
|
|
112171
112202
|
return false;
|
|
112172
112203
|
}
|
|
112173
112204
|
};
|
|
112174
|
-
var
|
|
112205
|
+
var applyDefault = (options) => {
|
|
112206
|
+
options.entry ??= "{sourceRoot}/index.ts";
|
|
112207
|
+
options.outputPath ??= "dist/{projectRoot}";
|
|
112208
|
+
options.tsConfig ??= "tsconfig.json";
|
|
112209
|
+
options.platform ??= "neutral";
|
|
112210
|
+
options.verbose ??= false;
|
|
112211
|
+
options.external ??= [];
|
|
112212
|
+
options.additionalEntryPoints ??= [];
|
|
112213
|
+
options.assets ??= [];
|
|
112214
|
+
options.plugins ??= [];
|
|
112215
|
+
options.includeSrc ??= true;
|
|
112216
|
+
options.clean ??= true;
|
|
112217
|
+
options.bundle ??= true;
|
|
112218
|
+
options.debug ??= false;
|
|
112219
|
+
options.watch ??= false;
|
|
112220
|
+
options.apiReport ??= true;
|
|
112221
|
+
options.docModel ??= true;
|
|
112222
|
+
options.tsdocMetadata ??= true;
|
|
112223
|
+
options.define ??= {};
|
|
112224
|
+
options.env ??= {};
|
|
112225
|
+
return options;
|
|
112226
|
+
};
|
|
112227
|
+
var executor_default = withRunExecutor(
|
|
112228
|
+
"TypeScript Build using tsup",
|
|
112229
|
+
tsupExecutorFn,
|
|
112230
|
+
{
|
|
112231
|
+
skipReadingConfig: false,
|
|
112232
|
+
applyDefaultFn: applyDefault
|
|
112233
|
+
}
|
|
112234
|
+
);
|
|
112175
112235
|
|
|
112176
112236
|
// packages/workspace-tools/src/executors/tsup-neutral/executor.ts
|
|
112177
112237
|
var tsNeutralBuildExecutorFn = (options, context, config) => {
|
|
112178
112238
|
options.plugins ??= [];
|
|
112179
|
-
return
|
|
112239
|
+
return tsupExecutorFn(
|
|
112180
112240
|
{
|
|
112181
112241
|
...options,
|
|
112182
112242
|
platform: "neutral",
|
|
@@ -112197,9 +112257,18 @@ var tsNeutralBuildExecutorFn = (options, context, config) => {
|
|
|
112197
112257
|
context
|
|
112198
112258
|
);
|
|
112199
112259
|
};
|
|
112260
|
+
var applyDefault2 = (options) => {
|
|
112261
|
+
options = applyDefault({ ...options, platform: "neutral" });
|
|
112262
|
+
options.plugins ??= [];
|
|
112263
|
+
return options;
|
|
112264
|
+
};
|
|
112200
112265
|
var executor_default2 = withRunExecutor(
|
|
112201
112266
|
"TypeScript Build (Neutral Platform)",
|
|
112202
|
-
tsNeutralBuildExecutorFn
|
|
112267
|
+
tsNeutralBuildExecutorFn,
|
|
112268
|
+
{
|
|
112269
|
+
skipReadingConfig: false,
|
|
112270
|
+
applyDefaultFn: applyDefault2
|
|
112271
|
+
}
|
|
112203
112272
|
);
|
|
112204
112273
|
// Annotate the CommonJS export names for ESM import in node:
|
|
112205
112274
|
0 && (module.exports = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { TsupExecutorSchema } from "../tsup/schema";
|
|
1
|
+
import { Platform, TsupExecutorSchema } from "../tsup/schema";
|
|
2
2
|
|
|
3
3
|
export type TsupNeutralExecutorSchema = Omit<
|
|
4
4
|
TsupExecutorSchema,
|
|
5
5
|
"env" | "platform"
|
|
6
6
|
> & {
|
|
7
7
|
transports?: string[];
|
|
8
|
+
platform?: Platform;
|
|
8
9
|
};
|
|
@@ -105336,26 +105336,39 @@ var getWorkspaceRoot2 = () => {
|
|
|
105336
105336
|
};
|
|
105337
105337
|
|
|
105338
105338
|
// packages/workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
105339
|
-
var
|
|
105339
|
+
var applyWorkspaceExecutorTokens = (option, tokenizerOptions) => {
|
|
105340
|
+
console.log("applyWorkspaceExecutorTokens", option);
|
|
105340
105341
|
let result = option;
|
|
105341
105342
|
if (!result) {
|
|
105342
105343
|
return result;
|
|
105343
105344
|
}
|
|
105344
|
-
const workspaceRoot = getWorkspaceRoot2();
|
|
105345
105345
|
let projectName;
|
|
105346
105346
|
let projectRoot;
|
|
105347
105347
|
let sourceRoot;
|
|
105348
|
-
if (
|
|
105349
|
-
const context =
|
|
105348
|
+
if (tokenizerOptions?.projectName) {
|
|
105349
|
+
const context = tokenizerOptions;
|
|
105350
105350
|
projectName = context.projectName;
|
|
105351
|
-
projectRoot = context.
|
|
105352
|
-
sourceRoot = context.
|
|
105351
|
+
projectRoot = context.root;
|
|
105352
|
+
sourceRoot = context.sourceRoot;
|
|
105353
105353
|
} else {
|
|
105354
|
-
const projectConfig =
|
|
105354
|
+
const projectConfig = tokenizerOptions;
|
|
105355
105355
|
projectName = projectConfig.name;
|
|
105356
105356
|
projectRoot = projectConfig.root;
|
|
105357
105357
|
sourceRoot = projectConfig.sourceRoot;
|
|
105358
105358
|
}
|
|
105359
|
+
if (tokenizerOptions.config) {
|
|
105360
|
+
const configKeys = Object.keys(tokenizerOptions.config);
|
|
105361
|
+
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
|
|
105362
|
+
configKeys.forEach((configKey) => {
|
|
105363
|
+
if (result.includes(`{${configKey}}`)) {
|
|
105364
|
+
result = result.replaceAll(
|
|
105365
|
+
`{${configKey}}`,
|
|
105366
|
+
tokenizerOptions.config[configKey]
|
|
105367
|
+
);
|
|
105368
|
+
}
|
|
105369
|
+
});
|
|
105370
|
+
}
|
|
105371
|
+
}
|
|
105359
105372
|
if (result.includes("{projectName}")) {
|
|
105360
105373
|
result = result.replaceAll("{projectName}", projectName);
|
|
105361
105374
|
}
|
|
@@ -105366,28 +105379,56 @@ var applyWorkspaceTokens = (option, config) => {
|
|
|
105366
105379
|
result = result.replaceAll("{sourceRoot}", sourceRoot);
|
|
105367
105380
|
}
|
|
105368
105381
|
if (result.includes("{workspaceRoot}")) {
|
|
105369
|
-
result = result.replaceAll(
|
|
105382
|
+
result = result.replaceAll(
|
|
105383
|
+
"{workspaceRoot}",
|
|
105384
|
+
tokenizerOptions.workspaceRoot ?? getWorkspaceRoot2()
|
|
105385
|
+
);
|
|
105370
105386
|
}
|
|
105371
105387
|
return result;
|
|
105372
105388
|
};
|
|
105389
|
+
var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
105390
|
+
let result = options;
|
|
105391
|
+
if (!result) {
|
|
105392
|
+
return {};
|
|
105393
|
+
}
|
|
105394
|
+
return Object.keys(options).reduce(
|
|
105395
|
+
(ret, option) => {
|
|
105396
|
+
if (options[option] === void 0 || options[option] === null || typeof options[option] === "number" || typeof options[option] === "boolean" || typeof options[option] === "string") {
|
|
105397
|
+
ret[option] = tokenizerFn(option, config);
|
|
105398
|
+
} else if (Array.isArray(options[option])) {
|
|
105399
|
+
ret[option] = options[option].map(
|
|
105400
|
+
(item) => tokenizerFn(item, config)
|
|
105401
|
+
);
|
|
105402
|
+
} else if (typeof options[option] === "object") {
|
|
105403
|
+
ret[option] = tokenizerFn(options[option], config);
|
|
105404
|
+
}
|
|
105405
|
+
return ret;
|
|
105406
|
+
},
|
|
105407
|
+
{}
|
|
105408
|
+
);
|
|
105409
|
+
};
|
|
105373
105410
|
|
|
105374
105411
|
// packages/workspace-tools/src/base/base-executor.ts
|
|
105375
|
-
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
105412
|
+
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
105413
|
+
skipReadingConfig: false
|
|
105414
|
+
}) => async (options, context) => {
|
|
105376
105415
|
const startTime = Date.now();
|
|
105377
105416
|
try {
|
|
105378
105417
|
console.info(`\u26A1 Running the ${name} executor...`);
|
|
105379
|
-
|
|
105418
|
+
if (executorOptions?.applyDefaultFn) {
|
|
105419
|
+
options = executorOptions.applyDefaultFn(options);
|
|
105420
|
+
}
|
|
105421
|
+
console.debug(`\u2699\uFE0F Executor schema options:
|
|
105380
105422
|
`, options);
|
|
105381
|
-
|
|
105382
|
-
|
|
105383
|
-
|
|
105384
|
-
|
|
105385
|
-
|
|
105386
|
-
|
|
105387
|
-
|
|
105388
|
-
|
|
105389
|
-
|
|
105390
|
-
);
|
|
105423
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
105424
|
+
throw new Error(
|
|
105425
|
+
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
105426
|
+
);
|
|
105427
|
+
}
|
|
105428
|
+
const workspaceRoot = getWorkspaceRoot2();
|
|
105429
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
105430
|
+
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
105431
|
+
const projectName = context.projectsConfigurations.projects[context.projectName].name;
|
|
105391
105432
|
let config;
|
|
105392
105433
|
if (!executorOptions.skipReadingConfig) {
|
|
105393
105434
|
const configFile = await getConfigFile();
|
|
@@ -105398,8 +105439,21 @@ var withRunExecutor = (name, executorFn, executorOptions = { skipReadingConfig:
|
|
|
105398
105439
|
});
|
|
105399
105440
|
setConfigEnv(config);
|
|
105400
105441
|
console.debug(`Loaded Storm config into env:
|
|
105401
|
-
${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\n")}`);
|
|
105442
|
+
${Object.keys(process.env).map((key) => ` - ${key}=${process.env[key]}`).join("\n")}`);
|
|
105402
105443
|
}
|
|
105444
|
+
const tokenized = applyWorkspaceTokens(
|
|
105445
|
+
options,
|
|
105446
|
+
{
|
|
105447
|
+
config,
|
|
105448
|
+
workspaceRoot,
|
|
105449
|
+
projectRoot,
|
|
105450
|
+
sourceRoot,
|
|
105451
|
+
projectName,
|
|
105452
|
+
...context.projectsConfigurations.projects[context.projectName],
|
|
105453
|
+
...executorOptions
|
|
105454
|
+
},
|
|
105455
|
+
applyWorkspaceExecutorTokens
|
|
105456
|
+
);
|
|
105403
105457
|
const result = await Promise.resolve(
|
|
105404
105458
|
executorFn(tokenized, context, config)
|
|
105405
105459
|
);
|
|
@@ -111964,28 +112018,9 @@ var outExtension = ({ format: format2 }) => {
|
|
|
111964
112018
|
};
|
|
111965
112019
|
|
|
111966
112020
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
111967
|
-
async function
|
|
112021
|
+
async function tsupExecutorFn(options, context) {
|
|
111968
112022
|
try {
|
|
111969
112023
|
console.log("\u{1F4E6} Running Storm build executor on the workspace");
|
|
111970
|
-
options.entry ??= "{sourceRoot}/index.ts";
|
|
111971
|
-
options.outputPath ??= "dist/{projectRoot}";
|
|
111972
|
-
options.tsConfig ??= "tsconfig.json";
|
|
111973
|
-
options.platform ??= "neutral";
|
|
111974
|
-
options.verbose ??= false;
|
|
111975
|
-
options.external ??= [];
|
|
111976
|
-
options.additionalEntryPoints ??= [];
|
|
111977
|
-
options.assets ??= [];
|
|
111978
|
-
options.plugins ??= [];
|
|
111979
|
-
options.includeSrc ??= true;
|
|
111980
|
-
options.clean ??= true;
|
|
111981
|
-
options.bundle ??= true;
|
|
111982
|
-
options.debug ??= false;
|
|
111983
|
-
options.watch ??= false;
|
|
111984
|
-
options.apiReport ??= true;
|
|
111985
|
-
options.docModel ??= true;
|
|
111986
|
-
options.tsdocMetadata ??= true;
|
|
111987
|
-
options.define ??= {};
|
|
111988
|
-
options.env ??= {};
|
|
111989
112024
|
options.verbose && console.log(
|
|
111990
112025
|
`\u2699\uFE0F Executor options:
|
|
111991
112026
|
${Object.keys(options).map(
|
|
@@ -112001,17 +112036,9 @@ ${Object.keys(options).map(
|
|
|
112001
112036
|
const workspaceRoot = getWorkspaceRoot2();
|
|
112002
112037
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
112003
112038
|
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
112004
|
-
const outputPath = applyWorkspaceTokens(
|
|
112005
|
-
options.outputPath ? options.outputPath : "dist/{projectRoot}",
|
|
112006
|
-
context
|
|
112007
|
-
);
|
|
112008
|
-
options.entry = applyWorkspaceTokens(
|
|
112009
|
-
options.entry ? options.entry : "{sourceRoot}/index.ts",
|
|
112010
|
-
context
|
|
112011
|
-
);
|
|
112012
112039
|
if (options.clean !== false) {
|
|
112013
|
-
console.log(`\u{1F9F9} Cleaning output path: ${outputPath}`);
|
|
112014
|
-
(0, import_fs_extra.removeSync)(outputPath);
|
|
112040
|
+
console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
112041
|
+
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
112015
112042
|
}
|
|
112016
112043
|
const assets = Array.from(options.assets);
|
|
112017
112044
|
assets.push({
|
|
@@ -112032,7 +112059,7 @@ ${Object.keys(options).map(
|
|
|
112032
112059
|
});
|
|
112033
112060
|
}
|
|
112034
112061
|
const result = await (0, import_js.copyAssets)(
|
|
112035
|
-
{ assets, watch: options.watch, outputPath },
|
|
112062
|
+
{ assets, watch: options.watch, outputPath: options.outputPath },
|
|
112036
112063
|
context
|
|
112037
112064
|
);
|
|
112038
112065
|
if (!result.success) {
|
|
@@ -112161,7 +112188,11 @@ ${externalDependencies.map((dep) => {
|
|
|
112161
112188
|
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
112162
112189
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
112163
112190
|
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
112164
|
-
const packageJsonPath = (0, import_path4.join)(
|
|
112191
|
+
const packageJsonPath = (0, import_path4.join)(
|
|
112192
|
+
context.root,
|
|
112193
|
+
options.outputPath,
|
|
112194
|
+
"package.json"
|
|
112195
|
+
);
|
|
112165
112196
|
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
112166
112197
|
(0, import_fs3.writeFileSync)(
|
|
112167
112198
|
packageJsonPath,
|
|
@@ -112183,10 +112214,10 @@ ${externalDependencies.map((dep) => {
|
|
|
112183
112214
|
);
|
|
112184
112215
|
if (options.includeSrc !== false) {
|
|
112185
112216
|
const files = globSync([
|
|
112186
|
-
(0, import_devkit.joinPathFragments)(context.root, outputPath, "src/**/*.ts"),
|
|
112187
|
-
(0, import_devkit.joinPathFragments)(context.root, outputPath, "src/**/*.tsx"),
|
|
112188
|
-
(0, import_devkit.joinPathFragments)(context.root, outputPath, "src/**/*.js"),
|
|
112189
|
-
(0, import_devkit.joinPathFragments)(context.root, outputPath, "src/**/*.jsx")
|
|
112217
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
|
|
112218
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
|
|
112219
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
|
|
112220
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
|
|
112190
112221
|
]);
|
|
112191
112222
|
await Promise.allSettled(
|
|
112192
112223
|
files.map(
|
|
@@ -112212,7 +112243,7 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
|
|
|
112212
112243
|
...options,
|
|
112213
112244
|
dtsTsConfig: getNormalizedTsConfig(
|
|
112214
112245
|
context.root,
|
|
112215
|
-
outputPath,
|
|
112246
|
+
options.outputPath,
|
|
112216
112247
|
(0, import_tsc.createTypeScriptCompilationOptions)(
|
|
112217
112248
|
(0, import_normalize_options.normalizeOptions)(
|
|
112218
112249
|
{
|
|
@@ -112238,7 +112269,7 @@ ${options.banner}
|
|
|
112238
112269
|
|
|
112239
112270
|
`
|
|
112240
112271
|
} : void 0,
|
|
112241
|
-
outputPath
|
|
112272
|
+
outputPath: options.outputPath
|
|
112242
112273
|
});
|
|
112243
112274
|
if (typeof config === "function") {
|
|
112244
112275
|
await build(await Promise.resolve(config({})));
|
|
@@ -112301,16 +112332,43 @@ var isPrimitive = (value) => {
|
|
|
112301
112332
|
return false;
|
|
112302
112333
|
}
|
|
112303
112334
|
};
|
|
112304
|
-
var
|
|
112335
|
+
var applyDefault = (options) => {
|
|
112336
|
+
options.entry ??= "{sourceRoot}/index.ts";
|
|
112337
|
+
options.outputPath ??= "dist/{projectRoot}";
|
|
112338
|
+
options.tsConfig ??= "tsconfig.json";
|
|
112339
|
+
options.platform ??= "neutral";
|
|
112340
|
+
options.verbose ??= false;
|
|
112341
|
+
options.external ??= [];
|
|
112342
|
+
options.additionalEntryPoints ??= [];
|
|
112343
|
+
options.assets ??= [];
|
|
112344
|
+
options.plugins ??= [];
|
|
112345
|
+
options.includeSrc ??= true;
|
|
112346
|
+
options.clean ??= true;
|
|
112347
|
+
options.bundle ??= true;
|
|
112348
|
+
options.debug ??= false;
|
|
112349
|
+
options.watch ??= false;
|
|
112350
|
+
options.apiReport ??= true;
|
|
112351
|
+
options.docModel ??= true;
|
|
112352
|
+
options.tsdocMetadata ??= true;
|
|
112353
|
+
options.define ??= {};
|
|
112354
|
+
options.env ??= {};
|
|
112355
|
+
return options;
|
|
112356
|
+
};
|
|
112357
|
+
var executor_default = withRunExecutor(
|
|
112358
|
+
"TypeScript Build using tsup",
|
|
112359
|
+
tsupExecutorFn,
|
|
112360
|
+
{
|
|
112361
|
+
skipReadingConfig: false,
|
|
112362
|
+
applyDefaultFn: applyDefault
|
|
112363
|
+
}
|
|
112364
|
+
);
|
|
112305
112365
|
|
|
112306
112366
|
// packages/workspace-tools/src/executors/tsup-node/executor.ts
|
|
112307
112367
|
var tsNodeBuildExecutorFn = (options, context, config) => {
|
|
112308
|
-
options.plugins ??= [];
|
|
112309
|
-
options.transports ??= ["pino-pretty", "pino-loki"];
|
|
112310
112368
|
if (options.transports && Array.isArray(options.transports) && options.transports.length > 0) {
|
|
112311
112369
|
options.plugins.push(esbuildPluginPino({ transports: options.transports }));
|
|
112312
112370
|
}
|
|
112313
|
-
return
|
|
112371
|
+
return tsupExecutorFn(
|
|
112314
112372
|
{
|
|
112315
112373
|
...options,
|
|
112316
112374
|
platform: "node",
|
|
@@ -112331,9 +112389,19 @@ var tsNodeBuildExecutorFn = (options, context, config) => {
|
|
|
112331
112389
|
context
|
|
112332
112390
|
);
|
|
112333
112391
|
};
|
|
112392
|
+
var applyDefault2 = (options) => {
|
|
112393
|
+
options = applyDefault({ ...options, platform: "node" });
|
|
112394
|
+
options.plugins ??= [];
|
|
112395
|
+
options.transports ??= ["pino-pretty", "pino-loki"];
|
|
112396
|
+
return options;
|
|
112397
|
+
};
|
|
112334
112398
|
var executor_default2 = withRunExecutor(
|
|
112335
112399
|
"TypeScript Build (NodeJs Platform)",
|
|
112336
|
-
tsNodeBuildExecutorFn
|
|
112400
|
+
tsNodeBuildExecutorFn,
|
|
112401
|
+
{
|
|
112402
|
+
skipReadingConfig: false,
|
|
112403
|
+
applyDefaultFn: applyDefault2
|
|
112404
|
+
}
|
|
112337
112405
|
);
|
|
112338
112406
|
// Annotate the CommonJS export names for ESM import in node:
|
|
112339
112407
|
0 && (module.exports = {
|