@storm-software/workspace-tools 1.19.3 → 1.20.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/index.js +159 -67
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/base/index.js +83 -19
- package/src/executors/tsup/executor.js +6827 -103
- package/src/executors/tsup/schema.d.ts +3 -3
- package/src/executors/tsup-neutral/executor.js +111 -57
- package/src/executors/tsup-neutral/schema.d.ts +2 -1
- package/src/executors/tsup-node/executor.js +112 -59
- 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 +46 -6
|
@@ -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,20 +105206,19 @@ var getWorkspaceRoot2 = () => {
|
|
|
105206
105206
|
};
|
|
105207
105207
|
|
|
105208
105208
|
// packages/workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
105209
|
-
var
|
|
105209
|
+
var applyWorkspaceExecutorTokens = (option, config) => {
|
|
105210
105210
|
let result = option;
|
|
105211
105211
|
if (!result) {
|
|
105212
105212
|
return result;
|
|
105213
105213
|
}
|
|
105214
|
-
const workspaceRoot = getWorkspaceRoot2();
|
|
105215
105214
|
let projectName;
|
|
105216
105215
|
let projectRoot;
|
|
105217
105216
|
let sourceRoot;
|
|
105218
|
-
if (config?.
|
|
105217
|
+
if (config?.projectName) {
|
|
105219
105218
|
const context = config;
|
|
105220
105219
|
projectName = context.projectName;
|
|
105221
|
-
projectRoot = context.
|
|
105222
|
-
sourceRoot = context.
|
|
105220
|
+
projectRoot = context.root;
|
|
105221
|
+
sourceRoot = context.sourceRoot;
|
|
105223
105222
|
} else {
|
|
105224
105223
|
const projectConfig = config;
|
|
105225
105224
|
projectName = projectConfig.name;
|
|
@@ -105236,27 +105235,67 @@ var applyWorkspaceTokens = (option, config) => {
|
|
|
105236
105235
|
result = result.replaceAll("{sourceRoot}", sourceRoot);
|
|
105237
105236
|
}
|
|
105238
105237
|
if (result.includes("{workspaceRoot}")) {
|
|
105239
|
-
result = result.replaceAll(
|
|
105238
|
+
result = result.replaceAll(
|
|
105239
|
+
"{workspaceRoot}",
|
|
105240
|
+
config.workspaceRoot ?? getWorkspaceRoot2()
|
|
105241
|
+
);
|
|
105240
105242
|
}
|
|
105241
105243
|
return result;
|
|
105242
105244
|
};
|
|
105245
|
+
var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
105246
|
+
let result = options;
|
|
105247
|
+
if (!result) {
|
|
105248
|
+
return {};
|
|
105249
|
+
}
|
|
105250
|
+
return Object.keys(options).reduce(
|
|
105251
|
+
(ret, option) => {
|
|
105252
|
+
if (options[option] === void 0 || options[option] === null || typeof options[option] === "number" || typeof options[option] === "boolean" || typeof options[option] === "string") {
|
|
105253
|
+
ret[option] = tokenizerFn(option, config);
|
|
105254
|
+
} else if (Array.isArray(options[option])) {
|
|
105255
|
+
ret[option] = options[option].map(
|
|
105256
|
+
(item) => tokenizerFn(item, config)
|
|
105257
|
+
);
|
|
105258
|
+
} else if (typeof options[option] === "object") {
|
|
105259
|
+
ret[option] = tokenizerFn(options[option], config);
|
|
105260
|
+
}
|
|
105261
|
+
return ret;
|
|
105262
|
+
},
|
|
105263
|
+
{}
|
|
105264
|
+
);
|
|
105265
|
+
};
|
|
105243
105266
|
|
|
105244
105267
|
// packages/workspace-tools/src/base/base-executor.ts
|
|
105245
|
-
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
105268
|
+
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
105269
|
+
skipReadingConfig: false
|
|
105270
|
+
}) => async (options, context) => {
|
|
105246
105271
|
const startTime = Date.now();
|
|
105247
105272
|
try {
|
|
105248
105273
|
console.info(`\u26A1 Running the ${name} executor...`);
|
|
105249
|
-
|
|
105274
|
+
if (executorOptions?.applyDefaultFn) {
|
|
105275
|
+
options = executorOptions.applyDefaultFn(options);
|
|
105276
|
+
}
|
|
105277
|
+
console.debug(`\u2699\uFE0F Executor schema options:
|
|
105250
105278
|
`, options);
|
|
105251
|
-
|
|
105252
|
-
|
|
105253
|
-
|
|
105254
|
-
|
|
105255
|
-
|
|
105256
|
-
|
|
105257
|
-
|
|
105279
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
105280
|
+
throw new Error(
|
|
105281
|
+
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
105282
|
+
);
|
|
105283
|
+
}
|
|
105284
|
+
const workspaceRoot = getWorkspaceRoot2();
|
|
105285
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
105286
|
+
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
105287
|
+
const projectName = context.projectsConfigurations.projects[context.projectName].name;
|
|
105288
|
+
const tokenized = applyWorkspaceTokens(
|
|
105289
|
+
options,
|
|
105290
|
+
{
|
|
105291
|
+
workspaceRoot,
|
|
105292
|
+
projectRoot,
|
|
105293
|
+
sourceRoot,
|
|
105294
|
+
projectName,
|
|
105295
|
+
...context.projectsConfigurations.projects[context.projectName],
|
|
105296
|
+
...executorOptions
|
|
105258
105297
|
},
|
|
105259
|
-
|
|
105298
|
+
applyWorkspaceExecutorTokens
|
|
105260
105299
|
);
|
|
105261
105300
|
let config;
|
|
105262
105301
|
if (!executorOptions.skipReadingConfig) {
|
|
@@ -111834,28 +111873,9 @@ var outExtension = ({ format: format2 }) => {
|
|
|
111834
111873
|
};
|
|
111835
111874
|
|
|
111836
111875
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
111837
|
-
async function
|
|
111876
|
+
async function tsupExecutorFn(options, context) {
|
|
111838
111877
|
try {
|
|
111839
111878
|
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
111879
|
options.verbose && console.log(
|
|
111860
111880
|
`\u2699\uFE0F Executor options:
|
|
111861
111881
|
${Object.keys(options).map(
|
|
@@ -111871,17 +111891,9 @@ ${Object.keys(options).map(
|
|
|
111871
111891
|
const workspaceRoot = getWorkspaceRoot2();
|
|
111872
111892
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
111873
111893
|
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
111894
|
if (options.clean !== false) {
|
|
111883
|
-
console.log(`\u{1F9F9} Cleaning output path: ${outputPath}`);
|
|
111884
|
-
(0, import_fs_extra.removeSync)(outputPath);
|
|
111895
|
+
console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
111896
|
+
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
111885
111897
|
}
|
|
111886
111898
|
const assets = Array.from(options.assets);
|
|
111887
111899
|
assets.push({
|
|
@@ -111902,7 +111914,7 @@ ${Object.keys(options).map(
|
|
|
111902
111914
|
});
|
|
111903
111915
|
}
|
|
111904
111916
|
const result = await (0, import_js.copyAssets)(
|
|
111905
|
-
{ assets, watch: options.watch, outputPath },
|
|
111917
|
+
{ assets, watch: options.watch, outputPath: options.outputPath },
|
|
111906
111918
|
context
|
|
111907
111919
|
);
|
|
111908
111920
|
if (!result.success) {
|
|
@@ -112031,7 +112043,11 @@ ${externalDependencies.map((dep) => {
|
|
|
112031
112043
|
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
112032
112044
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
112033
112045
|
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
112034
|
-
const packageJsonPath = (0, import_path4.join)(
|
|
112046
|
+
const packageJsonPath = (0, import_path4.join)(
|
|
112047
|
+
context.root,
|
|
112048
|
+
options.outputPath,
|
|
112049
|
+
"package.json"
|
|
112050
|
+
);
|
|
112035
112051
|
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
112036
112052
|
(0, import_fs3.writeFileSync)(
|
|
112037
112053
|
packageJsonPath,
|
|
@@ -112053,10 +112069,10 @@ ${externalDependencies.map((dep) => {
|
|
|
112053
112069
|
);
|
|
112054
112070
|
if (options.includeSrc !== false) {
|
|
112055
112071
|
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")
|
|
112072
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
|
|
112073
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
|
|
112074
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
|
|
112075
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
|
|
112060
112076
|
]);
|
|
112061
112077
|
await Promise.allSettled(
|
|
112062
112078
|
files.map(
|
|
@@ -112082,7 +112098,7 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
|
|
|
112082
112098
|
...options,
|
|
112083
112099
|
dtsTsConfig: getNormalizedTsConfig(
|
|
112084
112100
|
context.root,
|
|
112085
|
-
outputPath,
|
|
112101
|
+
options.outputPath,
|
|
112086
112102
|
(0, import_tsc.createTypeScriptCompilationOptions)(
|
|
112087
112103
|
(0, import_normalize_options.normalizeOptions)(
|
|
112088
112104
|
{
|
|
@@ -112108,7 +112124,7 @@ ${options.banner}
|
|
|
112108
112124
|
|
|
112109
112125
|
`
|
|
112110
112126
|
} : void 0,
|
|
112111
|
-
outputPath
|
|
112127
|
+
outputPath: options.outputPath
|
|
112112
112128
|
});
|
|
112113
112129
|
if (typeof config === "function") {
|
|
112114
112130
|
await build(await Promise.resolve(config({})));
|
|
@@ -112171,12 +112187,41 @@ var isPrimitive = (value) => {
|
|
|
112171
112187
|
return false;
|
|
112172
112188
|
}
|
|
112173
112189
|
};
|
|
112174
|
-
var
|
|
112190
|
+
var applyDefault = (options) => {
|
|
112191
|
+
options.entry ??= "{sourceRoot}/index.ts";
|
|
112192
|
+
options.outputPath ??= "dist/{projectRoot}";
|
|
112193
|
+
options.tsConfig ??= "tsconfig.json";
|
|
112194
|
+
options.platform ??= "neutral";
|
|
112195
|
+
options.verbose ??= false;
|
|
112196
|
+
options.external ??= [];
|
|
112197
|
+
options.additionalEntryPoints ??= [];
|
|
112198
|
+
options.assets ??= [];
|
|
112199
|
+
options.plugins ??= [];
|
|
112200
|
+
options.includeSrc ??= true;
|
|
112201
|
+
options.clean ??= true;
|
|
112202
|
+
options.bundle ??= true;
|
|
112203
|
+
options.debug ??= false;
|
|
112204
|
+
options.watch ??= false;
|
|
112205
|
+
options.apiReport ??= true;
|
|
112206
|
+
options.docModel ??= true;
|
|
112207
|
+
options.tsdocMetadata ??= true;
|
|
112208
|
+
options.define ??= {};
|
|
112209
|
+
options.env ??= {};
|
|
112210
|
+
return options;
|
|
112211
|
+
};
|
|
112212
|
+
var executor_default = withRunExecutor(
|
|
112213
|
+
"TypeScript Build using tsup",
|
|
112214
|
+
tsupExecutorFn,
|
|
112215
|
+
{
|
|
112216
|
+
skipReadingConfig: false,
|
|
112217
|
+
applyDefaultFn: applyDefault
|
|
112218
|
+
}
|
|
112219
|
+
);
|
|
112175
112220
|
|
|
112176
112221
|
// packages/workspace-tools/src/executors/tsup-neutral/executor.ts
|
|
112177
112222
|
var tsNeutralBuildExecutorFn = (options, context, config) => {
|
|
112178
112223
|
options.plugins ??= [];
|
|
112179
|
-
return
|
|
112224
|
+
return tsupExecutorFn(
|
|
112180
112225
|
{
|
|
112181
112226
|
...options,
|
|
112182
112227
|
platform: "neutral",
|
|
@@ -112197,9 +112242,18 @@ var tsNeutralBuildExecutorFn = (options, context, config) => {
|
|
|
112197
112242
|
context
|
|
112198
112243
|
);
|
|
112199
112244
|
};
|
|
112245
|
+
var applyDefault2 = (options) => {
|
|
112246
|
+
options = applyDefault({ ...options, platform: "neutral" });
|
|
112247
|
+
options.plugins ??= [];
|
|
112248
|
+
return options;
|
|
112249
|
+
};
|
|
112200
112250
|
var executor_default2 = withRunExecutor(
|
|
112201
112251
|
"TypeScript Build (Neutral Platform)",
|
|
112202
|
-
tsNeutralBuildExecutorFn
|
|
112252
|
+
tsNeutralBuildExecutorFn,
|
|
112253
|
+
{
|
|
112254
|
+
skipReadingConfig: false,
|
|
112255
|
+
applyDefaultFn: applyDefault2
|
|
112256
|
+
}
|
|
112203
112257
|
);
|
|
112204
112258
|
// Annotate the CommonJS export names for ESM import in node:
|
|
112205
112259
|
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,20 +105336,19 @@ var getWorkspaceRoot2 = () => {
|
|
|
105336
105336
|
};
|
|
105337
105337
|
|
|
105338
105338
|
// packages/workspace-tools/src/utils/apply-workspace-tokens.ts
|
|
105339
|
-
var
|
|
105339
|
+
var applyWorkspaceExecutorTokens = (option, config) => {
|
|
105340
105340
|
let result = option;
|
|
105341
105341
|
if (!result) {
|
|
105342
105342
|
return result;
|
|
105343
105343
|
}
|
|
105344
|
-
const workspaceRoot = getWorkspaceRoot2();
|
|
105345
105344
|
let projectName;
|
|
105346
105345
|
let projectRoot;
|
|
105347
105346
|
let sourceRoot;
|
|
105348
|
-
if (config?.
|
|
105347
|
+
if (config?.projectName) {
|
|
105349
105348
|
const context = config;
|
|
105350
105349
|
projectName = context.projectName;
|
|
105351
|
-
projectRoot = context.
|
|
105352
|
-
sourceRoot = context.
|
|
105350
|
+
projectRoot = context.root;
|
|
105351
|
+
sourceRoot = context.sourceRoot;
|
|
105353
105352
|
} else {
|
|
105354
105353
|
const projectConfig = config;
|
|
105355
105354
|
projectName = projectConfig.name;
|
|
@@ -105366,27 +105365,67 @@ var applyWorkspaceTokens = (option, config) => {
|
|
|
105366
105365
|
result = result.replaceAll("{sourceRoot}", sourceRoot);
|
|
105367
105366
|
}
|
|
105368
105367
|
if (result.includes("{workspaceRoot}")) {
|
|
105369
|
-
result = result.replaceAll(
|
|
105368
|
+
result = result.replaceAll(
|
|
105369
|
+
"{workspaceRoot}",
|
|
105370
|
+
config.workspaceRoot ?? getWorkspaceRoot2()
|
|
105371
|
+
);
|
|
105370
105372
|
}
|
|
105371
105373
|
return result;
|
|
105372
105374
|
};
|
|
105375
|
+
var applyWorkspaceTokens = (options, config, tokenizerFn) => {
|
|
105376
|
+
let result = options;
|
|
105377
|
+
if (!result) {
|
|
105378
|
+
return {};
|
|
105379
|
+
}
|
|
105380
|
+
return Object.keys(options).reduce(
|
|
105381
|
+
(ret, option) => {
|
|
105382
|
+
if (options[option] === void 0 || options[option] === null || typeof options[option] === "number" || typeof options[option] === "boolean" || typeof options[option] === "string") {
|
|
105383
|
+
ret[option] = tokenizerFn(option, config);
|
|
105384
|
+
} else if (Array.isArray(options[option])) {
|
|
105385
|
+
ret[option] = options[option].map(
|
|
105386
|
+
(item) => tokenizerFn(item, config)
|
|
105387
|
+
);
|
|
105388
|
+
} else if (typeof options[option] === "object") {
|
|
105389
|
+
ret[option] = tokenizerFn(options[option], config);
|
|
105390
|
+
}
|
|
105391
|
+
return ret;
|
|
105392
|
+
},
|
|
105393
|
+
{}
|
|
105394
|
+
);
|
|
105395
|
+
};
|
|
105373
105396
|
|
|
105374
105397
|
// packages/workspace-tools/src/base/base-executor.ts
|
|
105375
|
-
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
105398
|
+
var withRunExecutor = (name, executorFn, executorOptions = {
|
|
105399
|
+
skipReadingConfig: false
|
|
105400
|
+
}) => async (options, context) => {
|
|
105376
105401
|
const startTime = Date.now();
|
|
105377
105402
|
try {
|
|
105378
105403
|
console.info(`\u26A1 Running the ${name} executor...`);
|
|
105379
|
-
|
|
105404
|
+
if (executorOptions?.applyDefaultFn) {
|
|
105405
|
+
options = executorOptions.applyDefaultFn(options);
|
|
105406
|
+
}
|
|
105407
|
+
console.debug(`\u2699\uFE0F Executor schema options:
|
|
105380
105408
|
`, options);
|
|
105381
|
-
|
|
105382
|
-
|
|
105383
|
-
|
|
105384
|
-
|
|
105385
|
-
|
|
105386
|
-
|
|
105387
|
-
|
|
105409
|
+
if (!context.projectsConfigurations?.projects || !context.projectName || !context.projectsConfigurations.projects[context.projectName]) {
|
|
105410
|
+
throw new Error(
|
|
105411
|
+
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
105412
|
+
);
|
|
105413
|
+
}
|
|
105414
|
+
const workspaceRoot = getWorkspaceRoot2();
|
|
105415
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
105416
|
+
const sourceRoot = context.projectsConfigurations.projects[context.projectName].sourceRoot;
|
|
105417
|
+
const projectName = context.projectsConfigurations.projects[context.projectName].name;
|
|
105418
|
+
const tokenized = applyWorkspaceTokens(
|
|
105419
|
+
options,
|
|
105420
|
+
{
|
|
105421
|
+
workspaceRoot,
|
|
105422
|
+
projectRoot,
|
|
105423
|
+
sourceRoot,
|
|
105424
|
+
projectName,
|
|
105425
|
+
...context.projectsConfigurations.projects[context.projectName],
|
|
105426
|
+
...executorOptions
|
|
105388
105427
|
},
|
|
105389
|
-
|
|
105428
|
+
applyWorkspaceExecutorTokens
|
|
105390
105429
|
);
|
|
105391
105430
|
let config;
|
|
105392
105431
|
if (!executorOptions.skipReadingConfig) {
|
|
@@ -111964,28 +112003,9 @@ var outExtension = ({ format: format2 }) => {
|
|
|
111964
112003
|
};
|
|
111965
112004
|
|
|
111966
112005
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
111967
|
-
async function
|
|
112006
|
+
async function tsupExecutorFn(options, context) {
|
|
111968
112007
|
try {
|
|
111969
112008
|
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
112009
|
options.verbose && console.log(
|
|
111990
112010
|
`\u2699\uFE0F Executor options:
|
|
111991
112011
|
${Object.keys(options).map(
|
|
@@ -112001,17 +112021,9 @@ ${Object.keys(options).map(
|
|
|
112001
112021
|
const workspaceRoot = getWorkspaceRoot2();
|
|
112002
112022
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
112003
112023
|
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
112024
|
if (options.clean !== false) {
|
|
112013
|
-
console.log(`\u{1F9F9} Cleaning output path: ${outputPath}`);
|
|
112014
|
-
(0, import_fs_extra.removeSync)(outputPath);
|
|
112025
|
+
console.log(`\u{1F9F9} Cleaning output path: ${options.outputPath}`);
|
|
112026
|
+
(0, import_fs_extra.removeSync)(options.outputPath);
|
|
112015
112027
|
}
|
|
112016
112028
|
const assets = Array.from(options.assets);
|
|
112017
112029
|
assets.push({
|
|
@@ -112032,7 +112044,7 @@ ${Object.keys(options).map(
|
|
|
112032
112044
|
});
|
|
112033
112045
|
}
|
|
112034
112046
|
const result = await (0, import_js.copyAssets)(
|
|
112035
|
-
{ assets, watch: options.watch, outputPath },
|
|
112047
|
+
{ assets, watch: options.watch, outputPath: options.outputPath },
|
|
112036
112048
|
context
|
|
112037
112049
|
);
|
|
112038
112050
|
if (!result.success) {
|
|
@@ -112161,7 +112173,11 @@ ${externalDependencies.map((dep) => {
|
|
|
112161
112173
|
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
112162
112174
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
112163
112175
|
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
112164
|
-
const packageJsonPath = (0, import_path4.join)(
|
|
112176
|
+
const packageJsonPath = (0, import_path4.join)(
|
|
112177
|
+
context.root,
|
|
112178
|
+
options.outputPath,
|
|
112179
|
+
"package.json"
|
|
112180
|
+
);
|
|
112165
112181
|
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
112166
112182
|
(0, import_fs3.writeFileSync)(
|
|
112167
112183
|
packageJsonPath,
|
|
@@ -112183,10 +112199,10 @@ ${externalDependencies.map((dep) => {
|
|
|
112183
112199
|
);
|
|
112184
112200
|
if (options.includeSrc !== false) {
|
|
112185
112201
|
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")
|
|
112202
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
|
|
112203
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.tsx"),
|
|
112204
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.js"),
|
|
112205
|
+
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.jsx")
|
|
112190
112206
|
]);
|
|
112191
112207
|
await Promise.allSettled(
|
|
112192
112208
|
files.map(
|
|
@@ -112212,7 +112228,7 @@ ${(0, import_fs3.readFileSync)(file, "utf-8")}`,
|
|
|
112212
112228
|
...options,
|
|
112213
112229
|
dtsTsConfig: getNormalizedTsConfig(
|
|
112214
112230
|
context.root,
|
|
112215
|
-
outputPath,
|
|
112231
|
+
options.outputPath,
|
|
112216
112232
|
(0, import_tsc.createTypeScriptCompilationOptions)(
|
|
112217
112233
|
(0, import_normalize_options.normalizeOptions)(
|
|
112218
112234
|
{
|
|
@@ -112238,7 +112254,7 @@ ${options.banner}
|
|
|
112238
112254
|
|
|
112239
112255
|
`
|
|
112240
112256
|
} : void 0,
|
|
112241
|
-
outputPath
|
|
112257
|
+
outputPath: options.outputPath
|
|
112242
112258
|
});
|
|
112243
112259
|
if (typeof config === "function") {
|
|
112244
112260
|
await build(await Promise.resolve(config({})));
|
|
@@ -112301,16 +112317,43 @@ var isPrimitive = (value) => {
|
|
|
112301
112317
|
return false;
|
|
112302
112318
|
}
|
|
112303
112319
|
};
|
|
112304
|
-
var
|
|
112320
|
+
var applyDefault = (options) => {
|
|
112321
|
+
options.entry ??= "{sourceRoot}/index.ts";
|
|
112322
|
+
options.outputPath ??= "dist/{projectRoot}";
|
|
112323
|
+
options.tsConfig ??= "tsconfig.json";
|
|
112324
|
+
options.platform ??= "neutral";
|
|
112325
|
+
options.verbose ??= false;
|
|
112326
|
+
options.external ??= [];
|
|
112327
|
+
options.additionalEntryPoints ??= [];
|
|
112328
|
+
options.assets ??= [];
|
|
112329
|
+
options.plugins ??= [];
|
|
112330
|
+
options.includeSrc ??= true;
|
|
112331
|
+
options.clean ??= true;
|
|
112332
|
+
options.bundle ??= true;
|
|
112333
|
+
options.debug ??= false;
|
|
112334
|
+
options.watch ??= false;
|
|
112335
|
+
options.apiReport ??= true;
|
|
112336
|
+
options.docModel ??= true;
|
|
112337
|
+
options.tsdocMetadata ??= true;
|
|
112338
|
+
options.define ??= {};
|
|
112339
|
+
options.env ??= {};
|
|
112340
|
+
return options;
|
|
112341
|
+
};
|
|
112342
|
+
var executor_default = withRunExecutor(
|
|
112343
|
+
"TypeScript Build using tsup",
|
|
112344
|
+
tsupExecutorFn,
|
|
112345
|
+
{
|
|
112346
|
+
skipReadingConfig: false,
|
|
112347
|
+
applyDefaultFn: applyDefault
|
|
112348
|
+
}
|
|
112349
|
+
);
|
|
112305
112350
|
|
|
112306
112351
|
// packages/workspace-tools/src/executors/tsup-node/executor.ts
|
|
112307
112352
|
var tsNodeBuildExecutorFn = (options, context, config) => {
|
|
112308
|
-
options.plugins ??= [];
|
|
112309
|
-
options.transports ??= ["pino-pretty", "pino-loki"];
|
|
112310
112353
|
if (options.transports && Array.isArray(options.transports) && options.transports.length > 0) {
|
|
112311
112354
|
options.plugins.push(esbuildPluginPino({ transports: options.transports }));
|
|
112312
112355
|
}
|
|
112313
|
-
return
|
|
112356
|
+
return tsupExecutorFn(
|
|
112314
112357
|
{
|
|
112315
112358
|
...options,
|
|
112316
112359
|
platform: "node",
|
|
@@ -112331,9 +112374,19 @@ var tsNodeBuildExecutorFn = (options, context, config) => {
|
|
|
112331
112374
|
context
|
|
112332
112375
|
);
|
|
112333
112376
|
};
|
|
112377
|
+
var applyDefault2 = (options) => {
|
|
112378
|
+
options = applyDefault({ ...options, platform: "node" });
|
|
112379
|
+
options.plugins ??= [];
|
|
112380
|
+
options.transports ??= ["pino-pretty", "pino-loki"];
|
|
112381
|
+
return options;
|
|
112382
|
+
};
|
|
112334
112383
|
var executor_default2 = withRunExecutor(
|
|
112335
112384
|
"TypeScript Build (NodeJs Platform)",
|
|
112336
|
-
tsNodeBuildExecutorFn
|
|
112385
|
+
tsNodeBuildExecutorFn,
|
|
112386
|
+
{
|
|
112387
|
+
skipReadingConfig: false,
|
|
112388
|
+
applyDefaultFn: applyDefault2
|
|
112389
|
+
}
|
|
112337
112390
|
);
|
|
112338
112391
|
// Annotate the CommonJS export names for ESM import in node:
|
|
112339
112392
|
0 && (module.exports = {
|