Skip to content

Commit

Permalink
fix(version): propose current prerelease identifier instead of alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Jan 11, 2022
1 parent d17fce6 commit 97e96f3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
Placeholder for the next version (at the beginning of the line):
## **WORK IN PROGRESS**
-->
## 3.5.0-beta.5 (2022-01-11)
## **WORK IN PROGRESS**
* Support managing Yarn monorepos without `lerna`
* Fix: `version` plugin tries to propose the current prerelease identifier instead of always `alpha`

## 3.4.3 (2022-01-10)
* Replace `colors` dependency with `picocolors`
Expand Down
14 changes: 9 additions & 5 deletions packages/plugin-version/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ class VersionPlugin implements Plugin {
let deleteLines = 2;
let askOk = false;

let preid = context.argv.preid ?? parsedVersion?.prerelease?.[0];
if (typeof preid !== "string" || !Number.isNaN(parseInt(preid, 10))) {
preid = undefined;
}

if (!context.argv.bump) {
context.cli.log(`Version bump not provided`);
let preid = context.argv.preid ?? parsedVersion?.prerelease?.[0];
if (typeof preid !== "string" || !Number.isNaN(parseInt(preid, 10))) {
preid = undefined;
}
context.argv.bump = await context.cli.select("Please choose a version", [
{
value: "major",
Expand Down Expand Up @@ -99,7 +100,10 @@ class VersionPlugin implements Plugin {

if (context.argv.bump.startsWith("pre")) {
context.argv.preid = (
await context.cli.ask("Please enter the desired prerelease identifier", "alpha")
await context.cli.ask(
"Please enter the desired prerelease identifier",
preid ?? "alpha",
)
).trim();
deleteLines++;
askOk = true;
Expand Down
1 change: 0 additions & 1 deletion packages/release-script/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ export async function main(): Promise<void> {
.positional("preid", {
describe: "The prerelease identifier. Only for pre* bumps.",
required: false,
default: "alpha",
}),
)
.wrap(yargs.terminalWidth())
Expand Down

0 comments on commit 97e96f3

Please sign in to comment.