Skip to content

fix(deps): 移除 node-fetch 并升级 ink 系列,消除安装时 deprecated 告警 - #6

Merged
kugouming merged 1 commit into
mainfrom
fix/remove-deprecated-deps
Sep 2, 2026
Merged

fix(deps): 移除 node-fetch 并升级 ink 系列,消除安装时 deprecated 告警#6
kugouming merged 1 commit into
mainfrom
fix/remove-deprecated-deps

Conversation

@kugouming

Copy link
Copy Markdown
Contributor

背景

npm i -g onemcp 安装时会输出两个 deprecated 依赖告警:

npm warn deprecated lodash.isequal@4.5.0: This package is deprecated. Use require('node:util').isDeepStrictEqual instead.
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead

根因

deprecated 包 传递来源 说明
node-domexception node-fetch@3.3.2fetch-blob onemcp 直接依赖的 node-fetch 在 Node 18+ 已无必要
lodash.isequal ink-select-input@5.0.0 ink-select-input v5 使用了已弃用的 lodash.isequal

修复

  1. 移除 node-fetch:Node 18+ 已提供全局 fetchsrc/transport/http.ts 直接使用原生 fetch;对应单测改用 vi.stubGlobal('fetch', ...) 模拟。
  2. 升级 ink 系列ink 4→5、ink-select-input 5→6、ink-text-input 5→6。ink-select-input v6 已用 to-rotated 取代 lodash.isequal,彻底消除该告警。同时适配 ink 5 的 API(Text 组件 wrap prop)。

验证

  • npm ls lodash.isequal node-domexception node-fetch → 均为 empty
  • 打包产物在全新目录安装 → 无任何 deprecated 告警(复现 npm 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 处理。

`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 个测试全部通过
@kugouming
kugouming merged commit caddfb6 into main Sep 2, 2026
7 checks passed
@kugouming
kugouming deleted the fix/remove-deprecated-deps branch September 3, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant