This repository was archived by the owner on Sep 9, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
fix(release): 进 dimina/fe 之前改用 runner 上的 pnpm #208
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| // dimina/fe 是 submodule 里的一个独立 pnpm workspace,它的 package.json 声明 | ||
| // packageManager: pnpm@12.2.0,和本仓根声明的版本不是同一个。pnpm 一进这个目录 | ||
| // 就会去下载并切换到它声明的那个版本,而 runner 上这次切换会 exec 下载包里的 | ||
| // pnpm.exe——Windows 二进制——于是 Linux 和 macOS 上直接以 | ||
| // `Syntax error: ")" unexpected` 退出 2。Install dimina/fe deps 和随后的 | ||
| // build:container 都断在这里。 | ||
| // | ||
| // pnpm 12 已经没有能关掉版本自管的配置项了:--config.manage-package-manager-versions、 | ||
| // npm_config_* 环境变量、--pm-on-fail 都不阻止切换,唯一的开关得写进那个 workspace | ||
| // 自己的 pnpm-workspace.yaml,而那是 submodule 的文件。所以这里在 runner 的工作副本 | ||
| // 上摘掉这个字段,让 submodule 用 runner 上已经装好的 pnpm。改动不提交,也不进 | ||
| // submodule。 | ||
| // | ||
| // 两边版本一致(或 submodule 自己去掉了这个字段)时什么都不做,可以重复跑。 | ||
|
|
||
| import { readFileSync, writeFileSync } from 'node:fs' | ||
|
|
||
| const FE_MANIFEST = 'dimina/fe/package.json' | ||
|
|
||
| const source = readFileSync(FE_MANIFEST, 'utf8') | ||
| const declared = JSON.parse(source).packageManager | ||
|
|
||
| if (!declared) { | ||
| console.log(`${FE_MANIFEST} 没有声明 packageManager,无需处理`) | ||
| process.exit(0) | ||
| } | ||
|
|
||
| const rootDeclared = JSON.parse(readFileSync('package.json', 'utf8')).packageManager | ||
|
|
||
| if (declared === rootDeclared) { | ||
| console.log(`dimina/fe 与本仓根都是 ${declared},不会触发版本切换,无需处理`) | ||
| process.exit(0) | ||
| } | ||
|
|
||
| // 只删这一行,其余原样保留:这份 manifest 属于 submodule,不做格式化重写。 | ||
| const stripped = source.replace(/^[ \t]*"packageManager":[ \t]*"[^"]*",?\r?\n/m, '') | ||
|
|
||
| if (stripped === source) { | ||
| throw new Error(`在 ${FE_MANIFEST} 里没找到可删除的 packageManager 行`) | ||
| } | ||
|
|
||
| JSON.parse(stripped) | ||
| writeFileSync(FE_MANIFEST, stripped) | ||
|
|
||
| console.log( | ||
| `已在 runner 的工作副本上移除 dimina/fe 的 packageManager(${declared}),` | ||
| + `改用本仓根的 ${rootDeclared}`, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This repairs a confirmed all-platform release failure with new JSON-rewrite logic, but adds no regression test, while the normal CI path does not execute these release-only steps. A fixture-based test should exercise the mismatched, matching, and missing
packageManagercases—and verify the rewritten file remains valid JSON—so formatting or workflow changes cannot silently reintroduce the failure.AGENTS.md reference: AGENTS.md:L20-L21
Useful? React with 👍 / 👎.