From 5d25b9340616a4afa80b1ec1aa4102a954b291b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carbon=20=E7=A2=B3=E8=8B=AF?= Date: Fri, 20 Feb 2026 17:43:36 +0800 Subject: [PATCH 1/2] chore: enhance release workflow to check for existing tags before creating GitHub Release --- .github/workflows/Release.yml | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 5c3056f..1d9c77f 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -144,7 +144,8 @@ jobs: run: | npm config set provenance true echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - # 读取 package.json 版本号,检查对应的 tag 是否已存在 + # 先 fetch tags,然后检查对应的 tag 是否已存在 + git fetch --tags --force VERSION=$(node -p "require('./package.json').version") TAG="v$VERSION" if git rev-parse "$TAG" >/dev/null 2>&1; then diff --git a/package.json b/package.json index 10086d9..6a7338f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rush-fs", - "version": "0.0.3", + "version": "0.0.4", "description": "High-performance drop-in replacement for Node.js fs module, powered by Rust", "main": "index.js", "repository": { From 623d32bde22329dfdb688f541f5d76337ff1daa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carbon=20=E7=A2=B3=E8=8B=AF?= Date: Fri, 20 Feb 2026 18:21:27 +0800 Subject: [PATCH 2/2] chore: update release workflow to prepend package names with scope and adjust optional dependencies --- .github/workflows/Release.yml | 46 ++++++++++++++++++++++++++++++++--- package.json | 2 +- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml index 1d9c77f..e88cfe1 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -133,13 +133,31 @@ jobs: const p = JSON.parse(fs.readFileSync('package.json', 'utf8')); const v = p.version; p.optionalDependencies = { - 'rush-fs-win32-x64-msvc': v, - 'rush-fs-darwin-x64': v, - 'rush-fs-linux-x64-gnu': v, - 'rush-fs-darwin-arm64': v + '@rush-fs/rush-fs-win32-x64-msvc': v, + '@rush-fs/rush-fs-darwin-x64': v, + '@rush-fs/rush-fs-linux-x64-gnu': v, + '@rush-fs/rush-fs-darwin-arm64': v }; fs.writeFileSync('package.json', JSON.stringify(p, null, 2)); " + - name: Update platform package names to use scope (@rush-fs/xxx) + run: | + for dir in npm/*/; do + if [ -f "$dir/package.json" ]; then + PKG_PATH="$dir/package.json" + export PKG_PATH + node -e " + const fs = require('fs'); + const pkgPath = process.env.PKG_PATH; + const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); + console.log('Updating package name from', pkg.name, 'to @rush-fs/' + pkg.name); + if (!pkg.name.startsWith('@rush-fs/')) { + pkg.name = '@rush-fs/' + pkg.name; + fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2)); + } + " + fi + done - name: Publish to npm run: | npm config set provenance true @@ -155,6 +173,26 @@ jobs: echo "Tag $TAG does not exist, will create GitHub Release" pnpm prepublishOnly fi + # prepublish 之后再次更新包名(因为 prepublish 可能会更新 package.json) + for dir in npm/*/; do + if [ -f "$dir/package.json" ]; then + PKG_PATH="$dir/package.json" + export PKG_PATH + node -e " + const fs = require('fs'); + const pkgPath = process.env.PKG_PATH; + const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); + if (!pkg.name.startsWith('@rush-fs/')) { + console.log('Fixing package name:', pkg.name, '-> @rush-fs/' + pkg.name); + pkg.name = '@rush-fs/' + pkg.name; + fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2)); + } + " + fi + done + # 主包 index.js 里 require 的是 rush-fs-xxx,改为 @rush-fs/rush-fs-xxx 才能找到已发布的平台包 + sed -i "s/require('rush-fs-/require('@rush-fs\/rush-fs-/g" index.js + sed -i 's/require(\"rush-fs-/require(\"@rush-fs\/rush-fs-/g' index.js npm publish --access public env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 6a7338f..ed8a0a3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "repository": { "type": "git", - "url": "git+https://github.com/rush-fs/rush-fs.git" + "url": "git+https://github.com/CoderSerio/rush-fs.git" }, "license": "MIT", "browser": "browser.js",