From 4bb3c5273e32fe8425191fe44e661adbfbdadb35 Mon Sep 17 00:00:00 2001 From: Dan Cormier Date: Thu, 8 Oct 2026 15:09:36 -0400 Subject: [PATCH] fix(release): allow all major-zero editor versions --- README.md | 2 +- scripts/validate-v0-version.mjs | 9 ++---- scripts/validate-v0-version.test.mjs | 46 +++++++++++++++++++++++----- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 1bb4e222..02c83600 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ You can upload your `stats.json` file [here](http://webpack.github.io/analyse/) ## Publishing V0 maintenance releases -The `v0` branch preserves the final pre-1.0 Editor line for supported 0.15.x maintenance. Current Editor development and stable releases use `main`. +The `v0` branch supports Editor releases with major version zero (`0.x.x`), including prereleases such as `0.16.0-beta.1`. The release guard rejects invalid semantic versions and any version with major version one or higher. Current Editor development and stable releases use `main`. We use [Changesets](https://github.com/changesets/changesets) to create release pull requests, update the changelog, and publish packages. diff --git a/scripts/validate-v0-version.mjs b/scripts/validate-v0-version.mjs index 37c5540a..f78e7e9c 100644 --- a/scripts/validate-v0-version.mjs +++ b/scripts/validate-v0-version.mjs @@ -6,14 +6,9 @@ import semver from "semver"; export function validateV0Version(version) { const parsedVersion = semver.parse(version); - if ( - parsedVersion === null || - parsedVersion.major !== 0 || - parsedVersion.minor !== 15 || - parsedVersion.prerelease.length !== 0 - ) { + if (parsedVersion === null || parsedVersion.major !== 0) { throw new Error( - `The package version "${version}" is outside the supported stable 0.15.x maintenance line.` + `The package version "${version}" is outside the supported 0.x.x release line.` ); } diff --git a/scripts/validate-v0-version.test.mjs b/scripts/validate-v0-version.test.mjs index 9c5a2a19..c4cf10ec 100644 --- a/scripts/validate-v0-version.test.mjs +++ b/scripts/validate-v0-version.test.mjs @@ -4,19 +4,51 @@ import { describe, test } from "node:test"; import { validateV0Version } from "./validate-v0-version.mjs"; describe("validateV0Version", () => { - test("accepts stable versions on the 0.15.x maintenance line", () => { - for (const version of ["0.15.0", "0.15.4", "0.15.99"]) { + test("accepts any stable version with major version zero", () => { + for (const version of [ + "0.0.0", + "0.14.9", + "0.15.0", + "0.15.4", + "0.15.99", + "0.16.0", + "0.99.99", + ]) { assert.equal(validateV0Version(version), version); } }); - test("rejects versions outside the stable 0.15.x maintenance line", () => { + test("accepts prereleases and build metadata with major version zero", () => { + for (const version of [ + "0.16.0-alpha.0", + "0.16.0-beta.1", + "0.16.0-rc.1", + "0.16.0+build.123", + "0.16.0-beta.1+build.123", + ]) { + assert.equal(validateV0Version(version), version); + } + }); + + test("rejects versions with a nonzero major version", () => { for (const version of [ - "", - "0.14.9", - "0.15.5-beta.0", - "0.16.0", "1.0.0", + "1.0.0-beta.1", + "1.0.0+build.123", + "2.0.0", + "2.0.0-rc.1", + ]) { + assert.throws(() => validateV0Version(version)); + } + }); + + test("rejects invalid semantic versions", () => { + for (const version of [ + "", + "not-a-version", + "0.16", + "0.16.x", + "0.16.0-beta.01", ]) { assert.throws(() => validateV0Version(version)); }