@storm-software/workspace-tools 1.24.1 → 1.25.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 +101 -85
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/executors/tsup/executor.js +101 -85
- package/src/executors/tsup/get-config.js +6 -0
- package/src/executors/tsup/schema.d.ts +1 -0
- package/src/executors/tsup/schema.json +5 -0
- package/src/executors/tsup-neutral/executor.js +101 -85
- package/src/executors/tsup-node/executor.js +101 -85
package/package.json
CHANGED
|
@@ -117001,6 +117001,7 @@ function modernConfig({
|
|
|
117001
117001
|
define: define2,
|
|
117002
117002
|
env,
|
|
117003
117003
|
plugins,
|
|
117004
|
+
generatePackageJson,
|
|
117004
117005
|
dtsTsConfig
|
|
117005
117006
|
}) {
|
|
117006
117007
|
let outputPath = (0, import_path3.join)(outDir, "dist", "modern");
|
|
@@ -117019,6 +117020,7 @@ function modernConfig({
|
|
|
117019
117020
|
] : ["esnext", "node18"],
|
|
117020
117021
|
tsconfig,
|
|
117021
117022
|
splitting,
|
|
117023
|
+
generatePackageJson,
|
|
117022
117024
|
treeshake: treeshake ? {
|
|
117023
117025
|
preset: "recommended"
|
|
117024
117026
|
} : false,
|
|
@@ -117077,6 +117079,7 @@ function legacyConfig({
|
|
|
117077
117079
|
define: define2,
|
|
117078
117080
|
env,
|
|
117079
117081
|
plugins,
|
|
117082
|
+
generatePackageJson,
|
|
117080
117083
|
dtsTsConfig
|
|
117081
117084
|
}) {
|
|
117082
117085
|
let outputPath = (0, import_path3.join)(outDir, "dist", "legacy");
|
|
@@ -117087,6 +117090,7 @@ function legacyConfig({
|
|
|
117087
117090
|
target: ["es2022", "node18"],
|
|
117088
117091
|
tsconfig,
|
|
117089
117092
|
splitting,
|
|
117093
|
+
generatePackageJson,
|
|
117090
117094
|
treeshake: treeshake ? {
|
|
117091
117095
|
preset: "recommended"
|
|
117092
117096
|
} : false,
|
|
@@ -117147,6 +117151,7 @@ function workerConfig({
|
|
|
117147
117151
|
define: define2,
|
|
117148
117152
|
env,
|
|
117149
117153
|
plugins,
|
|
117154
|
+
generatePackageJson,
|
|
117150
117155
|
dtsTsConfig
|
|
117151
117156
|
}) {
|
|
117152
117157
|
let outputPath = (0, import_path3.join)(outDir, "dist");
|
|
@@ -117158,6 +117163,7 @@ function workerConfig({
|
|
|
117158
117163
|
bundle: true,
|
|
117159
117164
|
tsconfig,
|
|
117160
117165
|
splitting,
|
|
117166
|
+
generatePackageJson,
|
|
117161
117167
|
treeshake: treeshake ? {
|
|
117162
117168
|
preset: "recommended"
|
|
117163
117169
|
} : false,
|
|
@@ -117296,6 +117302,13 @@ ${Object.keys(options).map(
|
|
|
117296
117302
|
glob: "LICENSE",
|
|
117297
117303
|
output: "."
|
|
117298
117304
|
});
|
|
117305
|
+
if (options.generatePackageJson === false) {
|
|
117306
|
+
assets.push({
|
|
117307
|
+
input: projectRoot,
|
|
117308
|
+
glob: "**/package.json",
|
|
117309
|
+
output: "."
|
|
117310
|
+
});
|
|
117311
|
+
}
|
|
117299
117312
|
if (options.includeSrc !== false) {
|
|
117300
117313
|
assets.push({
|
|
117301
117314
|
input: sourceRoot,
|
|
@@ -117361,84 +117374,6 @@ ${externalDependencies.map((dep) => {
|
|
|
117361
117374
|
}
|
|
117362
117375
|
}
|
|
117363
117376
|
}
|
|
117364
|
-
const projectGraph = (0, import_devkit.readCachedProjectGraph)();
|
|
117365
|
-
const pathToPackageJson = (0, import_path4.join)(context.root, projectRoot, "package.json");
|
|
117366
|
-
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
117367
|
-
delete packageJson.dependencies;
|
|
117368
|
-
externalDependencies.forEach((entry) => {
|
|
117369
|
-
const packageConfig = entry.node.data;
|
|
117370
|
-
if (packageConfig?.packageName && (!!(projectGraph.externalNodes[entry.node.name]?.type === "npm") || !!projectGraph.nodes[entry.node.name])) {
|
|
117371
|
-
const { packageName, version } = packageConfig;
|
|
117372
|
-
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
|
|
117373
|
-
return;
|
|
117374
|
-
}
|
|
117375
|
-
packageJson.dependencies ??= {};
|
|
117376
|
-
packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
|
|
117377
|
-
}
|
|
117378
|
-
});
|
|
117379
|
-
packageJson.type = "module";
|
|
117380
|
-
packageJson.exports ??= {
|
|
117381
|
-
".": {
|
|
117382
|
-
import: {
|
|
117383
|
-
types: "./dist/modern/index.d.ts",
|
|
117384
|
-
default: "./dist/modern/index.js"
|
|
117385
|
-
},
|
|
117386
|
-
require: {
|
|
117387
|
-
types: "./dist/modern/index.d.cts",
|
|
117388
|
-
default: "./dist/modern/index.cjs"
|
|
117389
|
-
},
|
|
117390
|
-
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
117391
|
-
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
117392
|
-
types: (0, import_path4.join)(
|
|
117393
|
-
"./dist/modern",
|
|
117394
|
-
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
117395
|
-
),
|
|
117396
|
-
default: (0, import_path4.join)(
|
|
117397
|
-
"./dist/modern",
|
|
117398
|
-
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
117399
|
-
)
|
|
117400
|
-
}
|
|
117401
|
-
}))
|
|
117402
|
-
},
|
|
117403
|
-
"./package.json": "./package.json"
|
|
117404
|
-
};
|
|
117405
|
-
packageJson.funding ??= workspacePackageJson.funding;
|
|
117406
|
-
packageJson.types ??= "dist/legacy/index.d.ts";
|
|
117407
|
-
packageJson.main ??= "dist/legacy/index.cjs";
|
|
117408
|
-
packageJson.module ??= "dist/legacy/index.js";
|
|
117409
|
-
options.platform && options.platform !== "node" && (packageJson.browser ??= "dist/modern/index.global.js");
|
|
117410
|
-
if (options.includeSrc !== false) {
|
|
117411
|
-
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
117412
|
-
if (distSrc.startsWith("/")) {
|
|
117413
|
-
distSrc = distSrc.substring(1);
|
|
117414
|
-
}
|
|
117415
|
-
packageJson.source ??= `${(0, import_path4.join)(distSrc, "index.ts").replaceAll(
|
|
117416
|
-
"\\",
|
|
117417
|
-
"/"
|
|
117418
|
-
)}`;
|
|
117419
|
-
}
|
|
117420
|
-
packageJson.sideEffects ??= false;
|
|
117421
|
-
packageJson.files ??= ["dist"];
|
|
117422
|
-
if (options.includeSrc !== false && !packageJson.files.includes("src")) {
|
|
117423
|
-
packageJson.files.push("src");
|
|
117424
|
-
}
|
|
117425
|
-
packageJson.publishConfig ??= {
|
|
117426
|
-
access: "public"
|
|
117427
|
-
};
|
|
117428
|
-
packageJson.description ??= workspacePackageJson.description;
|
|
117429
|
-
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
117430
|
-
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
117431
|
-
packageJson.author ??= workspacePackageJson.author;
|
|
117432
|
-
packageJson.license ??= workspacePackageJson.license;
|
|
117433
|
-
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
117434
|
-
packageJson.repository ??= workspacePackageJson.repository;
|
|
117435
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
117436
|
-
const packageJsonPath = (0, import_path4.join)(
|
|
117437
|
-
context.root,
|
|
117438
|
-
options.outputPath,
|
|
117439
|
-
"package.json"
|
|
117440
|
-
);
|
|
117441
|
-
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
117442
117377
|
const prettierOptions = {
|
|
117443
117378
|
plugins: ["prettier-plugin-packagejson"],
|
|
117444
117379
|
trailingComma: "none",
|
|
@@ -117453,13 +117388,93 @@ ${externalDependencies.map((dep) => {
|
|
|
117453
117388
|
arrowParens: "avoid",
|
|
117454
117389
|
endOfLine: "lf"
|
|
117455
117390
|
};
|
|
117456
|
-
(
|
|
117457
|
-
|
|
117458
|
-
|
|
117459
|
-
|
|
117460
|
-
|
|
117461
|
-
|
|
117462
|
-
|
|
117391
|
+
if (options.generatePackageJson !== false) {
|
|
117392
|
+
const projectGraph = (0, import_devkit.readCachedProjectGraph)();
|
|
117393
|
+
const pathToPackageJson = (0, import_path4.join)(context.root, projectRoot, "package.json");
|
|
117394
|
+
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
117395
|
+
delete packageJson.dependencies;
|
|
117396
|
+
externalDependencies.forEach((entry) => {
|
|
117397
|
+
const packageConfig = entry.node.data;
|
|
117398
|
+
if (packageConfig?.packageName && (!!(projectGraph.externalNodes[entry.node.name]?.type === "npm") || !!projectGraph.nodes[entry.node.name])) {
|
|
117399
|
+
const { packageName, version } = packageConfig;
|
|
117400
|
+
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
|
|
117401
|
+
return;
|
|
117402
|
+
}
|
|
117403
|
+
packageJson.dependencies ??= {};
|
|
117404
|
+
packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
|
|
117405
|
+
}
|
|
117406
|
+
});
|
|
117407
|
+
packageJson.type = "module";
|
|
117408
|
+
packageJson.exports ??= {
|
|
117409
|
+
".": {
|
|
117410
|
+
import: {
|
|
117411
|
+
types: "./dist/modern/index.d.ts",
|
|
117412
|
+
default: "./dist/modern/index.js"
|
|
117413
|
+
},
|
|
117414
|
+
require: {
|
|
117415
|
+
types: "./dist/modern/index.d.cts",
|
|
117416
|
+
default: "./dist/modern/index.cjs"
|
|
117417
|
+
},
|
|
117418
|
+
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
117419
|
+
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
117420
|
+
types: (0, import_path4.join)(
|
|
117421
|
+
"./dist/modern",
|
|
117422
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
117423
|
+
),
|
|
117424
|
+
default: (0, import_path4.join)(
|
|
117425
|
+
"./dist/modern",
|
|
117426
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
117427
|
+
)
|
|
117428
|
+
}
|
|
117429
|
+
}))
|
|
117430
|
+
},
|
|
117431
|
+
"./package.json": "./package.json"
|
|
117432
|
+
};
|
|
117433
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
117434
|
+
packageJson.types ??= "dist/legacy/index.d.ts";
|
|
117435
|
+
packageJson.main ??= "dist/legacy/index.cjs";
|
|
117436
|
+
packageJson.module ??= "dist/legacy/index.js";
|
|
117437
|
+
options.platform && options.platform !== "node" && (packageJson.browser ??= "dist/modern/index.global.js");
|
|
117438
|
+
if (options.includeSrc !== false) {
|
|
117439
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
117440
|
+
if (distSrc.startsWith("/")) {
|
|
117441
|
+
distSrc = distSrc.substring(1);
|
|
117442
|
+
}
|
|
117443
|
+
packageJson.source ??= `${(0, import_path4.join)(distSrc, "index.ts").replaceAll(
|
|
117444
|
+
"\\",
|
|
117445
|
+
"/"
|
|
117446
|
+
)}`;
|
|
117447
|
+
}
|
|
117448
|
+
packageJson.sideEffects ??= false;
|
|
117449
|
+
packageJson.files ??= ["dist"];
|
|
117450
|
+
if (options.includeSrc !== false && !packageJson.files.includes("src")) {
|
|
117451
|
+
packageJson.files.push("src");
|
|
117452
|
+
}
|
|
117453
|
+
packageJson.publishConfig ??= {
|
|
117454
|
+
access: "public"
|
|
117455
|
+
};
|
|
117456
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
117457
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
117458
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
117459
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
117460
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
117461
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
117462
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
117463
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
117464
|
+
const packageJsonPath = (0, import_path4.join)(
|
|
117465
|
+
context.root,
|
|
117466
|
+
options.outputPath,
|
|
117467
|
+
"package.json"
|
|
117468
|
+
);
|
|
117469
|
+
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
117470
|
+
(0, import_fs3.writeFileSync)(
|
|
117471
|
+
packageJsonPath,
|
|
117472
|
+
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
117473
|
+
...prettierOptions,
|
|
117474
|
+
parser: "json"
|
|
117475
|
+
})
|
|
117476
|
+
);
|
|
117477
|
+
}
|
|
117463
117478
|
if (options.includeSrc !== false) {
|
|
117464
117479
|
const files = globSync([
|
|
117465
117480
|
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
|
|
@@ -117601,6 +117616,7 @@ var applyDefaultOptions = (options) => {
|
|
|
117601
117616
|
options.entry ??= "{sourceRoot}/index.ts";
|
|
117602
117617
|
options.outputPath ??= "dist/{projectRoot}";
|
|
117603
117618
|
options.tsConfig ??= "tsconfig.json";
|
|
117619
|
+
options.generatePackageJson ??= true;
|
|
117604
117620
|
options.splitting ??= true;
|
|
117605
117621
|
options.treeshake ??= true;
|
|
117606
117622
|
options.platform ??= "neutral";
|
|
@@ -70628,6 +70628,7 @@ function modernConfig({
|
|
|
70628
70628
|
define: define2,
|
|
70629
70629
|
env,
|
|
70630
70630
|
plugins,
|
|
70631
|
+
generatePackageJson,
|
|
70631
70632
|
dtsTsConfig
|
|
70632
70633
|
}) {
|
|
70633
70634
|
let outputPath = (0, import_path2.join)(outDir, "dist", "modern");
|
|
@@ -70646,6 +70647,7 @@ function modernConfig({
|
|
|
70646
70647
|
] : ["esnext", "node18"],
|
|
70647
70648
|
tsconfig,
|
|
70648
70649
|
splitting,
|
|
70650
|
+
generatePackageJson,
|
|
70649
70651
|
treeshake: treeshake ? {
|
|
70650
70652
|
preset: "recommended"
|
|
70651
70653
|
} : false,
|
|
@@ -70704,6 +70706,7 @@ function legacyConfig({
|
|
|
70704
70706
|
define: define2,
|
|
70705
70707
|
env,
|
|
70706
70708
|
plugins,
|
|
70709
|
+
generatePackageJson,
|
|
70707
70710
|
dtsTsConfig
|
|
70708
70711
|
}) {
|
|
70709
70712
|
let outputPath = (0, import_path2.join)(outDir, "dist", "legacy");
|
|
@@ -70714,6 +70717,7 @@ function legacyConfig({
|
|
|
70714
70717
|
target: ["es2022", "node18"],
|
|
70715
70718
|
tsconfig,
|
|
70716
70719
|
splitting,
|
|
70720
|
+
generatePackageJson,
|
|
70717
70721
|
treeshake: treeshake ? {
|
|
70718
70722
|
preset: "recommended"
|
|
70719
70723
|
} : false,
|
|
@@ -70774,6 +70778,7 @@ function workerConfig({
|
|
|
70774
70778
|
define: define2,
|
|
70775
70779
|
env,
|
|
70776
70780
|
plugins,
|
|
70781
|
+
generatePackageJson,
|
|
70777
70782
|
dtsTsConfig
|
|
70778
70783
|
}) {
|
|
70779
70784
|
let outputPath = (0, import_path2.join)(outDir, "dist");
|
|
@@ -70785,6 +70790,7 @@ function workerConfig({
|
|
|
70785
70790
|
bundle: true,
|
|
70786
70791
|
tsconfig,
|
|
70787
70792
|
splitting,
|
|
70793
|
+
generatePackageJson,
|
|
70788
70794
|
treeshake: treeshake ? {
|
|
70789
70795
|
preset: "recommended"
|
|
70790
70796
|
} : false,
|
|
@@ -69,6 +69,11 @@
|
|
|
69
69
|
"includeSrc": {
|
|
70
70
|
"type": "boolean",
|
|
71
71
|
"description": "Should the source files be added to the distribution folder in an `src` directory.",
|
|
72
|
+
"default": false
|
|
73
|
+
},
|
|
74
|
+
"generatePackageJson": {
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"description": "Should a package.json file be generated in the output folder or should the existing one be copied in.",
|
|
72
77
|
"default": true
|
|
73
78
|
},
|
|
74
79
|
"splitting": {
|
|
@@ -117032,6 +117032,7 @@ function modernConfig({
|
|
|
117032
117032
|
define: define2,
|
|
117033
117033
|
env,
|
|
117034
117034
|
plugins,
|
|
117035
|
+
generatePackageJson,
|
|
117035
117036
|
dtsTsConfig
|
|
117036
117037
|
}) {
|
|
117037
117038
|
let outputPath = (0, import_path3.join)(outDir, "dist", "modern");
|
|
@@ -117050,6 +117051,7 @@ function modernConfig({
|
|
|
117050
117051
|
] : ["esnext", "node18"],
|
|
117051
117052
|
tsconfig,
|
|
117052
117053
|
splitting,
|
|
117054
|
+
generatePackageJson,
|
|
117053
117055
|
treeshake: treeshake ? {
|
|
117054
117056
|
preset: "recommended"
|
|
117055
117057
|
} : false,
|
|
@@ -117108,6 +117110,7 @@ function legacyConfig({
|
|
|
117108
117110
|
define: define2,
|
|
117109
117111
|
env,
|
|
117110
117112
|
plugins,
|
|
117113
|
+
generatePackageJson,
|
|
117111
117114
|
dtsTsConfig
|
|
117112
117115
|
}) {
|
|
117113
117116
|
let outputPath = (0, import_path3.join)(outDir, "dist", "legacy");
|
|
@@ -117118,6 +117121,7 @@ function legacyConfig({
|
|
|
117118
117121
|
target: ["es2022", "node18"],
|
|
117119
117122
|
tsconfig,
|
|
117120
117123
|
splitting,
|
|
117124
|
+
generatePackageJson,
|
|
117121
117125
|
treeshake: treeshake ? {
|
|
117122
117126
|
preset: "recommended"
|
|
117123
117127
|
} : false,
|
|
@@ -117178,6 +117182,7 @@ function workerConfig({
|
|
|
117178
117182
|
define: define2,
|
|
117179
117183
|
env,
|
|
117180
117184
|
plugins,
|
|
117185
|
+
generatePackageJson,
|
|
117181
117186
|
dtsTsConfig
|
|
117182
117187
|
}) {
|
|
117183
117188
|
let outputPath = (0, import_path3.join)(outDir, "dist");
|
|
@@ -117189,6 +117194,7 @@ function workerConfig({
|
|
|
117189
117194
|
bundle: true,
|
|
117190
117195
|
tsconfig,
|
|
117191
117196
|
splitting,
|
|
117197
|
+
generatePackageJson,
|
|
117192
117198
|
treeshake: treeshake ? {
|
|
117193
117199
|
preset: "recommended"
|
|
117194
117200
|
} : false,
|
|
@@ -117327,6 +117333,13 @@ ${Object.keys(options).map(
|
|
|
117327
117333
|
glob: "LICENSE",
|
|
117328
117334
|
output: "."
|
|
117329
117335
|
});
|
|
117336
|
+
if (options.generatePackageJson === false) {
|
|
117337
|
+
assets.push({
|
|
117338
|
+
input: projectRoot,
|
|
117339
|
+
glob: "**/package.json",
|
|
117340
|
+
output: "."
|
|
117341
|
+
});
|
|
117342
|
+
}
|
|
117330
117343
|
if (options.includeSrc !== false) {
|
|
117331
117344
|
assets.push({
|
|
117332
117345
|
input: sourceRoot,
|
|
@@ -117392,84 +117405,6 @@ ${externalDependencies.map((dep) => {
|
|
|
117392
117405
|
}
|
|
117393
117406
|
}
|
|
117394
117407
|
}
|
|
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
117408
|
const prettierOptions = {
|
|
117474
117409
|
plugins: ["prettier-plugin-packagejson"],
|
|
117475
117410
|
trailingComma: "none",
|
|
@@ -117484,13 +117419,93 @@ ${externalDependencies.map((dep) => {
|
|
|
117484
117419
|
arrowParens: "avoid",
|
|
117485
117420
|
endOfLine: "lf"
|
|
117486
117421
|
};
|
|
117487
|
-
(
|
|
117488
|
-
|
|
117489
|
-
|
|
117490
|
-
|
|
117491
|
-
|
|
117492
|
-
|
|
117493
|
-
|
|
117422
|
+
if (options.generatePackageJson !== false) {
|
|
117423
|
+
const projectGraph = (0, import_devkit.readCachedProjectGraph)();
|
|
117424
|
+
const pathToPackageJson = (0, import_path4.join)(context.root, projectRoot, "package.json");
|
|
117425
|
+
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
117426
|
+
delete packageJson.dependencies;
|
|
117427
|
+
externalDependencies.forEach((entry) => {
|
|
117428
|
+
const packageConfig = entry.node.data;
|
|
117429
|
+
if (packageConfig?.packageName && (!!(projectGraph.externalNodes[entry.node.name]?.type === "npm") || !!projectGraph.nodes[entry.node.name])) {
|
|
117430
|
+
const { packageName, version } = packageConfig;
|
|
117431
|
+
if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
|
|
117432
|
+
return;
|
|
117433
|
+
}
|
|
117434
|
+
packageJson.dependencies ??= {};
|
|
117435
|
+
packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
|
|
117436
|
+
}
|
|
117437
|
+
});
|
|
117438
|
+
packageJson.type = "module";
|
|
117439
|
+
packageJson.exports ??= {
|
|
117440
|
+
".": {
|
|
117441
|
+
import: {
|
|
117442
|
+
types: "./dist/modern/index.d.ts",
|
|
117443
|
+
default: "./dist/modern/index.js"
|
|
117444
|
+
},
|
|
117445
|
+
require: {
|
|
117446
|
+
types: "./dist/modern/index.d.cts",
|
|
117447
|
+
default: "./dist/modern/index.cjs"
|
|
117448
|
+
},
|
|
117449
|
+
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
117450
|
+
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
117451
|
+
types: (0, import_path4.join)(
|
|
117452
|
+
"./dist/modern",
|
|
117453
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
117454
|
+
),
|
|
117455
|
+
default: (0, import_path4.join)(
|
|
117456
|
+
"./dist/modern",
|
|
117457
|
+
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
117458
|
+
)
|
|
117459
|
+
}
|
|
117460
|
+
}))
|
|
117461
|
+
},
|
|
117462
|
+
"./package.json": "./package.json"
|
|
117463
|
+
};
|
|
117464
|
+
packageJson.funding ??= workspacePackageJson.funding;
|
|
117465
|
+
packageJson.types ??= "dist/legacy/index.d.ts";
|
|
117466
|
+
packageJson.main ??= "dist/legacy/index.cjs";
|
|
117467
|
+
packageJson.module ??= "dist/legacy/index.js";
|
|
117468
|
+
options.platform && options.platform !== "node" && (packageJson.browser ??= "dist/modern/index.global.js");
|
|
117469
|
+
if (options.includeSrc !== false) {
|
|
117470
|
+
let distSrc = sourceRoot.replace(projectRoot, "");
|
|
117471
|
+
if (distSrc.startsWith("/")) {
|
|
117472
|
+
distSrc = distSrc.substring(1);
|
|
117473
|
+
}
|
|
117474
|
+
packageJson.source ??= `${(0, import_path4.join)(distSrc, "index.ts").replaceAll(
|
|
117475
|
+
"\\",
|
|
117476
|
+
"/"
|
|
117477
|
+
)}`;
|
|
117478
|
+
}
|
|
117479
|
+
packageJson.sideEffects ??= false;
|
|
117480
|
+
packageJson.files ??= ["dist"];
|
|
117481
|
+
if (options.includeSrc !== false && !packageJson.files.includes("src")) {
|
|
117482
|
+
packageJson.files.push("src");
|
|
117483
|
+
}
|
|
117484
|
+
packageJson.publishConfig ??= {
|
|
117485
|
+
access: "public"
|
|
117486
|
+
};
|
|
117487
|
+
packageJson.description ??= workspacePackageJson.description;
|
|
117488
|
+
packageJson.homepage ??= workspacePackageJson.homepage;
|
|
117489
|
+
packageJson.bugs ??= workspacePackageJson.bugs;
|
|
117490
|
+
packageJson.author ??= workspacePackageJson.author;
|
|
117491
|
+
packageJson.license ??= workspacePackageJson.license;
|
|
117492
|
+
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
117493
|
+
packageJson.repository ??= workspacePackageJson.repository;
|
|
117494
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
|
|
117495
|
+
const packageJsonPath = (0, import_path4.join)(
|
|
117496
|
+
context.root,
|
|
117497
|
+
options.outputPath,
|
|
117498
|
+
"package.json"
|
|
117499
|
+
);
|
|
117500
|
+
console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
117501
|
+
(0, import_fs3.writeFileSync)(
|
|
117502
|
+
packageJsonPath,
|
|
117503
|
+
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
117504
|
+
...prettierOptions,
|
|
117505
|
+
parser: "json"
|
|
117506
|
+
})
|
|
117507
|
+
);
|
|
117508
|
+
}
|
|
117494
117509
|
if (options.includeSrc !== false) {
|
|
117495
117510
|
const files = globSync([
|
|
117496
117511
|
(0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
|
|
@@ -117632,6 +117647,7 @@ var applyDefaultOptions = (options) => {
|
|
|
117632
117647
|
options.entry ??= "{sourceRoot}/index.ts";
|
|
117633
117648
|
options.outputPath ??= "dist/{projectRoot}";
|
|
117634
117649
|
options.tsConfig ??= "tsconfig.json";
|
|
117650
|
+
options.generatePackageJson ??= true;
|
|
117635
117651
|
options.splitting ??= true;
|
|
117636
117652
|
options.treeshake ??= true;
|
|
117637
117653
|
options.platform ??= "neutral";
|