fix(deps): 移除 node-fetch 并升级 ink 系列,消除安装时 deprecated 告警 - #6
Merged
Conversation
`npm i -g onemcp` 会告警两个已弃用的传递依赖:
- node-domexception(来自 node-fetch → fetch-blob)
- lodash.isequal(来自 ink-select-input@5)
修复:
- 移除 node-fetch,改用一个 Node >= 18 自带的全局 fetch;对应测试
改用 vi.stubGlobal('fetch', ...) 模拟原生 fetch
- ink 4→5、ink-select-input 5→6、ink-text-input 5→6(6.x 已弃用
lodash.isequal,改用 to-rotated),同时适配 ink 5 的 API
验证:
- npm ls lodash.isequal/node-domexception/node-fetch 均为 empty
- 打包产物在全新目录安装无任何 deprecated 告警
- typecheck / lint / format 通过,951 个测试全部通过
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.
背景
npm i -g onemcp安装时会输出两个 deprecated 依赖告警:根因
node-domexceptionnode-fetch@3.3.2→fetch-bloblodash.isequalink-select-input@5.0.0修复
node-fetch:Node 18+ 已提供全局fetch,src/transport/http.ts直接使用原生 fetch;对应单测改用vi.stubGlobal('fetch', ...)模拟。ink4→5、ink-select-input5→6、ink-text-input5→6。ink-select-input v6 已用to-rotated取代lodash.isequal,彻底消除该告警。同时适配 ink 5 的 API(Text组件wrapprop)。验证
npm ls lodash.isequal node-domexception node-fetch→ 均为 emptynpm i -g onemcp场景)npm run typecheck/lint/format:check通过npm test:951 个测试全部通过(含真实 ink 5 渲染的 TUI 集成测试)dist/cli.js --mode tui实际渲染正常备注
npm audit显示的 28 个漏洞(postcss/qs/ws 等)为历史存量问题,本次不涉及,如需可另开 PR 处理。