ci: enforce catalog for dependencies shared by 2+ packages#145
Merged
Conversation
Add a hard gate that fails when a dependency is declared with an inline registry range in two or more workspace packages — those must instead be hoisted to the `catalog:` in pnpm-workspace.yaml. `catalogMode: prefer` only softly nudges new adds; this keeps duplication from drifting back in via hand-edited package.json. - scripts/check-catalog.core.mjs: pure, unit-tested logic (no IO) - scripts/check-catalog.mjs: IO shell using pnpm's SDK (@pnpm/fs.find-packages + @pnpm/workspace.read-manifest) to enumerate members and read the catalogs — not the lockfile (which has already resolved catalog: refs) and not hand-parsed YAML - scripts/check-catalog.test.mjs: node:test unit tests (13) - turbo: //#check:catalog in ci.dependsOn; //#test:root attached to the `test` task via `with`, mirroring lint:root/format:root - eslint: extend the node-globals block to **/*.mjs
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
lit-ui-router | 2028305 | Commit Preview URL Branch Preview URL |
Jun 03 2026, 07:12 AM |
Contributor
Coverage Report for packages/lit-ui-router
File CoverageNo changed files found. |
Contributor
Coverage Report for packages/navigation-location-plugin
File CoverageNo changed files found. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #145 +/- ##
=======================================
Coverage 97.27% 97.27%
=======================================
Files 6 6
Lines 514 514
Branches 102 102
=======================================
Hits 500 500
Misses 14 14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a hard CI gate that fails when a dependency is declared with an inline registry range (e.g.
^1.2.3) in two or more workspace packages. Such deps must instead live in thecatalog:inpnpm-workspace.yamland be referenced ascatalog:.catalogMode: preferonly softly nudges newpnpm adds toward the catalog; this check is the hard backstop that keeps duplication from drifting back in via hand-editedpackage.jsonor a--save-catalog-less add.How
scripts/check-catalog.core.mjs— pure logic, zero IO, so each unit is testable with plain fixtures:isInlineRegistryRange,collectInlineUsage,findViolations,catalogDepNames,formatReport(catalog-aware hint: "add X" vs "catalog already defines X").scripts/check-catalog.mjs— thin IO shell. Uses pnpm's own SDK (@pnpm/fs.find-packages+@pnpm/workspace.read-manifest) to enumerate workspace members and read the catalogs.catalog:→ concrete versions, erasing the inline-vs-catalogued distinction.examples/*tutorials are correctly excluded as non-members.scripts/check-catalog.test.mjs— 13node:testunit tests (zero new test deps).Wiring
//#check:catalog→ci.dependsOn.//#test:root(node --test "scripts/**/*.test.mjs") attached to thetesttask viawith, mirroringlint:root/format:root— soturbo run testandturbo run ciboth run it, and any futurescripts/**/*.test.mjsis auto-discovered.eslint.config.js: extended the node-globals block to**/*.mjs.The single
turbo run ci --ui=streamin CI covers both new tasks — no workflow edit.Notes
catalogMode: preferauto-routed the two new@pnpm/*dev deps into the catalog (single-consumer, harmless).Test plan
pnpm check:catalogpasses (8 members)pnpm test:root— 13/13lodashinto two packages) fails with a drift-aware messageturbo run check:catalog test:root lintgreen; prettier + eslint clean