Skip to content

Commit 35f5085

Browse files
committed
Clarify the version comparison check
1 parent 761377f commit 35f5085

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/monorepo-workflow-operations.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,11 @@ async function planRelease(
183183
const pkg = project.workspacePackages[packageName];
184184
const versionSpecifier = releaseSpecification.packages[packageName];
185185
const currentVersion = pkg.manifest.version;
186-
const newVersion =
187-
versionSpecifier instanceof SemVer
188-
? versionSpecifier
189-
: new SemVer(currentVersion.toString()).inc(versionSpecifier);
190-
const comparison = newVersion.compare(currentVersion);
186+
let newVersion: SemVer;
191187

192188
if (versionSpecifier instanceof SemVer) {
189+
const comparison = versionSpecifier.compare(currentVersion);
190+
193191
if (comparison === 0) {
194192
throw new Error(
195193
[
@@ -207,6 +205,10 @@ async function planRelease(
207205
].join('\n\n'),
208206
);
209207
}
208+
209+
newVersion = versionSpecifier;
210+
} else {
211+
newVersion = new SemVer(currentVersion.toString()).inc(versionSpecifier);
210212
}
211213

212214
return {

0 commit comments

Comments
 (0)