diff --git a/scripts/release.ts b/scripts/release.ts index e3fbb89..761f215 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -66,6 +66,9 @@ async function selectBumpType(): Promise { async function stepBumpVersion(): Promise { const pkgPath = join(import.meta.dir, "..", "package.json"); const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as { version: string }; + if (typeof pkg.version !== "string" || pkg.version.length === 0) { + throw new Error("package.json 中缺少有效的 version 字段"); + } const currentVersion = pkg.version; const bumpType = await selectBumpType();