From e5c7293d9189caae32a3c3219b4eb943898b0730 Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Fri, 20 Dec 2024 17:05:04 -0500 Subject: [PATCH] Avoid tagging 6.x releases with latest tag on npm --- scripts/publish.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/publish.js b/scripts/publish.js index 4c30df0a79..7f0faa99c8 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -42,7 +42,10 @@ async function ensureBuildVersion(packageName, version) { */ function publishBuild(packageName, tag) { let buildDir = path.join(rootDir, "packages", packageName); - let args = ["--access public", `--tag ${tag}`]; + let args = ["--access public"]; + if (tag) { + args.push(`--tag ${tag}`); + } if (tag === "experimental" || tag === "nightly") { args.push(`--no-git-checks`); } else { @@ -75,13 +78,18 @@ async function run() { ); // 2. Determine the appropriate npm tag to use - let tag = version.includes("experimental") - ? "experimental" - : version.includes("nightly") - ? "nightly" - : semver.prerelease(version) == null - ? "latest" - : "pre"; + let tag; + if (version.includes("experimental")) { + tag = "experimental"; + } else if (version.includes("nightly")) { + tag = "nightly"; + } else if (version.startsWith("7.")) { + if (semver.prerelease(version) == null) { + tag = "latest"; + } else { + tag = "pre"; + } + } console.log(); console.log(` Publishing version ${version} to npm with tag "${tag}"`);