@storm-software/git-tools 2.131.7 → 2.131.9

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/bin/git.js CHANGED
@@ -54,18 +54,17 @@ import { interpolate } from 'nx/src/tasks-runner/utils';
54
54
  import { execCommand } from 'nx/src/command-line/release/utils/exec-command.js';
55
55
  import { getCommitHash, getLatestGitTagForPattern, getFirstGitCommit, gitPush, gitAdd, getGitDiff, parseCommits } from 'nx/src/command-line/release/utils/git';
56
56
  import semver, { prerelease, major } from 'semver';
57
- import clone from 'nanoclone';
58
57
  import { ReleaseClient } from 'nx/release';
59
58
  import { readRawVersionPlans, setResolvedVersionPlansOnGroups } from 'nx/src/command-line/release/config/version-plans';
60
59
  import { printAndFlushChanges } from 'nx/src/command-line/release/utils/print-changes.js';
61
60
  import { createReleaseGraph } from 'nx/src/command-line/release/utils/release-graph';
62
61
  import { validateResolvedVersionPlansAgainstFilter } from 'nx/src/command-line/release/utils/version-plan-utils';
63
- import { readNxJson } from 'nx/src/config/nx-json';
64
62
  import { FsTree } from 'nx/src/generators/tree';
65
63
  import { createFileMapUsingProjectGraph } from 'nx/src/project-graph/file-map-utils';
66
64
  import importsPlugin from 'prettier-plugin-organize-imports';
67
65
  import DefaultChangelogRenderer from 'nx/release/changelog-renderer';
68
66
  import { DEFAULT_CONVENTIONAL_COMMITS_CONFIG } from 'nx/src/command-line/release/config/conventional-commits';
67
+ import { readNxJson } from 'nx/src/config/nx-json';
69
68
  import { findMatchingProjects } from 'nx/src/utils/find-matching-projects';
70
69
  import { IMPLICIT_DEFAULT_RELEASE_GROUP } from 'nx/src/command-line/release/config/config.js';
71
70
  import { deriveSpecifierFromConventionalCommits } from 'nx/src/command-line/release/version/derive-specifier-from-conventional-commits';
@@ -3330,8 +3329,6 @@ var DEFAULT_VERSION_RELEASE_CONFIG = {
3330
3329
  };
3331
3330
  var DEFAULT_CHANGELOG_RELEASE_CONFIG = {
3332
3331
  createRelease: "github",
3333
- entryWhenNoChanges: "This was a version bump only for {projectName} to align it with other projects, there were no code changes.",
3334
- file: false,
3335
3332
  renderOptions: {
3336
3333
  authors: false,
3337
3334
  commitReferences: true,
@@ -3534,6 +3531,41 @@ function getReleaseGroupConfig(projectGraph, releaseConfig, workspaceConfig) {
3534
3531
  })
3535
3532
  );
3536
3533
  }
3534
+ function getReleaseConfig(projectGraph, releaseConfig, workspaceConfig, ignoreNxJsonConfig = false) {
3535
+ let nxJson = {};
3536
+ if (!ignoreNxJsonConfig && existsSync$1(joinPaths(workspaceConfig.workspaceRoot, "nx.json"))) {
3537
+ nxJson = readNxJson();
3538
+ }
3539
+ const baseConfig = defu(
3540
+ {
3541
+ changelog: {
3542
+ renderOptions: {
3543
+ workspaceConfig
3544
+ }
3545
+ },
3546
+ groups: {}
3547
+ },
3548
+ omit(releaseConfig, ["groups"]),
3549
+ nxJson.release ? omit(nxJson.release, ["groups"]) : {},
3550
+ omit(DEFAULT_RELEASE_CONFIG, ["groups"])
3551
+ );
3552
+ let groups = {};
3553
+ if (releaseConfig?.groups && Object.keys(releaseConfig.groups).length > 0) {
3554
+ groups = releaseConfig.groups;
3555
+ } else if (nxJson.release?.groups && Object.keys(nxJson.release.groups).length > 0) {
3556
+ groups = nxJson.release.groups;
3557
+ } else {
3558
+ groups = DEFAULT_RELEASE_CONFIG.groups;
3559
+ }
3560
+ return {
3561
+ ...baseConfig,
3562
+ groups: getReleaseGroupConfig(
3563
+ projectGraph,
3564
+ { ...baseConfig, groups },
3565
+ workspaceConfig
3566
+ )
3567
+ };
3568
+ }
3537
3569
  var StormReleaseGroupProcessor = class extends ReleaseGroupProcessor {
3538
3570
  constructor(tree, workspaceConfig, projectGraph, nxReleaseConfig, releaseGraph, versionOptions) {
3539
3571
  super(tree, projectGraph, nxReleaseConfig, releaseGraph, {
@@ -4202,68 +4234,21 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
4202
4234
  "Failed to load the project graph. Please run `nx reset`, then run the `storm-git commit` command again."
4203
4235
  );
4204
4236
  }
4205
- let nxJson;
4206
- if (!ignoreNxJsonConfig && existsSync(joinPaths(workspaceConfig.workspaceRoot, "nx.json"))) {
4207
- nxJson = readNxJson();
4208
- }
4209
- const config5 = defu(
4210
- {
4211
- changelog: {
4212
- renderOptions: {
4213
- workspaceConfig
4214
- }
4215
- }
4216
- },
4217
- {
4218
- groups: getReleaseGroupConfig(
4219
- projectGraph,
4220
- releaseConfig,
4221
- workspaceConfig
4222
- )
4223
- },
4224
- {
4225
- groups: getReleaseGroupConfig(
4226
- projectGraph,
4227
- nxJson.release ?? {},
4228
- workspaceConfig
4229
- )
4230
- },
4231
- omit(releaseConfig, ["groups"]),
4232
- nxJson.release ? omit(nxJson.release, ["groups"]) : {},
4233
- omit(DEFAULT_RELEASE_CONFIG, ["groups"])
4234
- );
4235
- const normalizedConfig = clone(config5);
4236
- if (workspaceConfig.preid) {
4237
- normalizedConfig.groups = Object.fromEntries(
4238
- Object.entries(normalizedConfig.groups ?? {}).map(([name, group]) => {
4239
- return [
4240
- name,
4241
- {
4242
- ...group,
4243
- version: {
4244
- ...group.version,
4245
- preid: workspaceConfig.preid
4246
- }
4247
- }
4248
- ];
4249
- })
4250
- );
4251
- }
4252
4237
  return new _StormReleaseClient(
4253
4238
  projectGraph,
4254
- config5,
4255
- normalizedConfig,
4239
+ getReleaseConfig(
4240
+ projectGraph,
4241
+ releaseConfig,
4242
+ workspaceConfig,
4243
+ ignoreNxJsonConfig
4244
+ ),
4256
4245
  workspaceConfig
4257
4246
  );
4258
4247
  }
4259
- /**
4260
- * The release configuration used by this release client.
4261
- */
4262
- config;
4263
4248
  /**
4264
4249
  * The normalized release configuration used by this release client.
4265
4250
  */
4266
- normalizedConfig;
4251
+ releaseConfig;
4267
4252
  /**
4268
4253
  * The workspace configuration used by this release client.
4269
4254
  */
@@ -4288,16 +4273,15 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
4288
4273
  * @param ignoreNxJsonConfig - Whether to ignore the nx.json configuration and use only the provided {@link releaseConfig}. Default is false.
4289
4274
  * @param workspaceConfig - Optional Storm workspace configuration object for logging purposes.
4290
4275
  */
4291
- constructor(projectGraph, config5, normalizedConfig, workspaceConfig) {
4292
- super(normalizedConfig, true);
4276
+ constructor(projectGraph, releaseConfig, workspaceConfig) {
4277
+ super(releaseConfig, true);
4293
4278
  writeDebug(
4294
4279
  "Executing release with the following configuration",
4295
4280
  workspaceConfig
4296
4281
  );
4297
- writeDebug(normalizedConfig, workspaceConfig);
4282
+ writeDebug(releaseConfig, workspaceConfig);
4298
4283
  this.projectGraph = projectGraph;
4299
- this.config = config5;
4300
- this.normalizedConfig = normalizedConfig;
4284
+ this.releaseConfig = releaseConfig;
4301
4285
  this.workspaceConfig = workspaceConfig;
4302
4286
  this.tree = new FsTree(workspaceConfig.workspaceRoot, false);
4303
4287
  this.projectConfigurations = readProjectsConfigurationFromProjectGraph$2(projectGraph);
@@ -4316,7 +4300,7 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
4316
4300
  const releaseGraph = options.releaseGraph ?? await createReleaseGraph({
4317
4301
  tree: this.tree,
4318
4302
  projectGraph: this.projectGraph,
4319
- nxReleaseConfig: this.normalizedConfig,
4303
+ nxReleaseConfig: this.releaseConfig,
4320
4304
  filters: {
4321
4305
  projects: options.projects,
4322
4306
  groups: options.groups
@@ -4447,7 +4431,7 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
4447
4431
  fileMap.nonProjectFiles
4448
4432
  ) ? "*" : getProjectsAffectedByCommit(c, fileToProjectMap)
4449
4433
  })),
4450
- this.normalizedConfig.conventionalCommits
4434
+ this.releaseConfig.conventionalCommits
4451
4435
  );
4452
4436
  writeDebug(
4453
4437
  `Running changelog generation for the ${releaseGroup.name} release group`,
@@ -4461,7 +4445,7 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
4461
4445
  projectsVersionData: options.versionData,
4462
4446
  releaseGroup,
4463
4447
  projects: [project],
4464
- releaseConfig: this.config,
4448
+ releaseConfig: this.releaseConfig,
4465
4449
  projectToAdditionalDependencyBumps,
4466
4450
  workspaceConfig: this.workspaceConfig,
4467
4451
  ChangelogRendererClass: StormChangelogRenderer
@@ -4521,7 +4505,7 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
4521
4505
  fileMap.nonProjectFiles
4522
4506
  ) ? "*" : getProjectsAffectedByCommit(c, fileToProjectMap)
4523
4507
  })),
