We have a mono-repository using lerna. On every pull request, we would like to create a pre-release version and publish it.
Demo Project for better understanding => react-lerna-demo
Package structure:
- util-lib
- shared-ui --> util-lib (peer-dep)
- web-app --> shared-lib & util-lib
Normal releases works just fine. But pre-release has the following problem.
- When util-lib has a change, it would have version like
4.0.6-1b596d6.0
- shared-ui has a peer dep version like
^4.0.0
- Web-App is then changed to
"@keth-dev/lerna-demo-util-lib": "4.0.6-1b596d6.0"
(see changes
This worked before npm v7. But now it throws an error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @keth-dev/lerna-demo-web-app@4.0.5
npm ERR! Found: @keth-dev/lerna-demo-util-lib@4.0.6-1b596d6.0
npm ERR! node_modules/@keth-dev/lerna-demo-util-lib
npm ERR! @keth-dev/lerna-demo-util-lib@"4.0.6-1b596d6.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @keth-dev/lerna-demo-util-lib@"^4.0.0" from @keth-dev/lerna-demo-shared-ui@4.0.4
npm ERR! node_modules/@keth-dev/lerna-demo-shared-ui
npm ERR! @keth-dev/lerna-demo-shared-ui@"4.0.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --no-strict-peer-deps, --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Build details => https://github.com/keth-dev/react-lerna-demo/runs/5545142338?check_suite_focus=true
Are there any solutions to support dynamic pre-release versions without legacy-peer-deps
flag?
semver
package provides an option includePrerelease
to suppress the strict version match.
If a version has a prerelease tag (for example, 1.2.3-alpha.3) then it will only be allowed to satisfy comparator sets if at least one comparator with the same [major, minor, patch] tuple also has a prerelease tag.
Is there a way to pass this flag while installing using npm?