@smoothbricks/cli 0.1.1 → 0.3.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.
Files changed (131) hide show
  1. package/README.md +161 -32
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +110 -10
  4. package/dist/devenv/index.d.ts +10 -0
  5. package/dist/devenv/index.d.ts.map +1 -0
  6. package/dist/devenv/index.js +27 -0
  7. package/dist/generate/index.d.ts +20 -0
  8. package/dist/generate/index.d.ts.map +1 -0
  9. package/dist/generate/index.js +47 -0
  10. package/dist/lib/cli-package.d.ts +4 -0
  11. package/dist/lib/cli-package.d.ts.map +1 -0
  12. package/dist/lib/cli-package.js +15 -0
  13. package/dist/lib/run.d.ts +6 -0
  14. package/dist/lib/run.d.ts.map +1 -1
  15. package/dist/lib/run.js +32 -0
  16. package/dist/lib/workspace.d.ts +25 -1
  17. package/dist/lib/workspace.d.ts.map +1 -1
  18. package/dist/lib/workspace.js +79 -17
  19. package/dist/monorepo/commit-msg.d.ts +8 -1
  20. package/dist/monorepo/commit-msg.d.ts.map +1 -1
  21. package/dist/monorepo/commit-msg.js +85 -7
  22. package/dist/monorepo/index.d.ts +19 -2
  23. package/dist/monorepo/index.d.ts.map +1 -1
  24. package/dist/monorepo/index.js +104 -16
  25. package/dist/monorepo/lockfile.d.ts.map +1 -1
  26. package/dist/monorepo/lockfile.js +9 -0
  27. package/dist/monorepo/managed-files.js +1 -1
  28. package/dist/monorepo/nx-sync.d.ts +2 -1
  29. package/dist/monorepo/nx-sync.d.ts.map +1 -1
  30. package/dist/monorepo/nx-sync.js +8 -2
  31. package/dist/monorepo/package-hygiene.d.ts +6 -2
  32. package/dist/monorepo/package-hygiene.d.ts.map +1 -1
  33. package/dist/monorepo/package-hygiene.js +12 -4
  34. package/dist/monorepo/package-policy.d.ts +13 -4
  35. package/dist/monorepo/package-policy.d.ts.map +1 -1
  36. package/dist/monorepo/package-policy.js +208 -113
  37. package/dist/monorepo/packed-package.d.ts +3 -0
  38. package/dist/monorepo/packed-package.d.ts.map +1 -1
  39. package/dist/monorepo/packed-package.js +68 -36
  40. package/dist/monorepo/packs/index.d.ts +20 -1
  41. package/dist/monorepo/packs/index.d.ts.map +1 -1
  42. package/dist/monorepo/packs/index.js +238 -19
  43. package/dist/monorepo/publish-workflow.d.ts +0 -4
  44. package/dist/monorepo/publish-workflow.d.ts.map +1 -1
  45. package/dist/monorepo/publish-workflow.js +7 -15
  46. package/dist/monorepo/tool-validation.d.ts +22 -0
  47. package/dist/monorepo/tool-validation.d.ts.map +1 -0
  48. package/dist/monorepo/tool-validation.js +399 -0
  49. package/dist/nx/index.d.ts +25 -0
  50. package/dist/nx/index.d.ts.map +1 -0
  51. package/dist/nx/index.js +112 -0
  52. package/dist/release/bootstrap-npm-packages.d.ts +19 -0
  53. package/dist/release/bootstrap-npm-packages.d.ts.map +1 -0
  54. package/dist/release/bootstrap-npm-packages.js +58 -0
  55. package/dist/release/candidates.d.ts +11 -0
  56. package/dist/release/candidates.d.ts.map +1 -0
  57. package/dist/release/candidates.js +181 -0
  58. package/dist/release/core.d.ts +4 -1
  59. package/dist/release/core.d.ts.map +1 -1
  60. package/dist/release/core.js +76 -9
  61. package/dist/release/github-release.d.ts +1 -0
  62. package/dist/release/github-release.d.ts.map +1 -1
  63. package/dist/release/github-release.js +3 -3
  64. package/dist/release/index.d.ts +32 -1
  65. package/dist/release/index.d.ts.map +1 -1
  66. package/dist/release/index.js +488 -64
  67. package/dist/release/npm-auth.d.ts +0 -1
  68. package/dist/release/npm-auth.d.ts.map +1 -1
  69. package/dist/release/npm-auth.js +4 -16
  70. package/dist/release/orchestration.d.ts +11 -2
  71. package/dist/release/orchestration.d.ts.map +1 -1
  72. package/dist/release/orchestration.js +41 -3
  73. package/dist/release/publish-plan.js +1 -1
  74. package/managed/raw/git-format-staged.yml +54 -0
  75. package/managed/raw/tooling/git-hooks/commit-msg.sh +1 -1
  76. package/managed/templates/github/actions/setup-devenv/action.yml +1 -7
  77. package/managed/templates/github/workflows/ci.yml +4 -2
  78. package/package.json +15 -8
  79. package/src/cli.ts +153 -22
  80. package/src/devenv/index.test.ts +49 -0
  81. package/src/devenv/index.ts +38 -0
  82. package/src/generate/index.ts +92 -0
  83. package/src/lib/cli-package.ts +18 -0
  84. package/src/lib/run.ts +44 -0
  85. package/src/lib/workspace.ts +112 -17
  86. package/src/monorepo/__tests__/publish-workflow.test.ts +16 -9
  87. package/src/monorepo/commit-msg.test.ts +45 -0
  88. package/src/monorepo/commit-msg.ts +107 -7
  89. package/src/monorepo/index.ts +142 -16
  90. package/src/monorepo/lockfile.ts +9 -0
  91. package/src/monorepo/managed-files.ts +1 -1
  92. package/src/monorepo/nx-sync.ts +9 -2
  93. package/src/monorepo/package-hygiene.test.ts +34 -0
  94. package/src/monorepo/package-hygiene.ts +26 -4
  95. package/src/monorepo/package-policy.test.ts +1130 -0
  96. package/src/monorepo/package-policy.ts +237 -114
  97. package/src/monorepo/packed-package.ts +89 -37
  98. package/src/monorepo/packs/index.test.ts +189 -0
  99. package/src/monorepo/packs/index.ts +311 -20
  100. package/src/monorepo/publish-workflow.ts +10 -19
  101. package/src/monorepo/setup-test-tracing.test.ts +120 -0
  102. package/src/monorepo/tool-validation.test.ts +261 -0
  103. package/src/monorepo/tool-validation.ts +462 -0
  104. package/src/nx/index.test.ts +73 -0
  105. package/src/nx/index.ts +139 -0
  106. package/src/release/__tests__/bootstrap-npm-packages.test.ts +127 -0
  107. package/src/release/__tests__/candidates.test.ts +262 -0
  108. package/src/release/__tests__/core-properties.test.ts +6 -6
  109. package/src/release/__tests__/core-scenarios.test.ts +27 -20
  110. package/src/release/__tests__/core.test.ts +52 -5
  111. package/src/release/__tests__/fixture-repo.test.ts +90 -31
  112. package/src/release/__tests__/github-release.test.ts +22 -24
  113. package/src/release/__tests__/helpers/fixture-repo.ts +1 -0
  114. package/src/release/__tests__/npm-auth.test.ts +12 -21
  115. package/src/release/__tests__/orchestration.test.ts +142 -12
  116. package/src/release/__tests__/publish-plan.test.ts +9 -3
  117. package/src/release/__tests__/retag-unpublished.test.ts +10 -10
  118. package/src/release/__tests__/trust-publisher.test.ts +165 -0
  119. package/src/release/bootstrap-npm-packages.ts +88 -0
  120. package/src/release/candidates.ts +225 -0
  121. package/src/release/core.ts +96 -10
  122. package/src/release/github-release.ts +3 -3
  123. package/src/release/index.ts +658 -74
  124. package/src/release/npm-auth.ts +4 -33
  125. package/src/release/orchestration.ts +60 -5
  126. package/src/release/publish-plan.ts +1 -1
  127. package/dist/nx-version-actions.cjs +0 -25
  128. package/dist/nx-version-actions.d.cts +0 -6
  129. package/dist/nx-version-actions.d.cts.map +0 -1
  130. package/managed/raw/.git-format-staged.yml +0 -47
  131. package/src/nx-version-actions.cts +0 -36
