Repository navigation
fix(ci): e2e 不再依赖 rolldown 的 .bin,改用 node 类型擦除直接 import .ts - #18
Merged
Merged
Conversation
CI(ubuntu)上 `pnpm verify` 挂了,而且是唯一一处失败:
✘ 客户端映射模块打包失败 spawnSync .../node_modules/.bin/rolldown ENOENT
✘ 失败 1 项 (46 项检查)
其余全过 —— 真实 VSIX 下载(607ms)、JSONC 边界、冷缓存下载、搜索 + TTL 缓存 +
批量详情在 runner 上都正常。
原因:e2e 为了拿到客户端映射器(vs-import.ts),现场调
`node_modules/.bin/rolldown` 打包一次。而 rolldown 只是 tsdown 的**传递依赖**,
pnpm 不保证在每个平台都生成它的 .bin 入口 —— macOS 上有,ubuntu 上没有
(lockfile 里 14 个平台的 binding 都记着,所以不是缺平台包、也不是安装失败,
而是 hoist/链接行为差异)。依赖「传递依赖的 bin」本身就是错的用法。
改法:用 node 自带的类型擦除(Node 22.18+/24 默认开启)+ 新增
`scripts/ts-import-hook.mjs`(ESM resolve 钩子:找不到 `x.js` 就退回 `x.ts`,
只对相对/绝对路径生效,不猜包名),直接
`import('../client/src/vs-import.ts')`。零依赖、零打包器,跨平台一致。
本地 pnpm verify:52 项全绿(此前 46 项,少的 6 项正是客户端映射相关断言)。
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.
问题
v0.2.0推上去后,Release 与 CI 都红了,都挂在同一步pnpm verify,而且是唯一一处失败:其余全部通过 —— 真实 VSIX 下载(607ms)、JSONC 边界用例、冷缓存下载、搜索 + TTL 缓存、
批量详情在 ubuntu runner 上都正常。少的 6 项正是客户端映射相关断言。
根因
e2e 为了拿到客户端映射器(
client/src/vs-import.ts,纯逻辑),现场调node_modules/.bin/rolldown打包一次再 import。但rolldown只是tsdown的传递依赖,pnpm 不保证在每个平台都生成它的
.bin入口:.bin/rolldown)ENOENTlockfile 里
@rolldown/binding-*14 个平台都在(含linux-x64-gnu),所以不是缺平台包、也不是安装失败,而是 pnpm 的 hoist / link 行为在不同平台上不一致。依赖「传递依赖的 bin」
本身就是错的用法 —— 踩到只是时间问题。
改法
用 node 自带的类型擦除(Node 22.18+/24 默认开启)+ 新增
scripts/ts-import-hook.mjs(ESM
resolve钩子:找不到x.js就退回x.ts;只对相对/绝对路径生效,不猜包名),直接
import('../client/src/vs-import.ts')。execFileSync的耦合从测试里去掉验证
pnpm verify:52 项全绿(修复前 46 项)ci.yml,请以 PR 上这次 CI 的结果为准 —— 这正是它存在的意义合并后
v0.2.0这个 tag 会移到合并后的新提交上(它几分钟前才创建、Release 也还没建成、0.2.0没发出去,所以移动是安全的),然后重新触发 Release 工作流完成发布。