Loading...
Loading...
Compare original and translation side by side
pnpm-workspace.yamlworkspace:pnpm-workspace.yamlworkspace:| Pattern | API / Config | Key Points |
|---|---|---|
| Define workspace | | Globs match directories containing |
| Link local package | | Always resolves to local workspace package |
| Link with version range | | Fails install if local version does not satisfy range |
| Default catalog | | Single source of truth for dependency versions |
| Named catalog | | Multiple version sets (e.g., |
| Use catalog in package | | Resolved to actual version on |
| Filter by name | | Exact name or glob pattern ( |
| Filter with dependencies | | Package and all its dependencies |
| Filter with dependents | | Package and all packages that depend on it |
| Filter by directory | | All packages under a directory path |
| Filter by git changes | | Packages changed since a commit or branch |
| Exclude from filter | | Remove matching packages from selection |
| Run script in package | | Runs script only in matched packages |
| Recursive run | | Runs script in all workspace packages |
| Install all | | Single lockfile for entire workspace |
| Publish workspace pkg | | Replaces |
| Inject workspace deps | | Hard-links instead of symlinks; required for deploy |
| Script security (v10+) | | Lifecycle scripts blocked by default; opt-in per dep |
| 模式 | API/配置 | 关键点 |
|---|---|---|
| 定义工作区 | 带有 | 通配符匹配包含 |
| 链接本地包 | | 始终解析为本地工作区包 |
| 带版本范围的链接 | | 若本地版本不满足范围,安装会失败 |
| 默认Catalog | | 依赖版本的单一可信来源 |
| 命名Catalog | 带有命名分组的 | 多版本集合(例如 |
| 在包中使用Catalog | | 在 |
| 按名称过滤 | | 精确名称或通配符模式( |
| 按依赖过滤 | | 包及其所有依赖 |
| 按被依赖过滤 | | 包及其所有依赖它的包 |
| 按目录过滤 | | 指定目录下的所有包 |
| 按Git变更过滤 | | 自某次提交或分支以来有变更的包 |
| 从过滤结果中排除 | | 从选中的包中移除匹配的包 |
| 在包中运行脚本 | | 仅在匹配的包中运行脚本 |
| 递归运行 | | 在所有工作区包中运行脚本 |
| 安装所有依赖 | | 整个工作区使用单一锁文件 |
| 发布工作区包 | | 将 |
| 注入工作区依赖 | | 使用硬链接而非符号链接;部署时必需 |
| 脚本安全性(v10+) | | 默认阻止生命周期脚本;需为每个依赖手动开启 |
| Mistake | Correct Pattern |
|---|---|
Using | pnpm automatically replaces |
Forgetting to list directory in | Every package directory must match a glob in |
Using | Always use |
| Hardcoding versions duplicated across packages | Use |
Running | Run from workspace root; use |
Expecting | |
Not escaping | Use |
Using | |
| Lifecycle scripts failing after pnpm 10 upgrade | pnpm 10 blocks scripts by default; add deps to |
Using | Set |
| 错误操作 | 正确做法 |
|---|---|
使用 | pnpm会在发布时自动将 |
忘记在 | 每个包目录必须匹配 |
在工作区包中使用 | 始终从工作区根目录运行 |
| 在多个包中硬编码重复的版本 | 使用 |
在子包内运行 | 从工作区根目录运行;使用 |
期望 | |
在zsh中使用排除过滤时未转义 | 使用 |
对非工作区依赖使用 | |
| 升级到pnpm 10后生命周期脚本执行失败 | pnpm 10默认阻止脚本;需在配置中将依赖添加到 |
未设置 | 在 |
ExploreTaskIf theskill is available, delegate build orchestration, task caching, and CI optimization to it. If theturboreposkill is available, delegate versioning, changelog generation, and npm publishing to it.changesets
若Skill可用,将构建编排、任务缓存和CI优化委托给它。 若turborepoSkill可用,将版本管理、变更日志生成和npm发布委托给它。changesets