@storm-software/workspace-tools 1.24.2 → 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.
@@ -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
- (0, import_fs3.writeFileSync)(
117488
- packageJsonPath,
117489
- await (0, import_prettier.format)(JSON.stringify(packageJson), {
117490
- ...prettierOptions,
117491
- parser: "json"
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";