update-db
update-db copied to clipboard
Compatibility with rush monorepo
I'm attempting to resolve the warning that caniuse-lite
is out of date in a monorepo managed with rush. I'm using the command pnpm dlx update-browserslist-db@latest
since I'm using pnpm. Individual packages are defined by repo_root/packages/package_name/package.json
. The lockfile is global in rush managed monorepos though; it lives at repo_root/common/config/rush/pnpm-lock.yaml
.
When I attempt to run the update command in one of the package's directory (e.g. repo_root/packages/package_A
), I receive the following error stating no lockfile can be found:
pnpm dlx update-browserslist-db@latest .../Library/pnpm/store/v3/tmp/dlx-67755 | +3 + .../Library/pnpm/store/v3/tmp/dlx-67755 | Progress: resolved 3, reused 2, downloaded 1, added 3, done WARN Issues with peer dependencies found . └─┬ update-browserslist-db 1.0.11 └── ✕ missing peer browserslist@">= 4.21.0" Peer dependencies that should be installed: browserslist@">= 4.21.0"
update-browserslist-db: No lockfile found. Run "npm install", "yarn install" or "pnpm install"ERROR Command failed with exit code 1: /Users/niaconis/Library/pnpm/store/v3/tmp/dlx-67755/node_modules/.bin/update-browserslist-db
When I attempt to run the update command in the location of the lockfile (or in the repository root), I receive the following error stating package.json can't be found:
pnpm dlx update-browserslist-db@latest ../Library/pnpm/store/v3/tmp/dlx-72074 | +3 + WARN Issues with peer dependencies found . └─┬ update-browserslist-db 1.0.11 └── ✕ missing peer browserslist@">= 4.21.0" Peer dependencies that should be installed: browserslist@">= 4.21.0"
../Library/pnpm/store/v3/tmp/dlx-72074 | Progress: resolved 3, reused 3, downloaded 0, added 3, done update-browserslist-db: Cannot find package.json. Is this the right directory to run
npx update-browserslist-db
in? ERROR Command failed with exit code 1: /Users/niaconis/Library/pnpm/store/v3/tmp/dlx-72074/node_modules/.bin/update-browserslist-db
How does one run update-browserslist-db
in a monorepo environment where package.json
and pnpm-lock.yaml
are stored in different locations?
You don’t really need this tool for pnpm
since pnpm
has a great internal dependencies update tool. Just call in the root:
pnpm update caniuse-lite -r
If you know how to improve our lick file detector, please send PR