@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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.24.2](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.24.1...workspace-tools-v1.24.2) (2023-12-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **workspace-tools:** Update tsup build to not include `src` folder by default ([d400c33](https://github.com/storm-software/storm-ops/commit/d400c338e29ddfbe4c3288f1015db972849c7181))
7
+
8
+ ## [1.24.1](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.24.0...workspace-tools-v1.24.1) (2023-12-11)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **workspace-tools:** Resolved issue with bad nx.json config ([1753feb](https://github.com/storm-software/storm-ops/commit/1753febc615fa341af86d49981905221153dbcfb))
14
+
1
15
  # [1.24.0](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.23.1...workspace-tools-v1.24.0) (2023-12-09)
2
16
 
3
17
 
package/index.js CHANGED
@@ -117194,6 +117194,7 @@ function modernConfig({
117194
117194
  define: define2,
117195
117195
  env: env2,
117196
117196
  plugins,
117197
+ generatePackageJson,
117197
117198
  dtsTsConfig
117198
117199
  }) {
117199
117200
  let outputPath = (0, import_path3.join)(outDir, "dist", "modern");
@@ -117212,6 +117213,7 @@ function modernConfig({
117212
117213
  ] : ["esnext", "node18"],
117213
117214
  tsconfig,
117214
117215
  splitting,
117216
+ generatePackageJson,
117215
117217
  treeshake: treeshake ? {
117216
117218
  preset: "recommended"
117217
117219
  } : false,
@@ -117270,6 +117272,7 @@ function legacyConfig({
117270
117272
  define: define2,
117271
117273
  env: env2,
117272
117274
  plugins,
117275
+ generatePackageJson,
117273
117276
  dtsTsConfig
117274
117277
  }) {
117275
117278
  let outputPath = (0, import_path3.join)(outDir, "dist", "legacy");
@@ -117280,6 +117283,7 @@ function legacyConfig({
117280
117283
  target: ["es2022", "node18"],
117281
117284
  tsconfig,
117282
117285
  splitting,
117286
+ generatePackageJson,
117283
117287
  treeshake: treeshake ? {
117284
117288
  preset: "recommended"
117285
117289
  } : false,
@@ -117340,6 +117344,7 @@ function workerConfig({
117340
117344
  define: define2,
117341
117345
  env: env2,
117342
117346
  plugins,
117347
+ generatePackageJson,
117343
117348
  dtsTsConfig
117344
117349
  }) {
117345
117350
  let outputPath = (0, import_path3.join)(outDir, "dist");
@@ -117351,6 +117356,7 @@ function workerConfig({
117351
117356
  bundle: true,
117352
117357
  tsconfig,
117353
117358
  splitting,
117359
+ generatePackageJson,
117354
117360
  treeshake: treeshake ? {
117355
117361
  preset: "recommended"
117356
117362
  } : false,
@@ -117489,6 +117495,13 @@ ${Object.keys(options).map(
117489
117495
  glob: "LICENSE",
117490
117496
  output: "."
117491
117497
  });
117498
+ if (options.generatePackageJson === false) {
117499
+ assets.push({
117500
+ input: projectRoot,
117501
+ glob: "**/package.json",
117502
+ output: "."
117503
+ });
117504
+ }
117492
117505
  if (options.includeSrc !== false) {
117493
117506
  assets.push({
117494
117507
  input: sourceRoot,
@@ -117554,84 +117567,6 @@ ${externalDependencies.map((dep) => {
117554
117567
  }
117555
117568
  }
117556
117569
  }
117557
- const projectGraph = (0, import_devkit.readCachedProjectGraph)();
117558
- const pathToPackageJson = (0, import_path4.join)(context.root, projectRoot, "package.json");
117559
- const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
117560
- delete packageJson.dependencies;
117561
- externalDependencies.forEach((entry) => {
117562
- const packageConfig = entry.node.data;
117563
- if (packageConfig?.packageName && (!!(projectGraph.externalNodes[entry.node.name]?.type === "npm") || !!projectGraph.nodes[entry.node.name])) {
117564
- const { packageName, version } = packageConfig;
117565
- if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
117566
- return;
117567
- }
117568
- packageJson.dependencies ??= {};
117569
- packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
117570
- }
117571
- });
117572
- packageJson.type = "module";
117573
- packageJson.exports ??= {
117574
- ".": {
117575
- import: {
117576
- types: "./dist/modern/index.d.ts",
117577
- default: "./dist/modern/index.js"
117578
- },
117579
- require: {
117580
- types: "./dist/modern/index.d.cts",
117581
- default: "./dist/modern/index.cjs"
117582
- },
117583
- ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
117584
- [removeExtension(entryPoint).replace(sourceRoot, "")]: {
117585
- types: (0, import_path4.join)(
117586
- "./dist/modern",
117587
- `${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
117588
- ),
117589
- default: (0, import_path4.join)(
117590
- "./dist/modern",
117591
- `${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
117592
- )
117593
- }
117594
- }))
117595
- },
117596
- "./package.json": "./package.json"
117597
- };
117598
- packageJson.funding ??= workspacePackageJson.funding;
117599
- packageJson.types ??= "dist/legacy/index.d.ts";
117600
- packageJson.main ??= "dist/legacy/index.cjs";
117601
- packageJson.module ??= "dist/legacy/index.js";
117602
- options.platform && options.platform !== "node" && (packageJson.browser ??= "dist/modern/index.global.js");
117603
- if (options.includeSrc !== false) {
117604
- let distSrc = sourceRoot.replace(projectRoot, "");
117605
- if (distSrc.startsWith("/")) {
117606
- distSrc = distSrc.substring(1);
117607
- }
117608
- packageJson.source ??= `${(0, import_path4.join)(distSrc, "index.ts").replaceAll(
117609
- "\\",
117610
- "/"
117611
- )}`;
117612
- }
117613
- packageJson.sideEffects ??= false;
117614
- packageJson.files ??= ["dist"];
117615
- if (options.includeSrc !== false && !packageJson.files.includes("src")) {
117616
- packageJson.files.push("src");
117617
- }
117618
- packageJson.publishConfig ??= {
117619
- access: "public"
117620
- };
117621
- packageJson.description ??= workspacePackageJson.description;
117622
- packageJson.homepage ??= workspacePackageJson.homepage;
117623
- packageJson.bugs ??= workspacePackageJson.bugs;
117624
- packageJson.author ??= workspacePackageJson.author;
117625
- packageJson.license ??= workspacePackageJson.license;
117626
- packageJson.keywords ??= workspacePackageJson.keywords;
117627
- packageJson.repository ??= workspacePackageJson.repository;
117628
- packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
117629
- const packageJsonPath = (0, import_path4.join)(
117630
- context.root,
117631
- options.outputPath,
117632
- "package.json"
117633
- );
117634
- console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
117635
117570
  const prettierOptions = {
117636
117571
  plugins: ["prettier-plugin-packagejson"],
117637
117572
  trailingComma: "none",
@@ -117646,13 +117581,93 @@ ${externalDependencies.map((dep) => {
117646
117581
  arrowParens: "avoid",
117647
117582
  endOfLine: "lf"
117648
117583
  };
117649
- (0, import_fs3.writeFileSync)(
117650
- packageJsonPath,
117651
- await (0, import_prettier.format)(JSON.stringify(packageJson), {
117652
- ...prettierOptions,
117653
- parser: "json"
117654
- })
117655
- );
117584
+ if (options.generatePackageJson !== false) {
117585
+ const projectGraph = (0, import_devkit.readCachedProjectGraph)();
117586
+ const pathToPackageJson = (0, import_path4.join)(context.root, projectRoot, "package.json");
117587
+ const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
117588
+ delete packageJson.dependencies;
117589
+ externalDependencies.forEach((entry) => {
117590
+ const packageConfig = entry.node.data;
117591
+ if (packageConfig?.packageName && (!!(projectGraph.externalNodes[entry.node.name]?.type === "npm") || !!projectGraph.nodes[entry.node.name])) {
117592
+ const { packageName, version } = packageConfig;
117593
+ if (workspacePackageJson.dependencies?.[packageName] || workspacePackageJson.devDependencies?.[packageName]) {
117594
+ return;
117595
+ }
117596
+ packageJson.dependencies ??= {};
117597
+ packageJson.dependencies[packageName] = !!projectGraph.nodes[entry.node.name] ? "latest" : version;
117598
+ }
117599
+ });
117600
+ packageJson.type = "module";
117601
+ packageJson.exports ??= {
117602
+ ".": {
117603
+ import: {
117604
+ types: "./dist/modern/index.d.ts",
117605
+ default: "./dist/modern/index.js"
117606
+ },
117607
+ require: {
117608
+ types: "./dist/modern/index.d.cts",
117609
+ default: "./dist/modern/index.cjs"
117610
+ },
117611
+ ...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
117612
+ [removeExtension(entryPoint).replace(sourceRoot, "")]: {
117613
+ types: (0, import_path4.join)(
117614
+ "./dist/modern",
117615
+ `${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
117616
+ ),
117617
+ default: (0, import_path4.join)(
117618
+ "./dist/modern",
117619
+ `${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
117620
+ )
117621
+ }
117622
+ }))
117623
+ },
117624
+ "./package.json": "./package.json"
117625
+ };
117626
+ packageJson.funding ??= workspacePackageJson.funding;
117627
+ packageJson.types ??= "dist/legacy/index.d.ts";
117628
+ packageJson.main ??= "dist/legacy/index.cjs";
117629
+ packageJson.module ??= "dist/legacy/index.js";
117630
+ options.platform && options.platform !== "node" && (packageJson.browser ??= "dist/modern/index.global.js");
117631
+ if (options.includeSrc !== false) {
117632
+ let distSrc = sourceRoot.replace(projectRoot, "");
117633
+ if (distSrc.startsWith("/")) {
117634
+ distSrc = distSrc.substring(1);
117635
+ }
117636
+ packageJson.source ??= `${(0, import_path4.join)(distSrc, "index.ts").replaceAll(
117637
+ "\\",
117638
+ "/"
117639
+ )}`;
117640
+ }
117641
+ packageJson.sideEffects ??= false;
117642
+ packageJson.files ??= ["dist"];
117643
+ if (options.includeSrc !== false && !packageJson.files.includes("src")) {
117644
+ packageJson.files.push("src");
117645
+ }
117646
+ packageJson.publishConfig ??= {
117647
+ access: "public"
117648
+ };
117649
+ packageJson.description ??= workspacePackageJson.description;
117650
+ packageJson.homepage ??= workspacePackageJson.homepage;
117651
+ packageJson.bugs ??= workspacePackageJson.bugs;
117652
+ packageJson.author ??= workspacePackageJson.author;
117653
+ packageJson.license ??= workspacePackageJson.license;
117654
+ packageJson.keywords ??= workspacePackageJson.keywords;
117655
+ packageJson.repository ??= workspacePackageJson.repository;
117656
+ packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_path4.join)("packages", context.projectName);
117657
+ const packageJsonPath = (0, import_path4.join)(
117658
+ context.root,
117659
+ options.outputPath,
117660
+ "package.json"
117661
+ );
117662
+ console.log(`\u26A1 Writing package.json file to: ${packageJsonPath}`);
117663
+ (0, import_fs3.writeFileSync)(
117664
+ packageJsonPath,
117665
+ await (0, import_prettier.format)(JSON.stringify(packageJson), {
117666
+ ...prettierOptions,
117667
+ parser: "json"
117668
+ })
117669
+ );
117670
+ }
117656
117671
  if (options.includeSrc !== false) {
117657
117672
  const files = globSync([
117658
117673
  (0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
@@ -117794,6 +117809,7 @@ var applyDefaultOptions = (options) => {
117794
117809
  options.entry ??= "{sourceRoot}/index.ts";
117795
117810
  options.outputPath ??= "dist/{projectRoot}";
117796
117811
  options.tsConfig ??= "tsconfig.json";
117812
+ options.generatePackageJson ??= true;
117797
117813
  options.splitting ??= true;
117798
117814
  options.treeshake ??= true;
117799
117815
  options.platform ??= "neutral";