@storm-software/workspace-tools 1.24.2 → 1.26.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/index.js +107 -88
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/executors/tsup/executor.js +107 -88
- package/src/executors/tsup/get-config.js +12 -3
- package/src/executors/tsup/schema.d.ts +2 -0
- package/src/executors/tsup/schema.json +9 -0
- package/src/executors/tsup-neutral/executor.js +107 -88
- package/src/executors/tsup-node/executor.js +107 -88
|
@@ -117022,6 +117022,7 @@ function modernConfig({
|
|
|
117022
117022
|
splitting,
|
|
117023
117023
|
treeshake,
|
|
117024
117024
|
debug = false,
|
|
117025
|
+
shims = true,
|
|
117025
117026
|
external,
|
|
117026
117027
|
banner = {},
|
|
117027
117028
|
platform = "neutral",
|
|
@@ -117032,6 +117033,7 @@ function modernConfig({
|
|
|
117032
117033
|
define: define2,
|
|
117033
117034
|
env,
|
|
117034
117035
|
plugins,
|
|
117036
|
+
generatePackageJson,
|
|
117035
117037
|
dtsTsConfig
|
|
117036
117038
|
}) {
|
|
117037
117039
|
let outputPath = (0, import_path3.join)(outDir, "dist", "modern");
|
|
@@ -117050,6 +117052,7 @@ function modernConfig({
|
|
|
117050
117052
|
] : ["esnext", "node18"],
|
|
117051
117053
|
tsconfig,
|
|
117052
117054
|
splitting,
|
|
117055
|
+
generatePackageJson,
|
|
117053
117056
|
treeshake: treeshake ? {
|
|
117054
117057
|
preset: "recommended"
|
|
117055
117058
|
} : false,
|
|
@@ -117058,7 +117061,7 @@ function modernConfig({
|
|
|
117058
117061
|
outDir: outputPath,
|
|
117059
117062
|
silent: !verbose,
|
|
117060
117063
|
metafile: true,
|
|
117061
|
-
shims
|
|
117064
|
+
shims,
|
|
117062
117065
|
external,
|
|
117063
117066
|
platform,
|
|
117064
117067
|
banner,
|
|
@@ -117105,9 +117108,11 @@ function legacyConfig({
|
|
|
117105
117108
|
banner = {},
|
|
117106
117109
|
platform = "neutral",
|
|
117107
117110
|
verbose = false,
|
|
117111
|
+
shims = true,
|
|
117108
117112
|
define: define2,
|
|
117109
117113
|
env,
|
|
117110
117114
|
plugins,
|
|
117115
|
+
generatePackageJson,
|
|
117111
117116
|
dtsTsConfig
|
|
117112
117117
|
}) {
|
|
117113
117118
|
let outputPath = (0, import_path3.join)(outDir, "dist", "legacy");
|
|
@@ -117118,6 +117123,7 @@ function legacyConfig({
|
|
|
117118
117123
|
target: ["es2022", "node18"],
|
|
117119
117124
|
tsconfig,
|
|
117120
117125
|
splitting,
|
|
117126
|
+
generatePackageJson,
|
|
117121
117127
|
treeshake: treeshake ? {
|
|
117122
117128
|
preset: "recommended"
|
|
117123
117129
|
} : false,
|
|
@@ -117126,7 +117132,7 @@ function legacyConfig({
|
|
|
117126
117132
|
outDir: outputPath,
|
|
117127
117133
|
silent: !verbose,
|
|
117128
117134
|
metafile: true,
|
|
117129
|
-
shims
|
|
117135
|
+
shims,
|
|
117130
117136
|
external,
|
|
117131
117137
|
platform,
|
|
117132
117138
|
banner,
|
|
@@ -117175,9 +117181,11 @@ function workerConfig({
|
|
|
117175
117181
|
apiReport = true,
|
|
117176
117182
|
docModel = true,
|
|
117177
117183
|
tsdocMetadata = true,
|
|
117184
|
+
shims = false,
|
|
117178
117185
|
define: define2,
|
|
117179
117186
|
env,
|
|
117180
117187
|
plugins,
|
|
117188
|
+
generatePackageJson,
|
|
117181
117189
|
dtsTsConfig
|
|
117182
117190
|
}) {
|
|
117183
117191
|
let outputPath = (0, import_path3.join)(outDir, "dist");
|
|
@@ -117189,6 +117197,7 @@ function workerConfig({
|
|
|
117189
117197
|
bundle: true,
|
|
117190
117198
|
tsconfig,
|
|
117191
117199
|
splitting,
|
|
117200
|
+
generatePackageJson,
|
|
117192
117201
|
treeshake: treeshake ? {
|
|
117193
117202
|
preset: "recommended"
|
|
117194
117203
|
} : false,
|
|
@@ -117197,7 +117206,7 @@ function workerConfig({
|
|
|
117197
117206
|
outDir: outputPath,
|
|
117198
117207
|
silent: !verbose,
|
|
117199
117208
|
metafile: true,
|
|
117200
|
-
shims
|
|
117209
|
+
shims,
|
|
117201
117210
|
external,
|
|
117202
117211
|
platform: "browser",
|
|
117203
117212
|
banner,
|
|
@@ -117327,6 +117336,13 @@ ${Object.keys(options).map(
|
|
|
117327
117336
|
glob: "LICENSE",
|
|
117328
117337
|
output: "."
|
|
117329
117338
|
});
|
|
117339
|
+
if (options.generatePackageJson === false) {
|
|
117340
|
+
assets.push({
|
|
117341
|
+
input: projectRoot,
|
|
117342
|
+
glob: "**/package.json",
|
|
117343
|
+
output: "."
|
|
117344
|
+
});
|
|
117345
|
+
}
|
|
117330
117346
|
if (options.includeSrc !== false) {
|
|
117331
117347
|
assets.push({
|
|
117332
117348
|
input: sourceRoot,
|
|
@@ -117392,84 +117408,6 @@ ${externalDependencies.map((dep) => {
|
|
|
117392
117408
|
}
|
|
117393
117409
|
}
|
|
117394
117410
|
}
|
|
117395
|
-
const projectGraph = (0, import_devkit.readCachedProjectGraph)();
|
|
117396
|
-
const pathToPackageJson = (0, import_path4.join)(context.root, projectRoot, "package.json");
|
|
117397
|
-
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
117398
|
-
delete packageJson.dependencies;
|
|
117399
|
-
externalDependencies.forEach((entry) => {
|
|
117400
|
-
const packageConfig = entry.node.data;
|
|
117401
|
-
if (packageConfig?.packageName && (!!(projectGraph.externalNodes[entry.node.name]?.type === "npm") || !!projectGraph.nodes[entry.node.name])) {
|
|
117402
|
-
const { packageName, version } = packageConfig;
|
|
117403
|
-
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
|
|
117404
|
-
return;
|
|
117405
|
-
}
|
|
117406
|
-
packageJson.dependencies ??= {};
|
|
117407
|
-
packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
|
|
117408
|
-
}
|
|
117409
|
-
});
|
|
117410
|
-
packageJson.type = "module";
|
|
117411
|
-
packageJson.exports ??= {
|
|
117412
|
-
".": {
|
|
117413
|
-
import: {
|
|
117414
|
-
types: "./dist/modern/index.d.ts",
|
|
117415
|
-
default: "./dist/modern/index.js"
|
|
117416
|
-
},
|
|
117417
|
-
require: {
|
|
117418
|
-
types: "./dist/modern/index.d.cts",
|
|
117419
|
-
default: "./dist/modern/index.cjs"
|
|
117420
|
-
},
|
|
117421
|
-
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
117422
|
-
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
117423
|
-
types: (0, import_path4.join)(
|
|
117424
|
-
"./dist/modern",
|
|
117425
|
-
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
117426
|
-
),
|
|
117427
|
-
default: (0, import_path4.join)(
|
|
117428
|
-
"./dist/modern",
|
|
117429
|
-
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
117430
|
-
)
|
|
117431
|
-
}
|
|
117432
|
-
}))
|
|
117433
|
-
},
|
|
117434
|
-
"./package.json": "./package.json"
|
|
117435
|
-
};
|
|
117436
|
-
packageJson.funding ??= workspacePackageJson.funding;
|
|
117437
|
-
packageJson.types ??= "dist/legacy/index.d.ts";
|
|
117438
|
-
packageJson.main ??= "dist/legacy/index.cjs";
|
|
117439
|
-
packageJson.module ??= "dist/legacy/index.js";
|
|
117440
|
-
options.platform && options.platform !== "node" && (packageJson.browser ??= "dist/modern/index.global.js");
|
|
117441
|
-
if (options.includeSrc !== false) {
|
|
117442
|
-
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
117443
|
-
if (distSrc.startsWith("/")) {
|
|
117444
|
-
distSrc = distSrc.substring(1);
|
|
117445
|
-
}
|
|
117446
|
-
packageJson.source ??= `${(0, import_path4.join)(distSrc, "index.ts").replaceAll(
|
|
117447
|
-
"\\",
|
|
117448
|
-
"/"
|
|
117449
|
-
)}`;
|
|
117450
|
-
}
|
|
117451
|
-
packageJson.sideEffects ??= false;
|
|
117452
|
-
packageJson.files ??= ["dist"];
|
|
117453
|
-
if (options.includeSrc !== false && !packageJson.files.includes("src")) {
|
|
117454
|
-
packageJson.files.push("src");
|
|
117455
|
-
}
|
|
117456
|
-
packageJson.publishConfig ??= {
|
|
117457
|
-
access: "public"
|
|
117458
|
-
};
|
|
117459
|
-
packageJson.description ??= workspacePackageJson.description;
|
|
117460
|
-
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
117461
|
-
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
117462
|
-
packageJson.author ??= workspacePackageJson.author;
|
|
117463
|
-
packageJson.license ??= workspacePackageJson.license;
|
|
117464
|
-
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
117465
|
-
packageJson.repository ??= workspacePackageJson.repository;
|
|
117466
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
117467
|
-
const packageJsonPath = (0, import_path4.join)(
|
|
117468
|
-
context.root,
|
|
117469
|
-
options.outputPath,
|
|
117470
|
-
"package.json"
|
|
117471
|
-
);
|
|
117472
|
-
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
117473
117411
|
const prettierOptions = {
|
|
117474
117412
|
plugins: ["prettier-plugin-packagejson"],
|
|
117475
117413
|
trailingComma: "none",
|
|
@@ -117484,13 +117422,93 @@ ${externalDependencies.map((dep) => {
|
|
|
117484
117422
|
arrowParens: "avoid",
|
|
117485
117423
|
endOfLine: "lf"
|
|
117486
117424
|
};
|
|
117487
|
-
(
|
|
117488
|
-
|
|
117489
|
-
|
|
117490
|
-
|
|
117491
|
-
|
|
117492
|
-
|
|
117493
|
-
|
|
117425
|
+
if (options.generatePackageJson !== false) {
|
|
117426
|
+
const projectGraph = (0, import_devkit.readCachedProjectGraph)();
|
|
117427
|
+
const pathToPackageJson = (0, import_path4.join)(context.root, projectRoot, "package.json");
|
|
117428
|
+
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
117429
|
+
delete packageJson.dependencies;
|
|
117430
|
+
externalDependencies.forEach((entry) => {
|
|
117431
|
+
const packageConfig = entry.node.data;
|
|
117432
|
+
if (packageConfig?.packageName && (!!(projectGraph.externalNodes[entry.node.name]?.type === "npm") || !!projectGraph.nodes[entry.node.name])) {
|
|
117433
|
+
const { packageName, version } = packageConfig;
|
|
117434
|
+
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
|
|
117435
|
+
return;
|
|
117436
|
+
}
|
|
117437
|
+
packageJson.dependencies ??= {};
|
|
117438
|
+
packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
|
|
117439
|
+
}
|
|
117440
|
+
});
|
|
117441
|
+
packageJson.type = "module";
|
|
117442
|
+
packageJson.exports ??= {
|
|
117443
|
+
".": {
|
|
117444
|
+
import: {
|
|
117445
|
+
types: "./dist/modern/index.d.ts",
|
|
117446
|
+
default: "./dist/modern/index.js"
|
|
117447
|
+
},
|
|
117448
|
+
require: {
|
|
117449
|
+
types: "./dist/modern/index.d.cts",
|
|
117450
|
+
default: "./dist/modern/index.cjs"
|
|
117451
|
+
},
|
|
117452
|
+
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
117453
|
+
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
117454
|
+
types: (0, import_path4.join)(
|
|
117455
|
+
"./dist/modern",
|
|
117456
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
117457
|
+
),
|
|
117458
|
+
default: (0, import_path4.join)(
|
|
117459
|
+
"./dist/modern",
|
|
117460
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
117461
|
+
)
|
|
117462
|
+
}
|
|
117463
|
+
}))
|
|
117464
|
+
},
|
|
117465
|
+
"./package.json": "./package.json"
|
|
117466
|
+
};
|
|
117467
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
117468
|
+
packageJson.types ??= "dist/legacy/index.d.ts";
|
|
117469
|
+
packageJson.main ??= "dist/legacy/index.cjs";
|
|
117470
|
+
packageJson.module ??= "dist/legacy/index.js";
|
|
117471
|
+
options.platform && options.platform !== "node" && (packageJson.browser ??= "dist/modern/index.global.js");
|
|
117472
|
+
if (options.includeSrc !== false) {
|
|
117473
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
117474
|
+
if (distSrc.startsWith("/")) {
|
|
117475
|
+
distSrc = distSrc.substring(1);
|
|
117476
|
+
}
|
|
117477
|
+
packageJson.source ??= `${(0, import_path4.join)(distSrc, "index.ts").replaceAll(
|
|
117478
|
+
"\\",
|
|
117479
|
+
"/"
|
|
117480
|
+
)}`;
|
|
117481
|
+
}
|
|
117482
|
+
packageJson.sideEffects ??= false;
|
|
117483
|
+
packageJson.files ??= ["dist"];
|
|
117484
|
+
if (options.includeSrc !== false && !packageJson.files.includes("src")) {
|
|
117485
|
+
packageJson.files.push("src");
|
|
117486
|
+
}
|
|
117487
|
+
packageJson.publishConfig ??= {
|
|
117488
|
+
access: "public"
|
|
117489
|
+
};
|
|
117490
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
117491
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
117492
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
117493
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
117494
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
117495
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
117496
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
117497
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
117498
|
+
const packageJsonPath = (0, import_path4.join)(
|
|
117499
|
+
context.root,
|
|
117500
|
+
options.outputPath,
|
|
117501
|
+
"package.json"
|
|
117502
|
+
);
|
|
117503
|
+
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
117504
|
+
(0, import_fs3.writeFileSync)(
|
|
117505
|
+
packageJsonPath,
|
|
117506
|
+
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
117507
|
+
...prettierOptions,
|
|
117508
|
+
parser: "json"
|
|
117509
|
+
})
|
|
117510
|
+
);
|
|
117511
|
+
}
|
|
117494
117512
|
if (options.includeSrc !== false) {
|
|
117495
117513
|
const files = globSync([
|
|
117496
117514
|
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
|
|
@@ -117632,6 +117650,7 @@ var applyDefaultOptions = (options) => {
|
|
|
117632
117650
|
options.entry ??= "{sourceRoot}/index.ts";
|
|
117633
117651
|
options.outputPath ??= "dist/{projectRoot}";
|
|
117634
117652
|
options.tsConfig ??= "tsconfig.json";
|
|
117653
|
+
options.generatePackageJson ??= true;
|
|
117635
117654
|
options.splitting ??= true;
|
|
117636
117655
|
options.treeshake ??= true;
|
|
117637
117656
|
options.platform ??= "neutral";
|
|
@@ -117022,6 +117022,7 @@ function modernConfig({
|
|
|
117022
117022
|
splitting,
|
|
117023
117023
|
treeshake,
|
|
117024
117024
|
debug = false,
|
|
117025
|
+
shims = true,
|
|
117025
117026
|
external,
|
|
117026
117027
|
banner = {},
|
|
117027
117028
|
platform = "neutral",
|
|
@@ -117032,6 +117033,7 @@ function modernConfig({
|
|
|
117032
117033
|
define: define2,
|
|
117033
117034
|
env,
|
|
117034
117035
|
plugins,
|
|
117036
|
+
generatePackageJson,
|
|
117035
117037
|
dtsTsConfig
|
|
117036
117038
|
}) {
|
|
117037
117039
|
let outputPath = (0, import_path3.join)(outDir, "dist", "modern");
|
|
@@ -117050,6 +117052,7 @@ function modernConfig({
|
|
|
117050
117052
|
] : ["esnext", "node18"],
|
|
117051
117053
|
tsconfig,
|
|
117052
117054
|
splitting,
|
|
117055
|
+
generatePackageJson,
|
|
117053
117056
|
treeshake: treeshake ? {
|
|
117054
117057
|
preset: "recommended"
|
|
117055
117058
|
} : false,
|
|
@@ -117058,7 +117061,7 @@ function modernConfig({
|
|
|
117058
117061
|
outDir: outputPath,
|
|
117059
117062
|
silent: !verbose,
|
|
117060
117063
|
metafile: true,
|
|
117061
|
-
shims
|
|
117064
|
+
shims,
|
|
117062
117065
|
external,
|
|
117063
117066
|
platform,
|
|
117064
117067
|
banner,
|
|
@@ -117105,9 +117108,11 @@ function legacyConfig({
|
|
|
117105
117108
|
banner = {},
|
|
117106
117109
|
platform = "neutral",
|
|
117107
117110
|
verbose = false,
|
|
117111
|
+
shims = true,
|
|
117108
117112
|
define: define2,
|
|
117109
117113
|
env,
|
|
117110
117114
|
plugins,
|
|
117115
|
+
generatePackageJson,
|
|
117111
117116
|
dtsTsConfig
|
|
117112
117117
|
}) {
|
|
117113
117118
|
let outputPath = (0, import_path3.join)(outDir, "dist", "legacy");
|
|
@@ -117118,6 +117123,7 @@ function legacyConfig({
|
|
|
117118
117123
|
target: ["es2022", "node18"],
|
|
117119
117124
|
tsconfig,
|
|
117120
117125
|
splitting,
|
|
117126
|
+
generatePackageJson,
|
|
117121
117127
|
treeshake: treeshake ? {
|
|
117122
117128
|
preset: "recommended"
|
|
117123
117129
|
} : false,
|
|
@@ -117126,7 +117132,7 @@ function legacyConfig({
|
|
|
117126
117132
|
outDir: outputPath,
|
|
117127
117133
|
silent: !verbose,
|
|
117128
117134
|
metafile: true,
|
|
117129
|
-
shims
|
|
117135
|
+
shims,
|
|
117130
117136
|
external,
|
|
117131
117137
|
platform,
|
|
117132
117138
|
banner,
|
|
@@ -117175,9 +117181,11 @@ function workerConfig({
|
|
|
117175
117181
|
apiReport = true,
|
|
117176
117182
|
docModel = true,
|
|
117177
117183
|
tsdocMetadata = true,
|
|
117184
|
+
shims = false,
|
|
117178
117185
|
define: define2,
|
|
117179
117186
|
env,
|
|
117180
117187
|
plugins,
|
|
117188
|
+
generatePackageJson,
|
|
117181
117189
|
dtsTsConfig
|
|
117182
117190
|
}) {
|
|
117183
117191
|
let outputPath = (0, import_path3.join)(outDir, "dist");
|
|
@@ -117189,6 +117197,7 @@ function workerConfig({
|
|
|
117189
117197
|
bundle: true,
|
|
117190
117198
|
tsconfig,
|
|
117191
117199
|
splitting,
|
|
117200
|
+
generatePackageJson,
|
|
117192
117201
|
treeshake: treeshake ? {
|
|
117193
117202
|
preset: "recommended"
|
|
117194
117203
|
} : false,
|
|
@@ -117197,7 +117206,7 @@ function workerConfig({
|
|
|
117197
117206
|
outDir: outputPath,
|
|
117198
117207
|
silent: !verbose,
|
|
117199
117208
|
metafile: true,
|
|
117200
|
-
shims
|
|
117209
|
+
shims,
|
|
117201
117210
|
external,
|
|
117202
117211
|
platform: "browser",
|
|
117203
117212
|
banner,
|
|
@@ -117327,6 +117336,13 @@ ${Object.keys(options).map(
|
|
|
117327
117336
|
glob: "LICENSE",
|
|
117328
117337
|
output: "."
|
|
117329
117338
|
});
|
|
117339
|
+
if (options.generatePackageJson === false) {
|
|
117340
|
+
assets.push({
|
|
117341
|
+
input: projectRoot,
|
|
117342
|
+
glob: "**/package.json",
|
|
117343
|
+
output: "."
|
|
117344
|
+
});
|
|
117345
|
+
}
|
|
117330
117346
|
if (options.includeSrc !== false) {
|
|
117331
117347
|
assets.push({
|
|
117332
117348
|
input: sourceRoot,
|
|
@@ -117392,84 +117408,6 @@ ${externalDependencies.map((dep) => {
|
|
|
117392
117408
|
}
|
|
117393
117409
|
}
|
|
117394
117410
|
}
|
|
117395
|
-
const projectGraph = (0, import_devkit.readCachedProjectGraph)();
|
|
117396
|
-
const pathToPackageJson = (0, import_path4.join)(context.root, projectRoot, "package.json");
|
|
117397
|
-
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
117398
|
-
delete packageJson.dependencies;
|
|
117399
|
-
externalDependencies.forEach((entry) => {
|
|
117400
|
-
const packageConfig = entry.node.data;
|
|
117401
|
-
if (packageConfig?.packageName && (!!(projectGraph.externalNodes[entry.node.name]?.type === "npm") || !!projectGraph.nodes[entry.node.name])) {
|
|
117402
|
-
const { packageName, version } = packageConfig;
|
|
117403
|
-
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
|
|
117404
|
-
return;
|
|
117405
|
-
}
|
|
117406
|
-
packageJson.dependencies ??= {};
|
|
117407
|
-
packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
|
|
117408
|
-
}
|
|
117409
|
-
});
|
|
117410
|
-
packageJson.type = "module";
|
|
117411
|
-
packageJson.exports ??= {
|
|
117412
|
-
".": {
|
|
117413
|
-
import: {
|
|
117414
|
-
types: "./dist/modern/index.d.ts",
|
|
117415
|
-
default: "./dist/modern/index.js"
|
|
117416
|
-
},
|
|
117417
|
-
require: {
|
|
117418
|
-
types: "./dist/modern/index.d.cts",
|
|
117419
|
-
default: "./dist/modern/index.cjs"
|
|
117420
|
-
},
|
|
117421
|
-
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
117422
|
-
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
117423
|
-
types: (0, import_path4.join)(
|
|
117424
|
-
"./dist/modern",
|
|
117425
|
-
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
117426
|
-
),
|
|
117427
|
-
default: (0, import_path4.join)(
|
|
117428
|
-
"./dist/modern",
|
|
117429
|
-
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
117430
|
-
)
|
|
117431
|
-
}
|
|
117432
|
-
}))
|
|
117433
|
-
},
|
|
117434
|
-
"./package.json": "./package.json"
|
|
117435
|
-
};
|
|
117436
|
-
packageJson.funding ??= workspacePackageJson.funding;
|
|
117437
|
-
packageJson.types ??= "dist/legacy/index.d.ts";
|
|
117438
|
-
packageJson.main ??= "dist/legacy/index.cjs";
|
|
117439
|
-
packageJson.module ??= "dist/legacy/index.js";
|
|
117440
|
-
options.platform && options.platform !== "node" && (packageJson.browser ??= "dist/modern/index.global.js");
|
|
117441
|
-
if (options.includeSrc !== false) {
|
|
117442
|
-
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
117443
|
-
if (distSrc.startsWith("/")) {
|
|
117444
|
-
distSrc = distSrc.substring(1);
|
|
117445
|
-
}
|
|
117446
|
-
packageJson.source ??= `${(0, import_path4.join)(distSrc, "index.ts").replaceAll(
|
|
117447
|
-
"\\",
|
|
117448
|
-
"/"
|
|
117449
|
-
)}`;
|
|
117450
|
-
}
|
|
117451
|
-
packageJson.sideEffects ??= false;
|
|
117452
|
-
packageJson.files ??= ["dist"];
|
|
117453
|
-
if (options.includeSrc !== false && !packageJson.files.includes("src")) {
|
|
117454
|
-
packageJson.files.push("src");
|
|
117455
|
-
}
|
|
117456
|
-
packageJson.publishConfig ??= {
|
|
117457
|
-
access: "public"
|
|
117458
|
-
};
|
|
117459
|
-
packageJson.description ??= workspacePackageJson.description;
|
|
117460
|
-
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
117461
|
-
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
117462
|
-
packageJson.author ??= workspacePackageJson.author;
|
|
117463
|
-
packageJson.license ??= workspacePackageJson.license;
|
|
117464
|
-
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
117465
|
-
packageJson.repository ??= workspacePackageJson.repository;
|
|
117466
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
117467
|
-
const packageJsonPath = (0, import_path4.join)(
|
|
117468
|
-
context.root,
|
|
117469
|
-
options.outputPath,
|
|
117470
|
-
"package.json"
|
|
117471
|
-
);
|
|
117472
|
-
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
117473
117411
|
const prettierOptions = {
|
|
117474
117412
|
plugins: ["prettier-plugin-packagejson"],
|
|
117475
117413
|
trailingComma: "none",
|
|
@@ -117484,13 +117422,93 @@ ${externalDependencies.map((dep) => {
|
|
|
117484
117422
|
arrowParens: "avoid",
|
|
117485
117423
|
endOfLine: "lf"
|
|
117486
117424
|
};
|
|
117487
|
-
(
|
|
117488
|
-
|
|
117489
|
-
|
|
117490
|
-
|
|
117491
|
-
|
|
117492
|
-
|
|
117493
|
-
|
|
117425
|
+
if (options.generatePackageJson !== false) {
|
|
117426
|
+
const projectGraph = (0, import_devkit.readCachedProjectGraph)();
|
|
117427
|
+
const pathToPackageJson = (0, import_path4.join)(context.root, projectRoot, "package.json");
|
|
117428
|
+
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
117429
|
+
delete packageJson.dependencies;
|
|
117430
|
+
externalDependencies.forEach((entry) => {
|
|
117431
|
+
const packageConfig = entry.node.data;
|
|
117432
|
+
if (packageConfig?.packageName && (!!(projectGraph.externalNodes[entry.node.name]?.type === "npm") || !!projectGraph.nodes[entry.node.name])) {
|
|
117433
|
+
const { packageName, version } = packageConfig;
|
|
117434
|
+
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
|
|
117435
|
+
return;
|
|
117436
|
+
}
|
|
117437
|
+
packageJson.dependencies ??= {};
|
|
117438
|
+
packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
|
|
117439
|
+
}
|
|
117440
|
+
});
|
|
117441
|
+
packageJson.type = "module";
|
|
117442
|
+
packageJson.exports ??= {
|
|
117443
|
+
".": {
|
|
117444
|
+
import: {
|
|
117445
|
+
types: "./dist/modern/index.d.ts",
|
|
117446
|
+
default: "./dist/modern/index.js"
|
|
117447
|
+
},
|
|
117448
|
+
require: {
|
|
117449
|
+
types: "./dist/modern/index.d.cts",
|
|
117450
|
+
default: "./dist/modern/index.cjs"
|
|
117451
|
+
},
|
|
117452
|
+
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
117453
|
+
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
117454
|
+
types: (0, import_path4.join)(
|
|
117455
|
+
"./dist/modern",
|
|
117456
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
117457
|
+
),
|
|
117458
|
+
default: (0, import_path4.join)(
|
|
117459
|
+
"./dist/modern",
|
|
117460
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
117461
|
+
)
|
|
117462
|
+
}
|
|
117463
|
+
}))
|
|
117464
|
+
},
|
|
117465
|
+
"./package.json": "./package.json"
|
|
117466
|
+
};
|
|
117467
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
117468
|
+
packageJson.types ??= "dist/legacy/index.d.ts";
|
|
117469
|
+
packageJson.main ??= "dist/legacy/index.cjs";
|
|
117470
|
+
packageJson.module ??= "dist/legacy/index.js";
|
|
117471
|
+
options.platform && options.platform !== "node" && (packageJson.browser ??= "dist/modern/index.global.js");
|
|
117472
|
+
if (options.includeSrc !== false) {
|
|
117473
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
117474
|
+
if (distSrc.startsWith("/")) {
|
|
117475
|
+
distSrc = distSrc.substring(1);
|
|
117476
|
+
}
|
|
117477
|
+
packageJson.source ??= `${(0, import_path4.join)(distSrc, "index.ts").replaceAll(
|
|
117478
|
+
"\\",
|
|
117479
|
+
"/"
|
|
117480
|
+
)}`;
|
|
117481
|
+
}
|
|
117482
|
+
packageJson.sideEffects ??= false;
|
|
117483
|
+
packageJson.files ??= ["dist"];
|
|
117484
|
+
if (options.includeSrc !== false && !packageJson.files.includes("src")) {
|
|
117485
|
+
packageJson.files.push("src");
|
|
117486
|
+
}
|
|
117487
|
+
packageJson.publishConfig ??= {
|
|
117488
|
+
access: "public"
|
|
117489
|
+
};
|
|
117490
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
117491
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
117492
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
117493
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
117494
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
117495
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
117496
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
117497
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
117498
|
+
const packageJsonPath = (0, import_path4.join)(
|
|
117499
|
+
context.root,
|
|
117500
|
+
options.outputPath,
|
|
117501
|
+
"package.json"
|
|
117502
|
+
);
|
|
117503
|
+
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
117504
|
+
(0, import_fs3.writeFileSync)(
|
|
117505
|
+
packageJsonPath,
|
|
117506
|
+
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
117507
|
+
...prettierOptions,
|
|
117508
|
+
parser: "json"
|
|
117509
|
+
})
|
|
117510
|
+
);
|
|
117511
|
+
}
|
|
117494
117512
|
if (options.includeSrc !== false) {
|
|
117495
117513
|
const files = globSync([
|
|
117496
117514
|
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
|
|
@@ -117632,6 +117650,7 @@ var applyDefaultOptions = (options) => {
|
|
|
117632
117650
|
options.entry ??= "{sourceRoot}/index.ts";
|
|
117633
117651
|
options.outputPath ??= "dist/{projectRoot}";
|
|
117634
117652
|
options.tsConfig ??= "tsconfig.json";
|
|
117653
|
+
options.generatePackageJson ??= true;
|
|
117635
117654
|
options.splitting ??= true;
|
|
117636
117655
|
options.treeshake ??= true;
|
|
117637
117656
|
options.platform ??= "neutral";
|