配置依赖
配置依赖允许你在多个项目之间共享和集中配置文件、设置和钩子。它们在所有常规依赖("dependencies"、"devDependencies"、"optionalDependencies")之前安装,非常适合设置自定义钩子、补丁和目录条目。
¥Config dependencies allow you to share and centralize configuration files, settings, and hooks across multiple projects. They are installed before all regular dependencies ("dependencies", "devDependencies", "optionalDependencies"), making them ideal for setting up custom hooks, patches, and catalog entries.
配置依赖可帮助你将所有钩子、设置、补丁、覆盖、目录和规则保存在一个位置,并在多个存储库中使用它们。
¥Config dependencies help you keep all the hooks, settings, patches, overrides, catalogs, rules in a single place and use them across multiple repositories.
如果你的配置依赖按照 pnpm-plugin-*
模式命名,pnpm 将自动从其根目录加载 pnpmfile.cjs
。
¥If your config dependency is named following the pnpm-plugin-*
pattern, pnpm will automatically load the pnpmfile.cjs
from its root.
如何添加配置依赖
¥How to Add a Config Dependency
配置依赖在你的 pnpm-workspace.yaml
中定义,必须使用精确版本和完整性校验和进行安装。
¥Config dependencies are defined in your pnpm-workspace.yaml
and must be installed using an exact version and an integrity checksum.
示例:
¥Example:
configDependencies:
my-configs: "1.0.0+sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="
重要提示: