fix(installer): 修复 PowerShell 远程入口 BOM 解析与 pnpm 版本校验 - #47
Open
Cora093 wants to merge 1 commit into
Open
Conversation
Cora093
marked this pull request as ready for review
August 14, 2026 10:21
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
问题
Windows PowerShell 安装入口存在两类问题:
scripts/install.ps1为兼容 Windows PowerShell 5.1 的-File模式带有 UTF-8 BOM,但 README 和脚本注释中的远程执行命令直接把下载结果交给iex或ScriptBlock.Create。BOM 会被解析成#命令,并导致param(...)不再位于脚本起点,出现命令报错或-Version、-DryRun等参数失效。ERR_PNPM_ADDING_TO_ROOT,且脚本已经开始处理 profile 配置。修复
irm下载脚本文本;.TrimStart([char]0xFEFF)移除 BOM;ScriptBlock.Create执行。-File入口。pnpm --version:验证
pnpm vitest run tests/install-powershell.spec.ts:7/7 通过-File执行pnpm typecheck:通过git diff --check:通过dsh-better-sidebar@0.11.0-DryRun正常执行关联
Related to #44