Removed compatibility support for old Changesets v1 (#657)

This commit is contained in:
Mateusz Burzyński
2026-06-15 08:03:20 +00:00
committed by GitHub
parent 1bf7c2782b
commit 4f718b5921
2 changed files with 6 additions and 24 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@changesets/action": major
---
Removed compatibility support for old Changesets v1.
+1 -24
View File
@@ -6,7 +6,6 @@ import { exec, getExecOutput } from "@actions/exec";
import * as github from "@actions/github"; import * as github from "@actions/github";
import type { PreState } from "@changesets/types"; import type { PreState } from "@changesets/types";
import { type Package, getPackages } from "@manypkg/get-packages"; import { type Package, getPackages } from "@manypkg/get-packages";
import semverLt from "semver/functions/lt.js";
import { Git } from "./git.ts"; import { Git } from "./git.ts";
import type { Octokit } from "./octokit.ts"; import type { Octokit } from "./octokit.ts";
import readChangesetState from "./readChangesetState.ts"; import readChangesetState from "./readChangesetState.ts";
@@ -165,24 +164,6 @@ export async function runPublish({
return { published: false, exitCode: changesetPublishOutput.exitCode }; return { published: false, exitCode: changesetPublishOutput.exitCode };
} }
const requireChangesetsCliPkgJson = (cwd: string) => {
try {
return require(
require.resolve("@changesets/cli/package.json", {
paths: [cwd],
}),
);
} catch (err) {
if (isErrorWithCode(err, "MODULE_NOT_FOUND")) {
throw new Error(
`Have you forgotten to install \`@changesets/cli\` in "${cwd}"?`,
{ cause: err },
);
}
throw err;
}
};
type GetMessageOptions = { type GetMessageOptions = {
hasPublishScript: boolean; hasPublishScript: boolean;
branch: string; branch: string;
@@ -296,17 +277,13 @@ export async function runVersion({
if (script) { if (script) {
await exec(script, undefined, { cwd, env }); await exec(script, undefined, { cwd, env });
} else { } else {
let changesetsCliPkgJson = requireChangesetsCliPkgJson(cwd);
let cmd = semverLt(changesetsCliPkgJson.version, "2.0.0")
? "bump"
: "version";
await exec( await exec(
"node", "node",
[ [
require.resolve("@changesets/cli/bin.js", { require.resolve("@changesets/cli/bin.js", {
paths: [cwd], paths: [cwd],
}), }),
cmd, "version",
], ],
{ {
cwd, cwd,