Skip to content

Commit 77cdebf

Browse files
committed
fix(codebase): report correct target version in dry-run release
1 parent 35889e5 commit 77cdebf

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎pkg/@eserstack/codebase/release.ts‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,24 @@ export const release = async (
201201
const previousVersion = (await readVersionFile()) ?? "0.0.0";
202202

203203
// 4. Bump version (unless type is "same")
204+
//
205+
// Keep the version versions() computed rather than re-reading VERSION after
206+
// the call. Under --dry-run nothing is written, so a re-read returns the OLD
207+
// version and the preview reports "4.1.58 -> 4.1.58" -- telling the user the
208+
// release is a no-op when it is not. targetVersion is computed before any
209+
// write, so it is correct in both modes.
210+
let bumpedVersion: string | undefined;
211+
204212
if (type !== "same") {
205213
// Import versions dynamically to avoid circular deps at module scope
206214
const versionsModule = await import("./versions.ts");
207-
await versionsModule.versions(type, { dryRun });
215+
const bump = await versionsModule.versions(type, { dryRun });
216+
217+
bumpedVersion = bump.targetVersion;
208218
}
209219

210-
// 5. Read new version
211-
const version = (await readVersionFile()) ?? previousVersion;
220+
// 5. Resolve the new version
221+
const version = bumpedVersion ?? (await readVersionFile()) ?? previousVersion;
212222

213223
// 6. Generate changelog
214224
let changelogGenerated = false;

0 commit comments

Comments
 (0)