4524
- this.normalizedConfig.conventionalCommits
4508
+ this.releaseConfig.conventionalCommits
4525
4509
  );
4526
4510
  writeDebug(
4527
4511
  `Running changelog generation for the ${releaseGroup.name} release group`,
@@ -4535,7 +4519,7 @@ var StormReleaseClient = class _StormReleaseClient extends ReleaseClient {
4535
4519
  projectsVersionData: options.versionData,
4536
4520
  releaseGroup,
4537
4521
  projects: projectNodes,
4538
- releaseConfig: this.config,
4522
+ releaseConfig: this.releaseConfig,
4539
4523
  projectToAdditionalDependencyBumps,
4540
4524
  workspaceConfig: this.workspaceConfig,
4541
4525
  ChangelogRendererClass: StormChangelogRenderer
@@ -4577,7 +4561,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4577
4561
  options.releaseGraph.releaseGroups,
4578
4562
  options.releaseGraph.releaseGroupToFilteredProjects,
4579
4563
  options.versionData,
4580
- options.gitCommitMessage || this.normalizedConfig.changelog?.git?.commitMessage || DEFAULT_COMMIT_MESSAGE
4564
+ options.gitCommitMessage || this.releaseConfig.changelog?.git?.commitMessage || DEFAULT_COMMIT_MESSAGE
4581
4565
  );
4582
4566
  const changes = this.tree.listChanges();
4583
4567
  if (!changes.length) {
@@ -4600,7 +4584,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4600
4584
  isDryRun: !!options.dryRun,
4601
4585
  isVerbose: !!options.verbose,
4602
4586
  gitCommitMessages: commitMessageValues,
4603
- gitCommitArgs: options.gitCommitArgs || this.normalizedConfig.changelog?.git?.commitArgs
4587
+ gitCommitArgs: options.gitCommitArgs || this.releaseConfig.changelog?.git?.commitArgs
4604
4588
  });
4605
4589
  latestCommit = await getCommitHash("HEAD");
4606
4590
  writeDebug(
@@ -4610,8 +4594,8 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4610
4594
  for (const tag of gitTagValues) {
4611
4595
  await gitTag({
4612
4596
  tag,
4613
- message: options.gitTagMessage || this.normalizedConfig.changelog?.git?.tagMessage,
4614
- additionalArgs: options.gitTagArgs || this.normalizedConfig.changelog?.git?.tagArgs,
4597
+ message: options.gitTagMessage || this.releaseConfig.changelog?.git?.tagMessage,
4598
+ additionalArgs: options.gitTagArgs || this.releaseConfig.changelog?.git?.tagArgs,
4615
4599
  dryRun: options.dryRun,
4616
4600
  verbose: options.verbose
4617
4601
  });
@@ -4624,7 +4608,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4624
4608
  gitRemote: options.gitRemote,
4625
4609
  dryRun: options.dryRun,
4626
4610
  verbose: options.verbose,
4627
- additionalArgs: options.gitPushArgs || this.normalizedConfig.changelog?.git?.pushArgs
4611
+ additionalArgs: options.gitPushArgs || this.releaseConfig.changelog?.git?.pushArgs
4628
4612
  });
4629
4613
  for (const postGitTask of postGitTasks) {
4630
4614
  await postGitTask(latestCommit);
@@ -4645,7 +4629,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4645
4629
  const releaseGraph = options.releaseGraph ?? await createReleaseGraph({
4646
4630
  tree: this.tree,
4647
4631
  projectGraph: this.projectGraph,
4648
- nxReleaseConfig: this.normalizedConfig,
4632
+ nxReleaseConfig: this.releaseConfig,
4649
4633
  filters: {
4650
4634
  projects: options.projects,
4651
4635
  groups: options.groups
@@ -4684,15 +4668,15 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4684
4668
  if (options.deleteVersionPlans === void 0) {
4685
4669
  options.deleteVersionPlans = false;
4686
4670
  }
4687
- if (this.normalizedConfig.version?.preVersionCommand) {
4671
+ if (this.releaseConfig.version?.preVersionCommand) {
4688
4672
  writeDebug(
4689
- "Executing the following pre-version command: \n" + this.normalizedConfig.version.preVersionCommand,
4673
+ "Executing the following pre-version command: \n" + this.releaseConfig.version.preVersionCommand,
4690
4674
  this.workspaceConfig
4691
4675
  );
4692
4676
  try {
4693
4677
  const childProcess2 = runAsync(
4694
4678
  this.workspaceConfig,
4695
- this.normalizedConfig.version.preVersionCommand,
4679
+ this.releaseConfig.version.preVersionCommand,
4696
4680
  this.workspaceConfig.workspaceRoot,
4697
4681
  {
4698
4682
  ...process.env,
@@ -4708,7 +4692,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4708
4692
  throw new Error(
4709
4693
  formatNxLog({
4710
4694
  title: `The pre-version command failed. See the full output above.`,
4711
- bodyLines: [this.normalizedConfig.version.preVersionCommand, e]
4695
+ bodyLines: [this.releaseConfig.version.preVersionCommand, e]
4712
4696
  })
4713
4697
  );
4714
4698
  }
@@ -4752,14 +4736,14 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4752
4736
  }
4753
4737
  }
4754
4738
  await releaseGraph.validate(this.tree);
4755
- const commitMessage = options.gitCommitMessage || this.normalizedConfig.version?.git?.commitMessage;
4739
+ const commitMessage = options.gitCommitMessage || this.releaseConfig.version?.git?.commitMessage;
4756
4740
  const additionalChangedFiles = /* @__PURE__ */ new Set();
4757
4741
  const additionalDeletedFiles = /* @__PURE__ */ new Set();
4758
4742
  const processor = new StormReleaseGroupProcessor(
4759
4743
  this.tree,
4760
4744
  this.workspaceConfig,
4761
4745
  this.projectGraph,
4762
- this.normalizedConfig,
4746
+ this.releaseConfig,
4763
4747
  releaseGraph,
4764
4748
  options
4765
4749
  );
@@ -4775,21 +4759,21 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4775
4759
  await formatChangedFiles(this.tree);
4776
4760
  printAndFlushChanges(this.tree, !!options.dryRun);
4777
4761
  const { changedFiles: changed, deletedFiles: deleted } = await processor.afterAllProjectsVersioned({
4778
- ...this.normalizedConfig.version.versionActionsOptions,
4762
+ ...this.releaseConfig.version.versionActionsOptions,
4779
4763
  ...options.versionActionsOptionsOverrides ?? {}
4780
4764
  });
4781
4765
  changed.forEach((f) => additionalChangedFiles.add(f));
4782
4766
  deleted.forEach((f) => additionalDeletedFiles.add(f));
4783
- if (this.normalizedConfig.docker && typeof this.normalizedConfig.docker === "object" && this.normalizedConfig.docker?.preVersionCommand) {
4767
+ if (this.releaseConfig.docker && typeof this.releaseConfig.docker === "object" && this.releaseConfig.docker?.preVersionCommand) {
4784
4768
  writeDebug(
4785
4769
  `Executing the docker pre-version command:
4786
- ` + this.normalizedConfig.docker.preVersionCommand,
4770
+ ` + this.releaseConfig.docker.preVersionCommand,
4787
4771
  this.workspaceConfig
4788
4772
  );
4789
4773
  try {
4790
4774
  const childProcess2 = runAsync(
4791
4775
  this.workspaceConfig,
4792
- this.normalizedConfig.docker.preVersionCommand,
4776
+ this.releaseConfig.docker.preVersionCommand,
4793
4777
  this.workspaceConfig.workspaceRoot,
4794
4778
  {
4795
4779
  ...process.env,
@@ -4805,7 +4789,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4805
4789
  throw new Error(
4806
4790
  formatNxLog({
4807
4791
  title: `The docker pre-version command failed. See the full output above.`,
4808
- bodyLines: [this.normalizedConfig.docker.preVersionCommand, e]
4792
+ bodyLines: [this.releaseConfig.docker.preVersionCommand, e]
4809
4793
  })
4810
4794
  );
4811
4795
  }
@@ -4848,7 +4832,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4848
4832
  }
4849
4833
  }
4850
4834
  }
4851
- if (this.normalizedConfig.docker || releaseGraph.releaseGroups.some((rg) => rg.docker)) {
4835
+ if (this.releaseConfig.docker || releaseGraph.releaseGroups.some((rg) => rg.docker)) {
4852
4836
  writeWarning(
4853
4837
  formatNxLog({
4854
4838
  title: "Warning",
@@ -4863,7 +4847,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4863
4847
  options.dockerVersion
4864
4848
  );
4865
4849
  const versionData = processor.getVersionData();
4866
- const gitTagValues = options.gitTag ?? this.normalizedConfig.version?.git?.tag ? createGitTagValues(
4850
+ const gitTagValues = options.gitTag ?? this.releaseConfig.version?.git?.tag ? createGitTagValues(
4867
4851
  releaseGraph.releaseGroups,
4868
4852
  releaseGraph.releaseGroupToFilteredProjects,
4869
4853
  versionData
@@ -4891,7 +4875,7 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4891
4875
  releaseGraph
4892
4876
  };
4893
4877
  }
4894
- if (options.gitCommit ?? this.normalizedConfig.version?.git?.commit) {
4878
+ if (options.gitCommit ?? this.releaseConfig.version?.git?.commit) {
4895
4879
  await commitChanges({
4896
4880
  changedFiles,
4897
4881
  deletedFiles,
@@ -4903,9 +4887,9 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4903
4887
  versionData,
4904
4888
  commitMessage
4905
4889
  ),
4906
- gitCommitArgs: options.gitCommitArgs || this.normalizedConfig.version?.git?.commitArgs
4890
+ gitCommitArgs: options.gitCommitArgs || this.releaseConfig.version?.git?.commitArgs
4907
4891
  });
4908
- } else if (options.stageChanges ?? this.normalizedConfig.version?.git?.stageChanges) {
4892
+ } else if (options.stageChanges ?? this.releaseConfig.version?.git?.stageChanges) {
4909
4893
  writeDebug(`Staging changed files with git`);
4910
4894
  await gitAdd({
4911
4895
  changedFiles,
@@ -4914,25 +4898,25 @@ ${Object.keys(allProjectChangelogs).map((p) => ` - ${p}`).join("\n")}
4914
4898
  verbose
4915
4899
  });
4916
4900
  }
4917
- if (options.gitTag ?? this.normalizedConfig.version?.git?.tag) {
4901
+ if (options.gitTag ?? this.releaseConfig.version?.git?.tag) {
4918
4902
  writeDebug(`Tagging commit with git`);
4919
4903
  for (const tag of gitTagValues) {
4920
4904
  await gitTag({
4921
4905
  tag,
4922
- message: options.gitTagMessage || this.normalizedConfig.version?.git?.tagMessage,
4923
- additionalArgs: options.gitTagArgs || this.normalizedConfig.version?.git?.tagArgs,
4906
+ message: options.gitTagMessage || this.releaseConfig.version?.git?.tagMessage,
4907
+ additionalArgs: options.gitTagArgs || this.releaseConfig.version?.git?.tagArgs,
4924
4908
  dryRun: options.dryRun,
4925
4909
  verbose: options.verbose
4926
4910
  });
4927
4911
  }
4928
4912
  }
4929
- if (options.gitPush ?? this.normalizedConfig.version?.git?.push) {
4913
+ if (options.gitPush ?? this.releaseConfig.version?.git?.push) {
4930
4914
  writeDebug(`Pushing to git remote "${options.gitRemote ?? "origin"}"`);
4931
4915
  await gitPush({
4932
4916
  gitRemote: options.gitRemote,
4933
4917
  dryRun: options.dryRun,
4934
4918
  verbose: options.verbose,
4935
- additionalArgs: options.gitPushArgs || this.normalizedConfig.version?.git?.pushArgs
4919
+ additionalArgs: options.gitPushArgs || this.releaseConfig.version?.git?.pushArgs
4936
4920
  });
4937
4921
  }
4938
4922
  return {