Repository navigation
Conversation
Our root scripts use several packages that the root `package.json` doesn't declare. They work under Yarn only because hoisting happens to put them in the root `node_modules`: - `@babel/register` and `nullthrows`, used by `build` and the other scripts under `scripts/` - `flow-estree`, used by our lint rules - `@types/babel__core`, `@types/babel__traverse` and `@types/connect`, needed by `typecheck-ts` - `source-map@^0.6.1`. Our packages depend on 0.5, which ships no types, so `typecheck-ts` has been picking up the hoisted 0.6 typings instead. This keeps that behaviour explicit. Each range matches what's already locked, so `yarn.lock` doesn't change. This is needed for any package manager that doesn't hoist, in particular pnpm. Changelog: Internal Test plan: `yarn install --frozen-lockfile` passes with the unchanged `yarn.lock`. Under pnpm 11.28.8 and 12.15.0, before this change `build`, `lint` and `typecheck-ts` fail on missing modules or declarations. After it, `build`, `lint`, `format-check`, `verify-api-snapshots`, `typecheck-ts` and `test-smoke` all pass.
Metro is developed with Yarn v1 and `yarn.lock` stays the source of truth, but this lets pnpm users work in the repo by generating a lockfile with `pnpm import`. It adds a `pnpm-workspace.yaml` (pnpm doesn't read `workspaces` from `package.json`), git-ignores the generated `pnpm-lock.yaml` and documents the two commands in the README. The workspace file also sets two things. `linkWorkspacePackages` - without it, pnpm (since v9) resolves our exact-version internal dependencies like `"metro-core": "0.87.1"` from npm, which fails after a version bump that isn't published yet. `allowBuilds` declines `core-js-pure`'s postinstall (a funding banner) - otherwise pnpm 11+ fails the install with `ERR_PNPM_IGNORED_BUILDS`. Not covered yet: Flow never finishes crawling pnpm's `node_modules` (`flow ls` was still going after 5 minutes, vs ~23k files with Yarn's layout). Ignoring the cross-linked workspace packages didn't help, so I've noted it in the README for now. Changelog: Internal Test plan: On a fresh export of this stack, with each of pnpm 11.28.8 and 12.15.0, `pnpm import` then `pnpm install --frozen-lockfile` succeed, `packages/metro/node_modules/metro-core` is a symlink to `../../metro-core`, and `pnpm exec jest --no-watchman packages` passes (155 suites, 2856 tests), as do `build`, `lint`, `format-check`, `verify-api-snapshots`, `typecheck-ts` and `test-smoke`. Without `allowBuilds`, `pnpm install` exits 1 on both versions.
This branch has not been deployed
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.
This is largely to have some mercy on my disk space - pnpm can use a shared store for
node_modules.Metro is developed with Yarn v1 and
yarn.lockstays the source of truth, but this lets pnpm users work in the repo by generating a lockfile withpnpm import. It adds apnpm-workspace.yaml(pnpm doesn't readworkspacesfrompackage.json), git-ignores the generatedpnpm-lock.yamland documents the two commands in the README.Not covered yet: Flow never finishes crawling pnpm's
node_modules- investigating that.Changelog: Internal
Test plan:
On a fresh export of this stack, with each of pnpm 11.28.8 and 12.15.0,
pnpm importthenpnpm install --frozen-lockfilesucceed,packages/metro/node_modules/metro-coreis a symlink to../../metro-core, andpnpm exec jest --no-watchman packagespasses (155 suites, 2856 tests), as dobuild,lint,format-check,verify-api-snapshots,typecheck-tsandtest-smoke.Without
allowBuilds,pnpm installexits 1 on both versions.