fix: 添加 package.json version 字段校验
This commit is contained in:
@@ -66,6 +66,9 @@ async function selectBumpType(): Promise<BumpType> {
|
||||
async function stepBumpVersion(): Promise<string> {
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user