You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c73d16a
Browse filesBrowse the repository at this point in the historyBrowse files
chore(deps): move all dependencies to pnpm catalogs (AI-assisted) (#12696)
* chore(deps): use a pnpm catalog for dependencies shared by several packages (AI-assisted)
- Declare the 49 dependencies shared by several monorepo packages once,
in the `catalog` of `pnpm-workspace.yaml`, and reference them with the
`catalog:` protocol. The resolved versions in the lockfile don't change
- Dependency group members, template dependencies, pnpm overrides and
peer dependencies keep explicit ranges, so syncpack keeps checking them
- Publish preview packages with `pkg-pr-new --pnpm`: `pnpm pack` replaces
`catalog:` with versions, `npm pack` doesn't
- Document the catalog rules in the `dependencies` agent skill
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(deps): move all dependencies to pnpm catalogs, with a dev catalog for dev-only dependencies (AI-assisted)
- Every dependency of the monorepo packages now uses the pnpm catalogs:
- The default catalog (`catalog:`) holds the dependencies used at
runtime by at least one package
- The `dev` catalog (`catalog:dev`) holds the dependencies only used as
devDependencies
- Only the site templates, the pnpm overrides and the peer dependencies
with intentionally broader ranges keep explicit versions
- `pnpm lint:syncpack` checks that dependencies use a catalog
- New `pnpm lint:catalogs` check, for what Syncpack can't check: catalog
entries are in the right catalog, templates and overrides match the
catalogs, and the members of each Dependabot group use the same version
- Dependency groups are now only declared in `.github/dependabot.yml`
The resolved packages of the lockfile don't change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(scripts): make lintCatalogs.js easier to review (AI-assisted)
Organize the script as a tree: main() gives the high-level picture, then the
data loading, one pure function per check, and the low-level helpers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(deps): enable pnpm catalogMode strict and catalogPrune, check unused catalog entries (AI-assisted)
- `catalogMode: strict`: `pnpm add` only accepts catalog versions, and adds
new dependencies to the default catalog
- `catalogPrune: true`: `pnpm remove` removes the unused catalog entries
- `pnpm lint:catalogs` reports unused catalog entries: pnpm doesn't prune
them when a package.json is edited manually
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: type-check the website with min/max TypeScript versions through pnpm dlx (AI-assisted)
`pnpm add typescript@<version>` modified the workspace dependencies, and fails
with the new `catalogMode: strict` setting: the min version step adds
TypeScript to the catalog, then the max version step is outside its range.
Run the TypeScript compiler of the tested version with `pnpm dlx` instead,
without modifying package.json, the lockfile or the catalogs. Type
resolution still uses the workspace node_modules.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .agents/skills/dependencies/SKILL.md
+29-5Lines changed: 29 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,39 @@ description: Add, remove or upgrade npm dependencies in the Docusaurus monorepo.
8
8
## Lockfile
9
9
10
10
- Run `pnpm dedupe` after any lockfile change. CI fails if `pnpm-lock.yaml` is not deduplicated (`pnpm lint:deps`).
11
-
- Run `pnpm lint:syncpack`: the same dependency must use the same version range in all packages.
12
11
- Site template dependencies live in `packages/create-docusaurus/templates/`. Never edit `examples/`, it is CLI-generated.
13
12
13
+
## Catalogs
14
+
15
+
All the monorepo dependencies are declared in the [pnpm catalogs](https://pnpm.io/catalogs) of `pnpm-workspace.yaml`. Packages reference them with the catalog protocol instead of a version range:
16
+
17
+
-`"catalog:"`: the default catalog, for dependencies used at runtime by at least one package (`dependencies`, `optionalDependencies` or `peerDependencies`).
18
+
-`"catalog:dev"`: the dev catalog, for dependencies only used as `devDependencies`.
19
+
20
+
Use pnpm commands to add and remove dependencies:
21
+
22
+
-`pnpm add` only accepts catalog versions (`catalogMode: strict`), and adds new dependencies to the default catalog. Move dev-only dependencies to the dev catalog.
23
+
-`pnpm remove` removes the catalog entries that are no longer used (`catalogPrune: true`). Manual `package.json` edits don't.
24
+
25
+
Move a dev catalog entry to the default catalog as soon as a package uses it at runtime.
26
+
27
+
Exceptions, keeping explicit versions:
28
+
29
+
- The site templates, copied to user sites. Their versions must match the catalogs.
30
+
- pnpm `overrides`. Their versions must match the catalogs.
31
+
- Peer dependencies whose range intentionally differs from the catalog (see the ignored version groups of `.syncpackrc.ts`).
32
+
33
+
Two checks enforce it:
34
+
35
+
-`pnpm lint:syncpack`: dependencies must use a catalog.
36
+
-`pnpm lint:catalogs` (`admin/scripts/lintCatalogs.js`): catalog entries are used and in the right catalog, templates and overrides match the catalogs, and dependency group members use the same version.
37
+
14
38
## Dependency groups
15
39
16
-
Some packages must always use the same version. They are declared as groups in two places, which must stay in sync:
40
+
Some packages must always use the same version. They are declared as `groups` in `.github/dependabot.yml`:
17
41
18
-
-`.github/dependabot.yml` (`groups`): Dependabot upgrades them atomically in a single PR, instead of opening broken intermediate PRs.
19
-
-`.syncpackrc.ts` (`dependencyGroups`): `pnpm lint:syncpack` fails if their versions differ.
42
+
- Dependabot upgrades them atomically in a single PR, instead of opening broken intermediate PRs.
43
+
-`pnpm lint:catalogs` fails if their catalog versions differ.
20
44
21
45
Packages belong to a group when, for example:
22
46
@@ -29,6 +53,6 @@ Packages belong to a group when, for example:
29
53
When you add a dependency, check whether it belongs to a group:
30
54
31
55
- If an existing group already matches it (`@svgr/*` matches `@svgr/plugin-jsx`), there is nothing to do.
32
-
- Otherwise, add it to the matching group, or create a new group, in both files. Follow the existing groups: one group per package family, with a comment explaining why the packages must stay in sync.
56
+
- Otherwise, add it to the matching group, or create a new group. Follow the existing groups: one group per package family, with a comment explaining why the packages must stay in sync.
33
57
34
58
Do the same when a Dependabot PR can't pass CI on its own because a related package wasn't upgraded with it.
0 commit comments