@@ -1,7 +1,6 @@
1
1
  import type { ReleasePackageInfo } from './core.js';
2
2
 
3
3
  export interface NpmPublishAuthFailureOptions {
4
- useBootstrapToken: boolean;
5
4
  tokenPresent: boolean;
6
5
  repository?: string;
7
6
  }
@@ -30,7 +29,7 @@ export async function publishWithAuthDiagnostics(
30
29
  shell.error(npmPublishAuthFailureMessage(pkg, options));
31
30
  await shell.appendSummary(npmPublishAuthFailureMarkdown(pkg, options));
32
31
  throw new Error(
33
- `${packageVersion}: npm publish authentication failed. Run smoo release trust-publisher after the package exists on npm; see the warning banner above for details.`,
32
+ `${packageVersion}: npm publish authentication failed. Run smoo release trust-publisher; see the warning banner above for details.`,
34
33
  { cause: error },
35
34
  );
36
35
  }
@@ -42,26 +41,11 @@ export function npmPublishAuthFailureMessage(
42
41
  ): string {
43
42
  const packageVersion = `${pkg.name}@${pkg.version}`;
44
43
  const lines = [
45
- `::error title=npm publish authentication failed::${packageVersion} could not be published. This usually means npm trusted publishing is not configured for this package/workflow/repo, or the bootstrap NPM_TOKEN is missing/invalid.`,
44
+ `::error title=npm publish authentication failed::${packageVersion} could not be published. This usually means npm trusted publishing is not configured for this package/workflow/repo.`,
46
45
  '',
47
46
  `🚨 npm publish authentication failed for ${packageVersion}`,
48
47
  '',
49
48
  ];
50
- if (options.useBootstrapToken) {
51
- lines.push(
52
- 'smoo expected a temporary npm automation token because this package does not exist on npm yet.',
53
- options.tokenPresent
54
- ? 'NODE_AUTH_TOKEN/NPM_TOKEN is set, but npm still rejected the bootstrap publish. Check that the token is valid, has publish rights for this scope, and is available to this workflow.'
55
- : 'NODE_AUTH_TOKEN/NPM_TOKEN is not set. Add a temporary NPM_TOKEN repository secret and rerun the Publish workflow.',
56
- '',
57
- 'After the first successful publish, run:',
58
- ' smoo release trust-publisher',
59
- '',
60
- 'Then remove the temporary bootstrap token path for future releases.',
61
- );
62
- return lines.join('\n');
63
- }
64
-
65
49
  lines.push(
66
50
  'smoo expected npm trusted publishing/OIDC because this package already exists on npm.',
67
51
  options.tokenPresent
@@ -75,7 +59,7 @@ export function npmPublishAuthFailureMessage(
75
59
  ' workflow: publish.yml',
76
60
  '3. Rerun the Publish workflow.',
77
61
  '',
78
- 'For first-ever package publishes, add a temporary NPM_TOKEN repository secret, publish once, then run smoo release trust-publisher.',
62
+ 'For first-ever package publishes, run locally: smoo release trust-publisher --bootstrap.',
79
63
  );
80
64
  return lines.join('\n');
81
65
  }
@@ -86,19 +70,6 @@ export function npmPublishAuthFailureMarkdown(
86
70
  ): string {
87
71
  const packageVersion = `${pkg.name}@${pkg.version}`;
88
72
  const lines = ['## 🚨 npm Publish Authentication Failed', '', `Package: \`${packageVersion}\``, ''];
89
- if (options.useBootstrapToken) {
90
- lines.push(
91
- 'smoo expected a temporary npm automation token because this package does not exist on npm yet.',
92
- '',
93
- options.tokenPresent
94
- ? '`NODE_AUTH_TOKEN`/`NPM_TOKEN` is set, but npm still rejected the bootstrap publish. Check that the token is valid, has publish rights for this scope, and is available to this workflow.'
95
- : '`NODE_AUTH_TOKEN`/`NPM_TOKEN` is not set. Add a temporary `NPM_TOKEN` repository secret and rerun the Publish workflow.',
96
- '',
97
- 'After the first successful publish, run `smoo release trust-publisher`, then remove the temporary bootstrap token path for future releases.',
98
- );
99
- return lines.join('\n');
100
- }
101
-
102
73
  lines.push(
103
74
  'smoo expected npm trusted publishing/OIDC because this package already exists on npm.',
104
75
  '',
@@ -112,7 +83,7 @@ export function npmPublishAuthFailureMarkdown(
112
83
  `2. Ensure the npm trusted publisher uses repository \`${trustedPublisherRepository(options)}\` and workflow \`publish.yml\``,
113
84
  '3. Rerun the Publish workflow.',
114
85
  '',
115
- 'For first-ever package publishes, add a temporary `NPM_TOKEN` repository secret, publish once, then run `smoo release trust-publisher`.',
86
+ 'For first-ever package publishes, run `smoo release trust-publisher --bootstrap` locally.',
116
87
  );
117
88
  return lines.join('\n');
118
89
  }
@@ -11,6 +11,7 @@ export interface ReleaseSummary<Package extends ReleasePackageInfo = ReleasePack
11
11
  published: Package[];
12
12
  alreadyPublished: Package[];
13
13
  githubReleases: Package[];
14
+ githubReleaseLinks: Array<{ pkg: Package; url: string }>;
14
15
  rerunRequired: boolean;
15
16
  noRelease: boolean;
16
17
  }
@@ -22,7 +23,11 @@ export interface ReleaseCompletionShell<Package extends ReleasePackageInfo = Rel
22
23
  buildReleaseCandidate(packages: Package[]): Promise<void>;
23
24
  publishPackage(pkg: Package, distTag: string, dryRun: boolean): Promise<void>;
24
25
  listGithubMissingPackages(packages: Package[]): Promise<Package[]>;
25
- createGithubRelease(pkg: Package, dryRun: boolean): Promise<void>;
26
+ createGithubRelease(pkg: Package, dryRun: boolean): Promise<string | null>;
27
+ }
28
+
29
+ export interface ReleaseNextShell<Package extends ReleasePackageInfo = ReleasePackageInfo> {
30
+ bumpStablePackagesToNext(packages: Package[]): Promise<void>;
26
31
  }
27
32
 
28
33
  export interface ReleaseRepairShell<Package extends ReleasePackageInfo = ReleasePackageInfo>
@@ -35,9 +40,10 @@ export interface ReleaseRepairShell<Package extends ReleasePackageInfo = Release
35
40
 
36
41
  export interface ReleaseVersionShell<Package extends ReleasePackageInfo = ReleasePackageInfo> {
37
42
  releasePackagesAtHead(): Promise<Package[]>;
43
+ releaseVersionPackages(bump: string): Promise<Package[]>;
38
44
  ensureLocalReleaseTags(packages: Package[]): Promise<void>;
39
45
  gitHead(): Promise<string>;
40
- runNxReleaseVersion(bump: string, dryRun: boolean): Promise<void>;
46
+ runNxReleaseVersion(packages: Package[], bump: string, dryRun: boolean): Promise<Package[]>;
41
47
  assertCleanGitTree(): Promise<void>;
42
48
  }
43
49
 
@@ -59,10 +65,19 @@ export async function runReleaseVersion<Package extends ReleasePackageInfo>(
59
65
  }
60
66
  }
61
67
 
68
+ const versionPackages = await shell.releaseVersionPackages(options.bump);
69
+ if (versionPackages.length === 0) {
70
+ if (options.bump !== 'auto') {
71
+ // invariant throw: the CLI resolves forced bumps from the full owned release package set.
72
+ throw new Error(`No release packages were selected for forced --bump ${options.bump}.`);
73
+ }
74
+ return { mode: 'none', packages: [], status: 'no-release-needed' };
75
+ }
76
+
62
77
  const headBeforeVersioning = await shell.gitHead();
63
- await shell.runNxReleaseVersion(options.bump, options.dryRun);
78
+ const dryRunPackages = await shell.runNxReleaseVersion(versionPackages, options.bump, options.dryRun);
64
79
  if (options.dryRun) {
65
- return { mode: 'none', packages: [], status: 'dry-run' };
80
+ return { mode: 'none', packages: dryRunPackages, status: 'dry-run' };
66
81
  }
67
82
 
68
83
  await shell.assertCleanGitTree();
@@ -103,12 +118,30 @@ export async function completeReleaseAtHead<Package extends ReleasePackageInfo>(
103
118
  });
104
119
  }
105
120
 
121
+ export async function bumpStableReleaseToNext<Package extends ReleasePackageInfo>(
122
+ shell: ReleaseNextShell<Package>,
123
+ packages: Package[],
124
+ dryRun: boolean,
125
+ rerunRequired: boolean,
126
+ ): Promise<Package[]> {
127
+ const stablePackages = packages.filter((pkg) => !pkg.version.includes('-'));
128
+ if (dryRun || rerunRequired || stablePackages.length === 0) {
129
+ return [];
130
+ }
131
+ await shell.bumpStablePackagesToNext(stablePackages);
132
+ return stablePackages;
133
+ }
134
+
106
135
  export async function repairPendingTargets<Package extends ReleasePackageInfo>(
107
136
  shell: ReleaseRepairShell<Package>,
108
137
  targets: Array<ReleaseTarget<Package>>,
109
138
  restoreRef: string,
110
139
  dryRun: boolean,
111
140
  ): Promise<Array<ReleaseSummary<Package>>> {
141
+ if (dryRun) {
142
+ return targets.map((target) => repairDryRunSummary(target));
143
+ }
144
+
112
145
  const summaries: Array<ReleaseSummary<Package>> = [];
113
146
  try {
114
147
  for (const target of targets) {
@@ -129,6 +162,23 @@ export async function repairPendingTargets<Package extends ReleasePackageInfo>(
129
162
  return summaries;
130
163
  }
131
164
 
165
+ function repairDryRunSummary<Package extends ReleasePackageInfo>(
166
+ target: ReleaseTarget<Package>,
167
+ ): ReleaseSummary<Package> {
168
+ return {
169
+ sha: target.sha,
170
+ dryRun: true,
171
+ packages: target.packages,
172
+ pushed: false,
173
+ published: [],
174
+ alreadyPublished: target.packages.filter((pkg) => !target.npmPackages.includes(pkg)),
175
+ githubReleases: [],
176
+ githubReleaseLinks: [],
177
+ rerunRequired: false,
178
+ noRelease: false,
179
+ };
180
+ }
181
+
132
182
  export async function completeRepairTargetAtHead<Package extends ReleasePackageInfo>(
133
183
  shell: ReleaseCompletionShell<Package>,
134
184
  target: ReleaseTarget<Package>,
@@ -168,8 +218,12 @@ async function completePlannedRelease<Package extends ReleasePackageInfo>(
168
218
  for (const { pkg, distTag } of plan.publishPackages) {
169
219
  await shell.publishPackage(pkg, distTag, input.dryRun);
170
220
  }
221
+ const githubReleaseLinks: Array<{ pkg: Package; url: string }> = [];
171
222
  for (const pkg of plan.githubReleasePackages) {
172
- await shell.createGithubRelease(pkg, input.dryRun);
223
+ const url = await shell.createGithubRelease(pkg, input.dryRun);
224
+ if (url) {
225
+ githubReleaseLinks.push({ pkg, url });
226
+ }
173
227
  }
174
228
 
175
229
  return {
@@ -180,6 +234,7 @@ async function completePlannedRelease<Package extends ReleasePackageInfo>(
180
234
  published: input.dryRun ? [] : plan.publishPackages.map((action) => action.pkg),
181
235
  alreadyPublished: input.packages.filter((pkg) => !input.npmMissingPackages.includes(pkg)),
182
236
  githubReleases: input.dryRun ? [] : plan.githubReleasePackages,
237
+ githubReleaseLinks,
183
238
  rerunRequired: input.rerunRequired,
184
239
  noRelease: false,
185
240
  };
@@ -26,7 +26,7 @@ export function planPublishActions<Package extends ReleasePackageInfo>(
26
26
  const githubReleasePackages = input.releasePackages.filter((pkg) => githubMissingNames.has(pkg.name));
27
27
 
28
28
  return {
29
- buildProjects: npmPackages.map((pkg) => pkg.name),
29
+ buildProjects: npmPackages.map((pkg) => pkg.projectName),
30
30
  publishPackages: npmPackages.map((pkg) => ({ pkg, distTag: npmDistTagForVersion(pkg.version) })),
31
31
  githubReleasePackages,
32
32
  };
@@ -1,25 +0,0 @@
1
- "use strict";
2
- const nxJsVersionActions = require('@nx/js/src/release/version-actions');
3
- const baseVersionActions = nxJsVersionActions.default ?? nxJsVersionActions;
4
- const afterAllProjectsVersioned = async (cwd, options) => {
5
- const result = await nxJsVersionActions.afterAllProjectsVersioned(cwd, options);
6
- // Temporary Bun workaround. Remove this hook only after all three issues are
7
- // fixed in supported Bun versions:
8
- // - https://github.com/oven-sh/bun/issues/18906
9
- // - https://github.com/oven-sh/bun/issues/20477
10
- // - https://github.com/oven-sh/bun/issues/20829
11
- // Nx runs `bun install --lockfile-only`, but Bun currently leaves workspace
12
- // versions stale in bun.lock. `bun pm pack` then rewrites `workspace:*` using
13
- // those stale lockfile versions instead of the current package.json versions.
14
- const { syncBunLockfileVersions } = await import('./monorepo/lockfile.js');
15
- const updated = syncBunLockfileVersions(cwd);
16
- if (updated === 0) {
17
- return result;
18
- }
19
- return {
20
- changedFiles: Array.from(new Set([...result.changedFiles, 'bun.lock'])),
21
- deletedFiles: result.deletedFiles,
22
- };
23
- };
24
- baseVersionActions.afterAllProjectsVersioned = afterAllProjectsVersioned;
25
- module.exports = baseVersionActions;
@@ -1,6 +0,0 @@
1
- import type { AfterAllProjectsVersioned, VersionActions } from 'nx/release';
2
- declare const baseVersionActions: typeof VersionActions & {
3
- afterAllProjectsVersioned: AfterAllProjectsVersioned;
4
- };
5
- export = baseVersionActions;
6
- //# sourceMappingURL=nx-version-actions.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nx-version-actions.d.cts","sourceRoot":"","sources":["../src/nx-version-actions.cts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ5E,QAAA,MAAM,kBAAkB;+BALyC,yBAAyB;CAKf,CAAC;AA2B5E,SAAS,kBAAkB,CAAC"}
@@ -1,47 +0,0 @@
1
- # git-format-staged configuration for SmoothBricks-style monorepos
2
-
3
- formatters:
4
- eslint:
5
- command: eslint-stdout '{}'
6
- patterns:
7
- - '*.astro'
8
- - '!.*'
9
- - '!.*/**'
10
-
11
- biome:
12
- command: biome check --files-ignore-unknown=true --use-editorconfig=true '--stdin-file-path={}' --fix
13
- patterns:
14
- - '*.js'
15
- - '*.ts'
16
- - '*.jsx'
17
- - '*.tsx'
18
- - '*.json'
19
- - '*.jsonc'
20
- - '*.html'
21
- - '*.css'
22
- - '*.graphql'
23
-
24
- prettier:
25
- command: prettier --ignore-unknown --stdin-filepath '{}'
26
- patterns:
27
- - '*'
28
- - '!.*'
29
- - '!*.js'
30
- - '!*.ts'
31
- - '!*.jsx'
32
- - '!*.tsx'
33
- - '!*.json'
34
- - '!*.jsonc'
35
- - '!*.html'
36
- - '!*.css'
37
- - '!*.graphql'
38
- - '!*.nix'
39
-
40
- alejandra:
41
- command: alejandra
42
- patterns:
43
- - '*.nix'
44
-
45
- settings:
46
- update_working_tree: true
47
- show_commands: true
@@ -1,36 +0,0 @@
1
- import type { AfterAllProjectsVersioned, VersionActions } from 'nx/release';
2
-
3
- type VersionActionsModule = typeof VersionActions & {
4
- default?: typeof VersionActions & { afterAllProjectsVersioned: AfterAllProjectsVersioned };
5
- afterAllProjectsVersioned: AfterAllProjectsVersioned;
6
- };
7
-
8
- const nxJsVersionActions = require('@nx/js/src/release/version-actions') as VersionActionsModule;
9
- const baseVersionActions = nxJsVersionActions.default ?? nxJsVersionActions;
10
-
11
- const afterAllProjectsVersioned: AfterAllProjectsVersioned = async (cwd, options) => {
12
- const result = await nxJsVersionActions.afterAllProjectsVersioned(cwd, options);
13
-
14
- // Temporary Bun workaround. Remove this hook only after all three issues are
15
- // fixed in supported Bun versions:
16
- // - https://github.com/oven-sh/bun/issues/18906
17
- // - https://github.com/oven-sh/bun/issues/20477
18
- // - https://github.com/oven-sh/bun/issues/20829
19
- // Nx runs `bun install --lockfile-only`, but Bun currently leaves workspace
20
- // versions stale in bun.lock. `bun pm pack` then rewrites `workspace:*` using
21
- // those stale lockfile versions instead of the current package.json versions.
22
- const { syncBunLockfileVersions } = await import('./monorepo/lockfile.js');
23
- const updated = syncBunLockfileVersions(cwd);
24
- if (updated === 0) {
25
- return result;
26
- }
27
-
28
- return {
29
- changedFiles: Array.from(new Set([...result.changedFiles, 'bun.lock'])),
30
- deletedFiles: result.deletedFiles,
31
- };
32
- };
33
-
34
- baseVersionActions.afterAllProjectsVersioned = afterAllProjectsVersioned;
35
-
36
- export = baseVersionActions;