pnpm
pnpm 是一个快速、磁盘空间高效的包管理器。它使用内容可寻址存储来消除机器上所有项目中的包重复,节省大量磁盘空间。pnpm 默认强制执行严格的依赖解析,防止幻影依赖。配置最好放在 pnpm-workspace.yaml 中以进行 pnpm 特定设置。
重要: 使用 pnpm 项目时,代理应检查 pnpm-workspace.yaml 和 .npmrc 文件以了解工作区结构和配置。在 CI 环境中始终使用 --frozen-lockfile。
该技能基于 pnpm 10.x,生成于 2026-01-28。
核心
| 主题 | 描述 | 参考 |
|---|---|---|
| CLI 命令 | 安装、添加、删除、更新、运行、exec、dlx 和工作区命令 | core-cli |
| 配置 | pnpm-workspace.yaml、.npmrc 设置和 package.json 字段 | core-config |
| 工作区 | 带有过滤、工作区协议和共享锁文件的 Monorepo 支持 | core-workspaces |
| 存储 | 内容可寻址存储、硬链接和磁盘效率 | core-store |
特性
| 主题 | 描述 | 参考 |
|---|---|---|
| 目录 | 工作区的集中依赖版本管理 | features-catalogs |
| 覆盖 | 强制特定版本的依赖项,包括传递依赖项 | features-overrides |
| 补丁 | 使用自定义修复修改第三方包 | features-patches |
| 别名 | 使用 npm: 协议安装具有自定义名称的包 | features-aliases |
| 钩子 | 使用 .pnpmfile.cjs 钩子自定义解析 | features-hooks |
| 同级依赖 | 自动安装、严格模式和依赖规则 | features-peer-deps |
最佳实践
| 主题 | 描述 | 参考 |
|---|---|---|
| CI/CD 设置 | GitHub Actions、GitLab CI、Docker 和缓存策略 | best-practices-ci |
| 迁移 | 从 npm/Yarn 迁移、处理幻影依赖、Monorepo 迁移 | best-practices-migration |
| 性能 | 安装优化、存储缓存、工作区并行化 | best-practices-performance |
More from tnnevol/skills
memos
Assistant for Memos (https://github.com/usememos/memos), an open-source self-hosted memo/note tool. Use when the user asks about Memos, creating/listing/updating/deleting memos, managing tags, or securely interacting with a Memos instance via API.
13vue
Vue 3 组合式 API、script setup 宏、响应式系统和内置组件。在编写 Vue SFC、defineProps/defineEmits/defineModel、监视器或使用 Transition/Teleport/Suspense/KeepAlive 时使用。
6vitepress
VitePress static site generator powered by Vite and Vue. Use when building documentation sites, configuring themes, or writing Markdown with Vue components.
6tsdown
Bundle TypeScript and JavaScript libraries with blazing-fast speed powered by Rolldown. Use when building libraries, generating type declarations, bundling for multiple formats, or migrating from tsup.
6vitest
Vitest fast unit testing framework powered by Vite with Jest-compatible API. Use when writing tests, mocking, configuring coverage, or working with test filtering and fixtures.
6vite
Vite build tool configuration, plugin API, SSR, and Vite 8 Rolldown migration. Use when working with Vite projects, vite.config.ts, Vite plugins, or building libraries/SSR apps with Vite.
6