Repository navigation
Conversation
58b37fd to
29b7674
Compare
Metro review: Looks goodRisk: low · Commit: This adds a Findings
Verified
Not run: I didn't run the full Jest suite, Flow, Automated review by Claude. Advisory only: it never approves or blocks, and a maintainer makes the call. |
#2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress. This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS. Changelog: Internal Test plan: `actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests). CI on this PR runs the new job.
| runs-on: ${{ matrix.runs-on }} | ||
|
|
||
| # Yarn hoists everything into the root node_modules, which can hide | ||
| # undeclared dependencies. pnpm's isolated node_modules catches them. |
There was a problem hiding this comment.
nit · Root devDependencies stay resolvable from every workspace package, so this job can't catch those being undeclared
The comment says pnpm's isolated node_modules catches undeclared dependencies. That doesn't hold for anything in the root package.json devDependencies. pnpm links those into <root>/node_modules, and Node's resolution walks up from packages/<pkg>/ to that folder.
So if a workspace package starts using nullthrows, invariant, debug, @babel/core, @babel/types, source-map, flow-parser or similar without declaring it, every step of this job still passes.
The job still adds value. It catches undeclared packages that resolved only through Yarn's hoisting from another workspace's dependencies, including in tests, scripts and string-based require.resolve lookups. The import/no-extraneous-dependencies lint rule already covers static imports in packages/*/src.
Suggested fix: narrow the comment, e.g. "catches dependencies that only resolve via hoisting from other packages; root devDependencies remain visible to all workspaces".
Reproduced: In a pnpm 12 scratch install of the head (pnpm import then pnpm install --frozen-lockfile), packages/metro-cache/package.json doesn't declare nullthrows. Even so, require.resolve('nullthrows', {paths: ['packages/metro-cache/src']}) resolves to node_modules/.pnpm/nullthrows@1.1.1/... through the root link. · id dcbeedcb
#2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress.
This adds a
test-pnpmjob tobuild-test-and-deploy. It generatespnpm-lock.yamlfromyarn.lockwithpnpm import, installs, and runs Flow,typecheck-ts, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS.Changelog: Internal
Test plan:
https://github.com/react/metro/actions/runs/44891928638/job/136809422962