From a1ee1da9a0ee39ebff30c0228907f044ea705812 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 22 Jul 2026 14:03:47 +0000 Subject: [PATCH 1/2] =?UTF-8?q?fix(publish):=20=E7=99=BB=E8=AE=B0=20@sfmc-?= =?UTF-8?q?bds/tools=20=E5=88=B0=E5=8F=91=E5=8C=85=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E4=B8=8E=20workspaces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit npm-publish 在 tag @sfmc-bds/tools@v0.1.0 上因清单未知包失败 (run 29926464473)。补登记、纳入 workspace,并修正 main/files/build。 Co-authored-by: Shiroha --- package-lock.json | 15 ++++++++++++++- package.json | 5 +++-- tools/lib/npm-publish-packages.mjs | 1 + tools/package.json | 15 +++++++++++++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5710a430..ee3b5fb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,8 @@ "qq-bridge", "bds-tools", "sfmc", - "remote-controller" + "remote-controller", + "tools" ], "bin": { "sfmc": "sfmc/dist/main.js" @@ -864,6 +865,10 @@ "resolved": "modules/sdk/@sfmc-sdk", "link": true }, + "node_modules/@sfmc-bds/tools": { + "resolved": "tools", + "link": true + }, "node_modules/@tsconfig/node10": { "version": "1.0.12", "resolved": "https://registry.npmmirror.com/@tsconfig/node10/-/node10-1.0.12.tgz", @@ -3157,6 +3162,14 @@ "engines": { "node": ">=22.13.0" } + }, + "tools": { + "name": "@sfmc-bds/tools", + "version": "0.1.0", + "license": "AGPL-3.0-only", + "engines": { + "node": ">=22.13.0" + } } } } diff --git a/package.json b/package.json index b2f1c329..33e660ca 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "module-core:typecheck": "npm run sdk:typecheck", "module-core:test": "echo \"no sdk tests yet\"", "module-core:verify": "npm run sdk:verify", - "pack:verify": "npm run build --workspaces --if-present && npm pack -w @sfmc-bds/sdk && npm pack -w @sfmc-bds/cli && npm pack -w @sfmc-bds/db-server && npm pack -w @sfmc-bds/qq-bridge && npm pack -w @sfmc-bds/bds-tools", + "pack:verify": "npm run build --workspaces --if-present && npm pack -w @sfmc-bds/sdk && npm pack -w @sfmc-bds/cli && npm pack -w @sfmc-bds/db-server && npm pack -w @sfmc-bds/qq-bridge && npm pack -w @sfmc-bds/bds-tools && npm pack -w @sfmc-bds/tools", "check-modules": "node tools/check-modules.mjs", "catalog-sync": "node tools/catalog-sync.mjs", "check-ootb": "node tools/check-ootb.mjs", @@ -56,7 +56,8 @@ "qq-bridge", "bds-tools", "sfmc", - "remote-controller" + "remote-controller", + "tools" ], "engines": { "node": ">=22.13.0" diff --git a/tools/lib/npm-publish-packages.mjs b/tools/lib/npm-publish-packages.mjs index 028682ca..8a6dbf19 100644 --- a/tools/lib/npm-publish-packages.mjs +++ b/tools/lib/npm-publish-packages.mjs @@ -10,6 +10,7 @@ export const NPM_PUBLISH_PACKAGES = { "@sfmc-bds/db-server": "db-server/package.json", "@sfmc-bds/qq-bridge": "qq-bridge/package.json", "@sfmc-bds/bds-tools": "bds-tools/package.json", + "@sfmc-bds/tools": "tools/package.json", }; /** @returns {keyof typeof NPM_PUBLISH_PACKAGES | null} */ diff --git a/tools/package.json b/tools/package.json index ec905870..3c2f1dfe 100644 --- a/tools/package.json +++ b/tools/package.json @@ -20,11 +20,22 @@ "tools", "scriptsforminecraftserver" ], - "main": "check-ootb.js", + "main": "check-ootb.mjs", "files": [ - "./*", + "*.mjs", + "lib", "README.md" ], + "scripts": { + "build": "node -e \"process.exit(0)\"", + "check-ootb": "node check-ootb.mjs", + "check-modules": "node check-modules.mjs", + "catalog-sync": "node catalog-sync.mjs", + "smoke-modules": "node smoke-modules.mjs" + }, + "engines": { + "node": ">=22.13.0" + }, "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" From 19c0ed57189312a78be78839e154cd3bedbddaf0 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 22 Jul 2026 14:03:47 +0000 Subject: [PATCH 2/2] =?UTF-8?q?fix(ci):=20npm-publish=20=E7=A9=BA=20jobs?= =?UTF-8?q?=20=E9=97=A8=E6=8E=A7=20+=20build=20--if-present?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - inputs.tag 非 required + ref_type==tag,避免改 workflow 的 branch push 空 jobs - build 使用 --if-present,兼容无编译步骤的纯 mjs 包 Co-authored-by: Shiroha --- .github/workflows/npm-publish.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index e4cd5b82..d12910fe 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -14,14 +14,18 @@ on: inputs: tag: description: "要发布的 tag(如 @sfmc-bds/sdk@v0.1.0)" - required: true + # 勿 required:true:改本 workflow 的 branch push 会被 GHA 误评估, + # 缺 inputs 时出现空 jobs + "workflow file issue" failure(见 run 29922880511)。 + required: false type: string jobs: publish: + # dispatch 放行;push 仅真实 tag 且 @sfmc-bds/ 前缀才跑。 + # ref_type==tag 防御误触的 branch push(skipped 绿,而非空 jobs 红)。 if: >- github.event_name == 'workflow_dispatch' || - startsWith(github.ref_name, '@sfmc-bds/') + (github.ref_type == 'tag' && startsWith(github.ref_name, '@sfmc-bds/')) runs-on: ubuntu-latest permissions: contents: read @@ -56,7 +60,8 @@ jobs: - name: build target workspace if: steps.meta.outputs.already_published != 'true' - run: npm run build --workspace "${{ steps.meta.outputs.workspace }}" + # --if-present: 允许无编译步骤的纯 JS/mjs 包(如 @sfmc-bds/tools) + run: npm run build --workspace "${{ steps.meta.outputs.workspace }}" --if-present - name: publish to npm if: steps.meta.outputs.already_published != 'true'