From 61e256b6623853828dade09d875c87632c58029c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E4=BA=9A=E6=98=95?= <1549469775@qq.com> Date: Mon, 1 Dec 2025 15:07:17 +0800 Subject: [PATCH] chore: update package.json scripts to include docs:publish command and modify publish-branch.js for improved error handling --- package.json | 4 ++-- scripts/publish-branch.js | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 8717361..5e4f05e 100644 --- a/package.json +++ b/package.json @@ -28,12 +28,12 @@ "watch": "somebuild build --watch", "dev": "somebuild dev", "build": "somebuild build", - "release": "pnpm build && node scripts/publish-branch.js", "eslint": "eslint .", "format": "eslint --fix .", "publish": "pnpm build && npm publish", "docs:dev": "vuepress dev docs", - "docs:build": "vuepress build docs" + "docs:build": "vuepress build docs", + "docs:publish": "pnpm docs:build && node scripts/publish-branch.js" }, "globals": { "vue": "Vue" diff --git a/scripts/publish-branch.js b/scripts/publish-branch.js index 3e45ce7..4c1fdd4 100644 --- a/scripts/publish-branch.js +++ b/scripts/publish-branch.js @@ -1,11 +1,10 @@ import ghpages from "gh-pages" ghpages.publish( - ".", - { dotfiles: true, branch: "published", src: ["package.json", "dist/**/*"] }, - (err) => { - if (err) - throw err - console.log("success") - }, -) + "docs/\.vuepress/dist", + { dotfiles: true, branch: "published" }, +).then(() => { + console.log("success") +}).catch((err) => { + console.error(err) +})