Skip to content

Commit 02638a7

Browse files
committed
docs: update config dependencies docs
1 parent bd822a0 commit 02638a7

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

docs/config-dependencies.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Config dependencies allow you to share and centralize configuration files, setti
77

88
Config dependencies help you keep all the hooks, settings, patches, overrides, catalogs, rules in a single place and use them across multiple repositories.
99

10-
If your config dependency is named following the `pnpm-plugin-*` pattern, pnpm will automatically load the `pnpmfile.cjs` from its root.
10+
If your config dependency is named following the `pnpm-plugin-*` or `@*/pnpm-plugin-*` pattern, pnpm will automatically load the `pnpmfile.cjs` from its root.
1111

1212
## How to Add a Config Dependency
1313

1414
Config dependencies are defined in your `pnpm-workspace.yaml` and must be installed using an exact version and an integrity checksum.
1515

16-
Example:
16+
For example, running `pnpm add --config my-configs` will add this entry to your `pnpm-workspace.yaml`:
1717

1818
```yaml title="pnpm-workspace.yaml"
1919
configDependencies:
@@ -31,7 +31,7 @@ configDependencies:
3131

3232
You can load a list of package names that are allowed to be built, using the [`onlyBuiltDependenciesFile`] setting.
3333

34-
Example `allow.json` file inside a config dependency ([@pnpm/trusted-deps]):
34+
Example `allow.json` file inside a config dependency:
3535

3636
```json title="allow.json"
3737
[
@@ -45,11 +45,10 @@ Your workspace configuration:
4545

4646
```yaml title="pnpm-workspace.yaml"
4747
configDependencies:
48-
'@pnpm/trusted-deps': 0.1.0+sha512-IERT0uXPBnSZGsCmoSuPzYNWhXWWnKkuc9q78KzLdmDWJhnrmvc7N4qaHJmaNKIusdCH2riO3iE34Osohj6n8w==
49-
onlyBuiltDependenciesFile: node_modules/.pnpm-config/@pnpm/trusted-deps/allow.json
48+
'@myorg/trusted-deps': 0.1.0+sha512-IERT0uXPBnSZGsCmoSuPzYNWhXWWnKkuc9q78KzLdmDWJhnrmvc7N4qaHJmaNKIusdCH2riO3iE34Osohj6n8w==
49+
onlyBuiltDependenciesFile: node_modules/.pnpm-config/@myorg/trusted-deps/allow.json
5050
```
5151

52-
[@pnpm/trusted-deps]: https://github.com/pnpm/trusted-deps
5352
[`onlyBuiltDependenciesFile`]: settings.md#onlybuiltdependenciesfile
5453

5554
### Installing Dependencies Used in Hooks
@@ -76,7 +75,7 @@ Using the [`updateConfig`] hook, you can dynamically update pnpm’s settings us
7675

7776
For example, the following `pnpmfile` adds a new [catalog] entry to pnpm's configuration:
7877

79-
```js title="my-catalogs/pnpmfile.cjs"
78+
```js title="@myorg/pnpm-plugin-my-catalogs/pnpmfile.cjs"
8079
module.exports = {
8180
hooks: {
8281
updateConfig (config) {
@@ -88,12 +87,10 @@ module.exports = {
8887
}
8988
```
9089

91-
Install and load it:
90+
If you install it as config dependency:
9291

93-
```yaml title="pnpm-workspace.yaml"
94-
configDependencies:
95-
my-catalogs: "1.0.0+sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="
96-
pnpmfile: "node_modules/.pnpm-config/my-catalogs/pnpmfile.cjs"
92+
```
93+
pnpm add --config @myorg/pnpm-plugin-my-catalogs
9794
```
9895

9996
Then you can run:

0 commit comments

Comments
 (0)