Skip to content

Commit

Permalink
fix(release): deleted files should be staged alongside changed files (#…
Browse files Browse the repository at this point in the history
…27219)

(cherry picked from commit 66a8c75)
  • Loading branch information
JamesHenry authored and FrozenPandaz committed Jul 30, 2024
1 parent f5fa7ec commit 56bf5ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/nx/src/command-line/release/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,10 @@ export async function releaseVersion(
...tree.listChanges().map((f) => f.path),
...additionalChangedFiles,
];
const deletedFiles = Array.from(additionalDeletedFiles);

// No further actions are necessary in this scenario (e.g. if conventional commits detected no changes)
if (!changedFiles.length) {
if (!changedFiles.length && !deletedFiles.length) {
return {
// An overall workspace version cannot be relevant when filtering to independent projects
workspaceVersion: undefined,
Expand All @@ -294,7 +295,7 @@ export async function releaseVersion(
if (args.gitCommit ?? nxReleaseConfig.version.git.commit) {
await commitChanges({
changedFiles,
deletedFiles: Array.from(additionalDeletedFiles),
deletedFiles,
isDryRun: !!args.dryRun,
isVerbose: !!args.verbose,
gitCommitMessages: createCommitMessageValues(
Expand All @@ -310,6 +311,7 @@ export async function releaseVersion(
output.logSingleLine(`Staging changed files with git`);
await gitAdd({
changedFiles,
deletedFiles,
dryRun: args.dryRun,
verbose: args.verbose,
});
Expand Down

0 comments on commit 56bf5ff

Please sign in to comment.