@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/workspace-tools",
3
- "version": "1.24.2",
3
+ "version": "1.26.0",
4
4
  "private": false,
5
5
  "description": "⚡ A Nx plugin package that contains various executors and generators used in a Storm workspaces.",
6
6
  "keywords": [
@@ -116991,6 +116991,7 @@ function modernConfig({
116991
116991
  splitting,
116992
116992
  treeshake,
116993
116993
  debug = false,
116994
+ shims = true,
116994
116995
  external,
116995
116996
  banner = {},
116996
116997
  platform = "neutral",
@@ -117001,6 +117002,7 @@ function modernConfig({
117001
117002
  define: define2,
117002
117003
  env,
117003
117004
  plugins,
117005
+ generatePackageJson,
117004
117006
  dtsTsConfig
117005
117007
  }) {
117006
117008
  let outputPath = (0, import_path3.join)(outDir, "dist", "modern");
@@ -117019,6 +117021,7 @@ function modernConfig({
117019
117021
  ] : ["esnext", "node18"],
117020
117022
  tsconfig,
117021
117023
  splitting,
117024
+ generatePackageJson,
117022
117025
  treeshake: treeshake ? {
117023
117026
  preset: "recommended"
117024
117027
  } : false,
@@ -117027,7 +117030,7 @@ function modernConfig({
117027
117030
  outDir: outputPath,
117028
117031
  silent: !verbose,
117029
117032
  metafile: true,
117030
- shims: true,
117033
+ shims,
117031
117034
  external,
117032
117035
  platform,
117033
117036
  banner,
@@ -117074,9 +117077,11 @@ function legacyConfig({
117074
117077
  banner = {},
117075
117078
  platform = "neutral",
117076
117079
  verbose = false,
117080
+ shims = true,
117077
117081
  define: define2,
117078
117082
  env,
117079
117083
  plugins,
117084
+ generatePackageJson,
117080
117085
  dtsTsConfig
117081
117086
  }) {
117082
117087
  let outputPath = (0, import_path3.join)(outDir, "dist", "legacy");
@@ -117087,6 +117092,7 @@ function legacyConfig({
117087
117092
  target: ["es2022", "node18"],
117088
117093
  tsconfig,
117089
117094
  splitting,
117095
+ generatePackageJson,
117090
117096
  treeshake: treeshake ? {
117091
117097
  preset: "recommended"
117092
117098
  } : false,
@@ -117095,7 +117101,7 @@ function legacyConfig({
117095
117101
  outDir: outputPath,
117096
117102
  silent: !verbose,
117097
117103
  metafile: true,
117098
- shims: true,
117104
+ shims,
117099
117105
  external,
117100
117106
  platform,
117101
117107
  banner,
@@ -117144,9 +117150,11 @@ function workerConfig({
117144
117150
  apiReport = true,
117145
117151
  docModel = true,
117146
117152
  tsdocMetadata = true,
117153
+ shims = false,
117147
117154
  define: define2,
117148
117155
  env,
117149
117156
  plugins,
117157
+ generatePackageJson,
117150
117158
  dtsTsConfig
117151
117159
  }) {
117152
117160
  let outputPath = (0, import_path3.join)(outDir, "dist");
@@ -117158,6 +117166,7 @@ function workerConfig({
117158
117166
  bundle: true,
117159
117167
  tsconfig,
117160
117168
  splitting,
117169
+ generatePackageJson,
117161
117170
  treeshake: treeshake ? {
117162
117171
  preset: "recommended"
117163
117172
  } : false,
@@ -117166,7 +117175,7 @@ function workerConfig({
117166
117175
  outDir: outputPath,
117167
117176
  silent: !verbose,
117168
117177
  metafile: true,
117169
- shims: false,
117178
+ shims,
117170
117179
  external,
117171
117180
  platform: "browser",
117172
117181
  banner,
@@ -117296,6 +117305,13 @@ ${Object.keys(options).map(
117296
117305
  glob: "LICENSE",
117297
117306
  output: "."
117298
117307
  });
117308
+ if (options.generatePackageJson === false) {
117309
+ assets.push({
117310
+ input: projectRoot,
117311
+ glob: "**/package.json",
117312
+ output: "."
117313
+ });
117314
+ }
117299
117315
  if (options.includeSrc !== false) {
117300
117316
  assets.push({
117301
117317
  input: sourceRoot,
@@ -117361,84 +117377,6 @@ ${externalDependencies.map((dep) => {
117361
117377
  }
117362
117378
  }
117363
117379
  }
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
117380
  const prettierOptions = {
117443
117381
  plugins: ["prettier-plugin-packagejson"],
117444
117382
  trailingComma: "none",
@@ -117453,13 +117391,93 @@ ${externalDependencies.map((dep) => {
117453
117391
  arrowParens: "avoid",
117454
117392
  endOfLine: "lf"
117455
117393
  };
117456
- (0, import_fs3.writeFileSync)(
117457
- packageJsonPath,
117458
- await (0, import_prettier.format)(JSON.stringify(packageJson), {
117459
- ...prettierOptions,
117460
- parser: "json"
117461
- })
117462
- );
117394
+ if (options.generatePackageJson !== false) {
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
+ (0, import_fs3.writeFileSync)(
117474
+ packageJsonPath,
117475
+ await (0, import_prettier.format)(JSON.stringify(packageJson), {
117476
+ ...prettierOptions,
117477
+ parser: "json"
117478
+ })
117479
+ );
117480
+ }
117463
117481
  if (options.includeSrc !== false) {
117464
117482
  const files = globSync([
117465
117483
  (0, import_devkit.joinPathFragments)(context.root, options.outputPath, "src/**/*.ts"),
@@ -117601,6 +117619,7 @@ var applyDefaultOptions = (options) => {
117601
117619
  options.entry ??= "{sourceRoot}/index.ts";
117602
117620
  options.outputPath ??= "dist/{projectRoot}";
117603
117621
  options.tsConfig ??= "tsconfig.json";
117622
+ options.generatePackageJson ??= true;
117604
117623
  options.splitting ??= true;
117605
117624
  options.treeshake ??= true;
117606
117625
  options.platform ??= "neutral";
@@ -70618,6 +70618,7 @@ function modernConfig({
70618
70618
  splitting,
70619
70619
  treeshake,
70620
70620
  debug = false,
70621
+ shims = true,
70621
70622
  external,
70622
70623
  banner = {},
70623
70624
  platform = "neutral",
@@ -70628,6 +70629,7 @@ function modernConfig({
70628
70629
  define: define2,
70629
70630
  env,
70630
70631
  plugins,
70632
+ generatePackageJson,
70631
70633
  dtsTsConfig
70632
70634
  }) {
70633
70635
  let outputPath = (0, import_path2.join)(outDir, "dist", "modern");
@@ -70646,6 +70648,7 @@ function modernConfig({
70646
70648
  ] : ["esnext", "node18"],
70647
70649
  tsconfig,
70648
70650
  splitting,
70651
+ generatePackageJson,
70649
70652
  treeshake: treeshake ? {
70650
70653
  preset: "recommended"
70651
70654
  } : false,
@@ -70654,7 +70657,7 @@ function modernConfig({
70654
70657
  outDir: outputPath,
70655
70658
  silent: !verbose,
70656
70659
  metafile: true,
70657
- shims: true,
70660
+ shims,
70658
70661
  external,
70659
70662
  platform,
70660
70663
  banner,
@@ -70701,9 +70704,11 @@ function legacyConfig({
70701
70704
  banner = {},
70702
70705
  platform = "neutral",
70703
70706
  verbose = false,
70707
+ shims = true,
70704
70708
  define: define2,
70705
70709
  env,
70706
70710
  plugins,
70711
+ generatePackageJson,
70707
70712
  dtsTsConfig
70708
70713
  }) {
70709
70714
  let outputPath = (0, import_path2.join)(outDir, "dist", "legacy");
@@ -70714,6 +70719,7 @@ function legacyConfig({
70714
70719
  target: ["es2022", "node18"],
70715
70720
  tsconfig,
70716
70721
  splitting,
70722
+ generatePackageJson,
70717
70723
  treeshake: treeshake ? {
70718
70724
  preset: "recommended"
70719
70725
  } : false,
@@ -70722,7 +70728,7 @@ function legacyConfig({
70722
70728
  outDir: outputPath,
70723
70729
  silent: !verbose,
70724
70730
  metafile: true,
70725
- shims: true,
70731
+ shims,
70726
70732
  external,
70727
70733
  platform,
70728
70734
  banner,
@@ -70771,9 +70777,11 @@ function workerConfig({
70771
70777
  apiReport = true,
70772
70778
  docModel = true,
70773
70779
  tsdocMetadata = true,
70780
+ shims = false,
70774
70781
  define: define2,
70775
70782
  env,
70776
70783
  plugins,
70784
+ generatePackageJson,
70777
70785
  dtsTsConfig
70778
70786
  }) {
70779
70787
  let outputPath = (0, import_path2.join)(outDir, "dist");
@@ -70785,6 +70793,7 @@ function workerConfig({
70785
70793
  bundle: true,
70786
70794
  tsconfig,
70787
70795
  splitting,
70796
+ generatePackageJson,
70788
70797
  treeshake: treeshake ? {
70789
70798
  preset: "recommended"
70790
70799
  } : false,
@@ -70793,7 +70802,7 @@ function workerConfig({
70793
70802
  outDir: outputPath,
70794
70803
  silent: !verbose,
70795
70804
  metafile: true,
70796
- shims: false,
70805
+ shims,
70797
70806
  external,
70798
70807
  platform: "browser",
70799
70808
  banner,
@@ -33,6 +33,8 @@ export type TsupExecutorSchema = Omit<
33
33
  includeSrc?: boolean;
34
34
  platform?: Platform;
35
35
  plugins?: any[];
36
+ shims?: boolean;
36
37
  splitting?: boolean;
37
38
  treeshake?: boolean;
39
+ generatePackageJson?: boolean;
38
40
  };
@@ -71,6 +71,11 @@
71
71
  "description": "Should the source files be added to the distribution folder in an `src` directory.",
72
72
  "default": false
73
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.",
77
+ "default": true
78
+ },
74
79
  "splitting": {
75
80
  "type": "boolean",
76
81
  "description": "Should the build process preform *code-splitting*?",
@@ -102,6 +107,10 @@
102
107
  "description": "Should write extra log outputs with details from the executor.",
103
108
  "default": false
104
109
  },
110
+ "shims": {
111
+ "type": "boolean",
112
+ "description": "Should the build process add shims for node.js modules that are not available in the browser?"
113
+ },
105
114
  "define": {
106
115
  "type": "object",
107
116
  "description": "Define global constants that can be used in the source code. The value will be converted into a stringified JSON.",