dependency-audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDependency Audit Skill
依赖项审计技能
Summary
概述
Systematic workflow for auditing, updating, and cleaning up project dependencies. Covers security vulnerability scanning, outdated package detection, unused dependency removal, and migration from deprecated libraries.
这是一套用于审计、更新和清理项目依赖项的系统化工作流,涵盖安全漏洞扫描、过时包检测、未使用依赖项移除以及从已废弃库迁移的内容。
When to Use
适用场景
- Weekly/monthly dependency maintenance
- After security advisories (CVE announcements)
- Before major releases
- When bundle size increases unexpectedly
- During code reviews for dependency changes
- Onboarding to legacy projects
- 每周/每月的依赖项维护
- 收到安全公告(CVE通知)后
- 重大版本发布前
- 包体积意外增大时
- 依赖项变更的代码审查期间
- 接手遗留项目时
Quick Audit Process
快速审计流程
1. Check Outdated Packages
1. 检查过时包
bash
undefinedbash
undefinednpm
npm
npm outdated
npm outdated
pnpm
pnpm
pnpm outdated
pnpm outdated
yarn
yarn
yarn outdated
yarn outdated
pip (Python)
pip (Python)
pip list --outdated
pip list --outdated
poetry (Python)
poetry (Python)
poetry show --outdated
undefinedpoetry show --outdated
undefined2. Security Vulnerability Scan
2. 安全漏洞扫描
bash
undefinedbash
undefinednpm
npm
npm audit
npm audit fix # Auto-fix where possible
npm audit fix --force # Force major version updates (risky)
npm audit
npm audit fix # Auto-fix where possible
npm audit fix --force # Force major version updates (risky)
pnpm
pnpm
pnpm audit
pnpm audit --fix
pnpm audit
pnpm audit --fix
yarn
yarn
yarn audit
yarn audit --fix
yarn audit
yarn audit --fix
Python
Python
pip-audit # Requires: pip install pip-audit
safety check # Requires: pip install safety
undefinedpip-audit # Requires: pip install pip-audit
safety check # Requires: pip install safety
undefined3. Find Unused Dependencies
3. 查找未使用的依赖项
bash
undefinedbash
undefinedJavaScript/TypeScript
JavaScript/TypeScript
npx depcheck
npx depcheck
Output example:
Output example:
Unused dependencies
Unused dependencies
* lodash
* lodash
* moment
* moment
Unused devDependencies
Unused devDependencies
* @types/old-package
* @types/old-package
Python
Python
pip-autoremove --list # Requires: pip install pip-autoremove
---pip-autoremove --list # Requires: pip install pip-autoremove
---Audit Commands
审计命令
JavaScript/TypeScript/Node.js
JavaScript/TypeScript/Node.js
npm
npm
bash
undefinedbash
undefinedCheck what's outdated
Check what's outdated
npm outdated
npm outdated
Update within semver range (safe)
Update within semver range (safe)
npm update
npm update
Update specific package to latest
Update specific package to latest
npm install package@latest
npm install package@latest
Check security vulnerabilities
Check security vulnerabilities
npm audit
npm audit
Auto-fix vulnerabilities
Auto-fix vulnerabilities
npm audit fix
npm audit fix
View dependency tree
View dependency tree
npm list
npm list --depth=0 # Top-level only
npm list
npm list --depth=0 # Top-level only
Why is this package installed?
Why is this package installed?
npm ls package-name
npm ls package-name
Check for duplicate packages
Check for duplicate packages
npm dedupe
undefinednpm dedupe
undefinedpnpm
pnpm
bash
undefinedbash
undefinedCheck outdated
Check outdated
pnpm outdated
pnpm outdated
Update all dependencies
Update all dependencies
pnpm update
pnpm update
Update specific package
Update specific package
pnpm update package@latest
pnpm update package@latest
Security audit
Security audit
pnpm audit
pnpm audit
Deduplicate
Deduplicate
pnpm dedupe
pnpm dedupe
List all packages
List all packages
pnpm list
undefinedpnpm list
undefinedyarn
yarn
bash
undefinedbash
undefinedCheck outdated
Check outdated
yarn outdated
yarn outdated
Upgrade interactive (recommended)
Upgrade interactive (recommended)
yarn upgrade-interactive
yarn upgrade-interactive
Update all
Update all
yarn upgrade
yarn upgrade
Security audit
Security audit
yarn audit
yarn audit
Why is this here?
Why is this here?
yarn why package-name
undefinedyarn why package-name
undefinedPython
Python
pip
pip
bash
undefinedbash
undefinedList outdated
List outdated
pip list --outdated
pip list --outdated
Update specific package
Update specific package
pip install --upgrade package-name
pip install --upgrade package-name
Security audit
Security audit
pip-audit # Install: pip install pip-audit
pip-audit # Install: pip install pip-audit
Freeze current dependencies
Freeze current dependencies
pip freeze > requirements.txt
pip freeze > requirements.txt
Check dependencies of a package
Check dependencies of a package
pip show package-name
undefinedpip show package-name
undefinedpoetry
poetry
bash
undefinedbash
undefinedShow outdated
Show outdated
poetry show --outdated
poetry show --outdated
Update all
Update all
poetry update
poetry update
Update specific package
Update specific package
poetry update package-name
poetry update package-name
Security check
Security check
poetry audit # poetry-audit-plugin required
poetry audit # poetry-audit-plugin required
Show dependency tree
Show dependency tree
poetry show --tree
undefinedpoetry show --tree
undefinedpipenv
pipenv
bash
undefinedbash
undefinedCheck for security vulnerabilities
Check for security vulnerabilities
pipenv check
pipenv check
Update all
Update all
pipenv update
pipenv update
Update specific
Update specific
pipenv update package-name
pipenv update package-name
Show dependency graph
Show dependency graph
pipenv graph
---pipenv graph
---Priority Matrix
优先级矩阵
| Priority | Type | Action | Timeline | Example |
|---|---|---|---|---|
| P0 | Critical CVE (actively exploited) | Patch immediately | Same day | Auth bypass, RCE |
| P1 | High CVE or major framework update | Plan migration | 1-2 weeks | Next.js, React major version |
| P2 | Deprecated with active usage | Find replacement | 2-4 weeks | moment.js → date-fns |
| P3 | Minor/patch updates | Batch update | Monthly | Non-breaking updates |
| P4 | Unused dependencies | Remove | Next cleanup PR | Dead imports |
| 优先级 | 类型 | 操作 | 时间线 | 示例 |
|---|---|---|---|---|
| P0 | 严重CVE(已被主动利用) | 立即修复 | 当日 | Auth bypass, RCE |
| P1 | 高风险CVE或核心框架更新 | 规划迁移 | 1-2周 | Next.js, React 大版本 |
| P2 | 已废弃且仍在使用的包 | 寻找替代方案 | 2-4周 | moment.js → date-fns |
| P3 | 小版本/补丁更新 | 批量更新 | 每月 | 非破坏性更新 |
| P4 | 未使用的依赖项 | 移除 | 下次清理PR | 无效导入 |
Priority Decision Tree
优先级决策树
Is there a CVE?
├─ Yes → Is it critical/high severity?
│ ├─ Yes → P0 (patch immediately)
│ └─ No → P1 (plan update)
└─ No → Is package deprecated?
├─ Yes → Is it actively used?
│ ├─ Yes → P2 (find replacement)
│ └─ No → P4 (remove)
└─ No → Is it outdated?
├─ Major version → P1 (plan migration)
├─ Minor/patch → P3 (batch update)
└─ Unused → P4 (remove)是否存在CVE漏洞?
├─ 是 → 漏洞是否为严重/高风险级别?
│ ├─ 是 → P0(立即修复)
│ └─ 否 → P1(规划更新)
└─ 否 → 包是否已被废弃?
├─ 是 → 是否仍在使用?
│ ├─ 是 → P2(寻找替代方案)
│ └─ 否 → P4(移除)
└─ 否 → 包是否已过时?
├─ 大版本更新 → P1(规划迁移)
├─ 小版本/补丁 → P3(批量更新)
└─ 未使用 → P4(移除)Common Replacements
常见替代方案
Date/Time Libraries
日期/时间库
JavaScript/TypeScript
JavaScript/TypeScript
javascript
// ❌ moment.js (deprecated, 288KB minified)
import moment from 'moment';
const formatted = moment().format('YYYY-MM-DD');
const diff = moment(date1).diff(moment(date2), 'days');
// ✅ date-fns (tree-shakeable, 2-5KB per function)
import { format, differenceInDays } from 'date-fns';
const formatted = format(new Date(), 'yyyy-MM-dd');
const diff = differenceInDays(date1, date2);
// ✅ Native Intl (zero bundle cost)
const formatted = new Intl.DateTimeFormat('en-US').format(new Date());
const relative = new Intl.RelativeTimeFormat('en').format(-1, 'day'); // "1 day ago"javascript
// ❌ moment.js (deprecated, 288KB minified)
import moment from 'moment';
const formatted = moment().format('YYYY-MM-DD');
const diff = moment(date1).diff(moment(date2), 'days');
// ✅ date-fns (tree-shakeable, 2-5KB per function)
import { format, differenceInDays } from 'date-fns';
const formatted = format(new Date(), 'yyyy-MM-dd');
const diff = differenceInDays(date1, date2);
// ✅ Native Intl (zero bundle cost)
const formatted = new Intl.DateTimeFormat('en-US').format(new Date());
const relative = new Intl.RelativeTimeFormat('en').format(-1, 'day'); // "1 day ago"Python
Python
python
undefinedpython
undefined❌ arrow (overhead for simple tasks)
❌ arrow (overhead for simple tasks)
import arrow
now = arrow.now().format('YYYY-MM-DD')
import arrow
now = arrow.now().format('YYYY-MM-DD')
✅ Native datetime
✅ Native datetime
from datetime import datetime
now = datetime.now().strftime('%Y-%m-%d')
from datetime import datetime
now = datetime.now().strftime('%Y-%m-%d')
✅ pendulum (for complex timezone handling)
✅ pendulum (for complex timezone handling)
import pendulum
now = pendulum.now('America/New_York')
undefinedimport pendulum
now = pendulum.now('America/New_York')
undefinedUtility Libraries
工具库
JavaScript/TypeScript
JavaScript/TypeScript
javascript
// ❌ Full lodash import (70KB)
import _ from 'lodash';
const value = _.get(obj, 'path.to.value');
const unique = _.uniq(array);
// ✅ Specific imports (5-10KB)
import get from 'lodash/get';
import uniq from 'lodash/uniq';
// ✅ Native alternatives (0KB)
const value = obj?.path?.to?.value; // Optional chaining
const unique = [...new Set(array)]; // Set
const keys = Object.keys(obj); // Object.keys
const flat = array.flat(); // Array.flat()
const grouped = Object.groupBy(arr, fn); // Object.groupByjavascript
// ❌ Full lodash import (70KB)
import _ from 'lodash';
const value = _.get(obj, 'path.to.value');
const unique = _.uniq(array);
// ✅ Specific imports (5-10KB)
import get from 'lodash/get';
import uniq from 'lodash/uniq';
// ✅ Native alternatives (0KB)
const value = obj?.path?.to?.value; // Optional chaining
const unique = [...new Set(array)]; // Set
const keys = Object.keys(obj); // Object.keys
const flat = array.flat(); // Array.flat()
const grouped = Object.groupBy(arr, fn); // Object.groupByHTTP Clients
HTTP客户端
JavaScript/TypeScript
JavaScript/TypeScript
javascript
// ❌ axios (11KB) - often unnecessary
import axios from 'axios';
const { data } = await axios.get('/api/users');
// ✅ Native fetch (0KB) - built-in
const response = await fetch('/api/users');
const data = await response.json();
// ✅ ky (2KB) - if you need retries/timeout
import ky from 'ky';
const data = await ky.get('/api/users').json();javascript
// ❌ axios (11KB) - often unnecessary
import axios from 'axios';
const { data } = await axios.get('/api/users');
// ✅ Native fetch (0KB) - built-in
const response = await fetch('/api/users');
const data = await response.json();
// ✅ ky (2KB) - if you need retries/timeout
import ky from 'ky';
const data = await ky.get('/api/users').json();Python
Python
python
undefinedpython
undefined❌ requests (large for serverless)
❌ requests (large for serverless)
import requests
response = requests.get('https://api.example.com')
import requests
response = requests.get('https://api.example.com')
✅ httpx (async support, same API)
✅ httpx (async support, same API)
import httpx
async with httpx.AsyncClient() as client:
response = await client.get('https://api.example.com')
import httpx
async with httpx.AsyncClient() as client:
response = await client.get('https://api.example.com')
✅ urllib (native, for simple cases)
✅ urllib (native, for simple cases)
from urllib.request import urlopen
response = urlopen('https://api.example.com')
undefinedfrom urllib.request import urlopen
response = urlopen('https://api.example.com')
undefinedTesting Libraries
测试库
JavaScript/TypeScript
JavaScript/TypeScript
javascript
// Consider consolidating test runners
// If using Jest + Vitest + Playwright separately:
// ✅ Vitest can replace Jest in most projects (faster, native ESM)
// ✅ Keep Playwright for E2E, use Vitest for unit/integrationjavascript
// Consider consolidating test runners
// If using Jest + Vitest + Playwright separately:
// ✅ Vitest can replace Jest in most projects (faster, native ESM)
// ✅ Keep Playwright for E2E, use Vitest for unit/integrationValidation Libraries
验证库
JavaScript/TypeScript
JavaScript/TypeScript
javascript
// ❌ Multiple validation libraries
import * as yup from 'yup';
import Joi from 'joi';
import { z } from 'zod';
// ✅ Pick one (Zod recommended for TypeScript)
import { z } from 'zod';
const schema = z.object({
email: z.string().email(),
age: z.number().min(0)
});javascript
// ❌ Multiple validation libraries
import * as yup from 'yup';
import Joi from 'joi';
import { z } from 'zod';
// ✅ Pick one (Zod recommended for TypeScript)
import { z } from 'zod';
const schema = z.object({
email: z.string().email(),
age: z.number().min(0)
});Update Strategy
更新策略
Batch Related Updates
批量更新相关包
bash
undefinedbash
undefinedUpdate all ESLint-related packages together
Update all ESLint-related packages together
pnpm update eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
pnpm update eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
Update all testing packages together
Update all testing packages together
pnpm update vitest @vitest/ui @vitest/coverage-v8
pnpm update vitest @vitest/ui @vitest/coverage-v8
Update all Next.js packages together
Update all Next.js packages together
pnpm update next react react-dom @types/react @types/react-dom
undefinedpnpm update next react react-dom @types/react @types/react-dom
undefinedTest After Updates
更新后测试
Comprehensive Testing Checklist
全面测试检查清单
bash
undefinedbash
undefined1. Type check
1. Type check
pnpm tsc --noEmit
pnpm tsc --noEmit
2. Lint
2. Lint
pnpm lint
pnpm lint
3. Unit tests
3. Unit tests
pnpm test
pnpm test
4. Build verification
4. Build verification
pnpm build
pnpm build
5. Dev server (smoke test)
5. Dev server (smoke test)
pnpm dev
pnpm dev
Open browser, test key features
Open browser, test key features
6. E2E tests (if available)
6. E2E tests (if available)
pnpm test:e2e
undefinedpnpm test:e2e
undefinedIncremental Update Strategy
增量更新策略
For Major Version Updates
大版本更新步骤
bash
undefinedbash
undefined1. Create branch
1. Create branch
git checkout -b chore/update-nextjs-15
git checkout -b chore/update-nextjs-15
2. Update package.json
2. Update package.json
Change "next": "^14.0.0" → "^15.0.0"
Change "next": "^14.0.0" → "^15.0.0"
3. Install
3. Install
pnpm install
pnpm install
4. Read migration guide
4. Read migration guide
Visit: nextjs.org/docs/upgrading
Visit: nextjs.org/docs/upgrading
5. Address breaking changes
5. Address breaking changes
Follow migration guide step-by-step
Follow migration guide step-by-step
6. Test thoroughly
6. Test thoroughly
pnpm test && pnpm build
pnpm test && pnpm build
7. Commit and PR
7. Commit and PR
git add .
git commit -m "chore: upgrade Next.js to v15"
---git add .
git commit -m "chore: upgrade Next.js to v15"
---Cleanup Workflow
清理工作流
Step 1: Identify Unused Dependencies
步骤1:识别未使用的依赖项
bash
npx depcheckExample Output:
Unused dependencies
* lodash
* moment
* old-library
Unused devDependencies
* @types/old-package
* unused-test-libbash
npx depcheck示例输出:
Unused dependencies
* lodash
* moment
* old-library
Unused devDependencies
* @types/old-package
* unused-test-libStep 2: Verify Not Used
步骤2:确认未被使用
bash
undefinedbash
undefinedSearch codebase for imports
Search codebase for imports
rg "from 'lodash'" --type ts
rg "import.*lodash" --type ts
rg "require('lodash')" --type js
rg "from 'lodash'" --type ts
rg "import.*lodash" --type ts
rg "require('lodash')" --type js
If no results → safe to remove
If no results → safe to remove
undefinedundefinedStep 3: Remove Package
步骤3:移除包
bash
pnpm remove lodashbash
pnpm remove lodashStep 4: Update Lock File
步骤4:更新锁文件
bash
undefinedbash
undefinednpm
npm
rm package-lock.json
npm install
rm package-lock.json
npm install
pnpm
pnpm
rm pnpm-lock.yaml
pnpm install
rm pnpm-lock.yaml
pnpm install
yarn
yarn
rm yarn.lock
yarn install
undefinedrm yarn.lock
yarn install
undefinedStep 5: Test
步骤5:测试
bash
pnpm test
pnpm buildbash
pnpm test
pnpm buildCleanup PR Template
清理PR模板
markdown
undefinedmarkdown
undefinedDependency Cleanup
Dependency Cleanup
Security Updates (P0/P1)
Security Updates (P0/P1)
- : 14.0.4 → 14.2.3 (CVE-2024-XXXX)
next - : 4.15.4 → 4.15.5 (CVE-2024-YYYY)
jose
- : 14.0.4 → 14.2.3 (CVE-2024-XXXX)
next - : 4.15.4 → 4.15.5 (CVE-2024-YYYY)
jose
Removed (Unused)
Removed (Unused)
- - replaced with native JS methods
lodash - - replaced with date-fns
moment - - package no longer used
@types/old-package
- - replaced with native JS methods
lodash - - replaced with date-fns
moment - - package no longer used
@types/old-package
Updated (Maintenance)
Updated (Maintenance)
- : 8.57.0 → 9.0.0
eslint - : 5.3.3 → 5.4.2
typescript
- : 8.57.0 → 9.0.0
eslint - : 5.3.3 → 5.4.2
typescript
Migration Notes
Migration Notes
lodash → Native:
- → optional chaining
_.get()obj?.prop?.value - →
_.uniq()[...new Set(array)]
moment → date-fns:
- →
moment().format('YYYY-MM-DD')format(new Date(), 'yyyy-MM-dd')
lodash → Native:
- → optional chaining
_.get()obj?.prop?.value - →
_.uniq()[...new Set(array)]
moment → date-fns:
- →
moment().format('YYYY-MM-DD')format(new Date(), 'yyyy-MM-dd')
Testing
Testing
- All tests pass ()
pnpm test - Build succeeds ()
pnpm build - No runtime errors in dev ()
pnpm dev - E2E tests pass (if applicable)
- All tests pass ()
pnpm test - Build succeeds ()
pnpm build - No runtime errors in dev ()
pnpm dev - E2E tests pass (if applicable)
Bundle Size Impact
Bundle Size Impact
- Before: 2.4 MB
- After: 1.8 MB
- Savings: 600 KB (25% reduction)
---- Before: 2.4 MB
- After: 1.8 MB
- Savings: 600 KB (25% reduction)
---Security Scanning
安全扫描
Automated Security Checks
自动化安全检查
GitHub Actions
GitHub Actions
yaml
undefinedyaml
undefined.github/workflows/security.yml
.github/workflows/security.yml
name: Security Audit
on:
schedule:
- cron: '0 0 * * 1' # Weekly on Monday
pull_request:
push:
branches: [main]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run security audit
run: npm audit --audit-level=high
- name: Check for outdated packages
run: npm outdated || true
- name: Dependency review
uses: actions/dependency-review-action@v4
if: github.event_name == 'pull_request'undefinedname: Security Audit
on:
schedule:
- cron: '0 0 * * 1' # Weekly on Monday
pull_request:
push:
branches: [main]
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run security audit
run: npm audit --audit-level=high
- name: Check for outdated packages
run: npm outdated || true
- name: Dependency review
uses: actions/dependency-review-action@v4
if: github.event_name == 'pull_request'undefinedSnyk Integration
Snyk Integration
yaml
undefinedyaml
undefined.github/workflows/snyk.yml
.github/workflows/snyk.yml
name: Snyk Security
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}undefinedname: Snyk Security
on: [push, pull_request]
jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}undefinedManual Security Commands
手动安全命令
bash
undefinedbash
undefinednpm security audit
npm security audit
npm audit
npm audit
Show only high/critical
Show only high/critical
npm audit --audit-level=high
npm audit --audit-level=high
Get JSON report
Get JSON report
npm audit --json > audit-report.json
npm audit --json > audit-report.json
Snyk (requires: npm install -g snyk)
Snyk (requires: npm install -g snyk)
snyk test # Test for vulnerabilities
snyk monitor # Continuous monitoring
snyk wizard # Interactive fixing
snyk test # Test for vulnerabilities
snyk monitor # Continuous monitoring
snyk wizard # Interactive fixing
Socket.dev (supply chain security)
Socket.dev (supply chain security)
npx socket-npm audit
undefinednpx socket-npm audit
undefinedCVE Response Process
CVE响应流程
-
Notification: Receive security advisory (GitHub, npm, Snyk)
-
Assess Impact:bash
# Find where vulnerable package is used npm ls vulnerable-package # Check if we use vulnerable functionality rg "vulnerableFunction" --type ts -
Patch:bash
# Update to patched version npm install vulnerable-package@4.15.5 # Or update dependency that depends on it npm update parent-package -
Verify Fix:bash
npm audit # Should show 0 vulnerabilities -
Test & Deploy:bash
pnpm test && pnpm build git commit -m "fix: patch CVE-2024-XXXX in vulnerable-package"
-
通知:收到安全公告(GitHub、npm、Snyk)
-
评估影响:bash
# Find where vulnerable package is used npm ls vulnerable-package # Check if we use vulnerable functionality rg "vulnerableFunction" --type ts -
修复:bash
# Update to patched version npm install vulnerable-package@4.15.5 # Or update dependency that depends on it npm update parent-package -
验证修复:bash
npm audit # Should show 0 vulnerabilities -
测试与部署:bash
pnpm test && pnpm build git commit -m "fix: patch CVE-2024-XXXX in vulnerable-package"
Summary
总结
Monthly Maintenance Checklist
月度维护检查清单
markdown
undefinedmarkdown
undefinedDependency Maintenance - [YYYY-MM]
Dependency Maintenance - [YYYY-MM]
Security
Security
- Run and address high/critical issues
npm audit - Review GitHub security advisories
- Check Snyk dashboard (if integrated)
- Run and address high/critical issues
npm audit - Review GitHub security advisories
- Check Snyk dashboard (if integrated)
Updates
Updates
- Check for major updates
npm outdated - Update patch versions:
npm update - Plan migration for deprecated packages
- Check for major updates
npm outdated - Update patch versions:
npm update - Plan migration for deprecated packages
Cleanup
Cleanup
- Run to find unused deps
npx depcheck - Remove packages with zero imports
- Deduplicate:
npm dedupe
- Run to find unused deps
npx depcheck - Remove packages with zero imports
- Deduplicate:
npm dedupe
Testing
Testing
- Run full test suite
- Check build succeeds
- Verify dev server works
- Test in production-like environment
- Run full test suite
- Check build succeeds
- Verify dev server works
- Test in production-like environment
Documentation
Documentation
- Update CHANGELOG.md
- Document breaking changes
- Update .env.example if needed
undefined- Update CHANGELOG.md
- Document breaking changes
- Update .env.example if needed
undefinedBest Practices
最佳实践
- Automate: Set up GitHub Actions for weekly audits
- Batch Updates: Group related dependency updates
- Test Thoroughly: Never skip tests after updates
- Document: Keep CHANGELOG.md updated
- Measure Impact: Track bundle size changes
- Stay Informed: Subscribe to security advisories
- Use Lock Files: Commit package-lock.json/pnpm-lock.yaml
- Gradual Migration: Don't update everything at once
- 自动化:配置GitHub Actions进行每周审计
- 批量更新:将相关依赖项更新分组
- 全面测试:更新后绝不跳过测试
- 文档记录:保持CHANGELOG.md更新
- 衡量影响:跟踪包体积变化
- 及时了解:订阅安全公告
- 使用锁文件:提交package-lock.json/pnpm-lock.yaml
- 逐步迁移:不要一次性更新所有内容