From bad63e1bf5ab9d608d2924810d74c5d442b6bd27 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Tue, 13 Jan 2026 19:41:20 +0800 Subject: [PATCH] WIP --- extra/beta/update-version.js | 17 ++++++++++++----- extra/release/beta.mjs | 1 - 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/extra/beta/update-version.js b/extra/beta/update-version.js index 4b274e963..02026cdcb 100644 --- a/extra/beta/update-version.js +++ b/extra/beta/update-version.js @@ -23,13 +23,17 @@ if (!exists) { // Also update package-lock.json const npm = /^win/.test(process.platform) ? "npm.cmd" : "npm"; - const resultVersion = childProcess.spawnSync(npm, ["--no-git-tag-version", "version", version]); + const resultVersion = childProcess.spawnSync(npm, ["--no-git-tag-version", "version", version], { + shell: true, + }); if (resultVersion.error) { console.error(resultVersion.error); console.error("error npm version!"); process.exit(1); } - const resultInstall = childProcess.spawnSync(npm, ["install"]); + const resultInstall = childProcess.spawnSync(npm, ["install"], { + shell: true, + }); if (resultInstall.error) { console.error(resultInstall.error); console.error("error update package-lock!"); @@ -58,10 +62,13 @@ function commit(version) { throw new Error("commit error"); } + // Get the current branch name + res = childProcess.spawnSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]); + let branchName = res.stdout.toString().trim(); + console.log("Current branch:", branchName); + // Git push the branch - childProcess.spawnSync("git", ["push", "origin"]); - stdout = res.stdout.toString().trim(); - console.log(stdout); + childProcess.spawnSync("git", ["push", "origin", branchName, "--force"], { stdio: "inherit" }); } /** diff --git a/extra/release/beta.mjs b/extra/release/beta.mjs index d9f9b70bf..d951bcba8 100644 --- a/extra/release/beta.mjs +++ b/extra/release/beta.mjs @@ -13,7 +13,6 @@ import { createReleasePR, } from "./lib.mjs"; import semver from "semver"; -import { spawnSync } from "node:child_process"; const repoNames = getRepoNames(); const version = process.env.RELEASE_BETA_VERSION;