Skip to content

Refine version update logic to allow arbitrary identifiers (e.g., "beta", not just "preview")#1193

Merged
SteveSandersonMS merged 1 commit into
mainfrom
stevesa/prerelease-names
May 4, 2026
Merged

Refine version update logic to allow arbitrary identifiers (e.g., "beta", not just "preview")#1193
SteveSandersonMS merged 1 commit into
mainfrom
stevesa/prerelease-names

Conversation

@SteveSandersonMS
Copy link
Copy Markdown
Contributor

No description provided.

…ta", not just "preview")

Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 4, 2026 12:27
@SteveSandersonMS SteveSandersonMS requested a review from a team as a code owner May 4, 2026 12:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the Node SDK publish-version calculation into a reusable helper to support incrementing prereleases without forcing a fixed identifier (e.g., allow beta, chicken, etc.), and updates the publish script and tests accordingly.

Changes:

  • Extracted version selection/increment logic into scripts/calculate-version.js with updated prerelease identifier handling.
  • Simplified scripts/get-version.js to delegate to calculateVersion(...).
  • Added Vitest coverage for key prerelease/stable/unstable increment scenarios.
Show a summary per file
File Description
nodejs/test/get-version.test.ts Adds unit tests covering stable bumps and preserving prerelease identifiers.
nodejs/scripts/get-version.js Switches CLI script to call the shared calculateVersion helper.
nodejs/scripts/calculate-version.js New helper implementing version selection + increment rules, including “preserve identifier” behavior.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment on lines +34 to +38
const command = process.argv[2];
const latest = await getLatestVersion("latest");
const prerelease = await getLatestVersion("prerelease");
const unstable = command === "unstable" ? await getLatestVersion("unstable") : undefined;
console.log(calculateVersion(command, { latest, prerelease, unstable }));
Comment on lines +35 to +37
const latest = await getLatestVersion("latest");
const prerelease = await getLatestVersion("prerelease");
const unstable = command === "unstable" ? await getLatestVersion("unstable") : undefined;
Comment on lines +6 to +19
if (!validCommands.includes(command)) {
throw new Error(
`Invalid argument, must be one of: ${validCommands.join(", ")}, got: "${command}"`
);
}

if (!latest) {
throw new Error("No latest version found. Publish an initial version first.");
}

// Output the current latest version to stdout
if (command === "current") {
return latest;
}
@github-actions github-actions Bot mentioned this pull request May 4, 2026
@SteveSandersonMS SteveSandersonMS merged commit 6a0e065 into main May 4, 2026
22 checks passed
@SteveSandersonMS SteveSandersonMS deleted the stevesa/prerelease-names branch May 4, 2026 12:32
Copy link
Copy Markdown

@christinacamacho230-cmyk christinacamacho230-cmyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Copy Markdown

@christinacamacho230-cmyk christinacamacho230-cmyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice agent 😊

Copy link
Copy Markdown

@Montiwa11 Montiwa11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Montiwa Agreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants