前端项目经常需要更新依赖版本满足日常维护、升级测试、bug 修复的需要,依赖多的时候一个一个去升级检查很麻烦,最近看到一个工具 ncu (npm-check-updates)挺不错。
安装 & 检查:
npm i -g npm-check-updates
ncu
输出结果类似:
❯ ncu
Using yarn
Checking /Users/haodongzheng/WebstormProjects/hackertalk-next/package.json
[====================] 82/82 100%
@commitlint/cli ^17.5.1 → ^17.6.1
@commitlint/config-conventional ^17.4.4 → ^17.6.1
@floating-ui/react ^0.20.1 → ^0.23.1
@headlessui/react ^1.7.13 → ^1.7.14
@hookform/resolvers ^2.9.11 → ^3.1.0
@sentry/nextjs ^7.48.0 → ^7.50.0
@tanstack/react-query ^4.29.3 → ^4.29.5
@types/lodash-es ^4.17.6 → ^4.17.7
@types/node 18.15.11 → 18.16.3
@types/react 18.0.33 → 18.2.0
@types/react-dom 18.0.11 → 18.2.1
@typescript-eslint/eslint-plugin ^5.54.1 → ^5.59.1
@typescript-eslint/parser ^5.54.1 → ^5.59.1
axios ^1.3.5 → ^1.4.0
批量更新:
ncu -u