I am maintaining an NPM package (lets say it as package-A
) that relies on an another NPM package(package-B
) to function. Therefore, I am in need to add that package as peer-dependency into the package.json
, so that npm and the user can be sure that everything is correct.
The problem is, package-B
use pre-release versioning. I am well aware that it uses semver wrong, but I am not able to change the company policy, yet. Meanwhile enforcing to use proper versioning will happen. The semantic is like this:
- 1.0.1-alpha.X -> Unstable releases for testing and bleeding edge content
- 1.0.1-beta.X -> For every seemingly stable version (like rc)
- 1.0.2 -> When the package is production ready.
So basically, the patch version increases when there is another production release.
Case: Because of the versioning, I need to include every package except major one to match as peer dependency, together with pre-releases.
The need is basically ^1.0.0
with everything including pre-releases that happens to have 1
as major as peer dependency
^1.0.0
-> Does not include pre-releases^1.0.0 || >=1.0.0-beta.X
-> Does not include e.g.1.0.1-beta.1
*
-> Does not include pre-releases^1.0.0 || >=1.X.X-beta.X
-> Does not work.
On semver, there is a parameter called --include-prerelease
which I think does what I need, specific to semver commands obviously.
react
package on NPM has similar versioning system with proper usage of pre-release. E.g. it has 16.0.0
, 16.0.0-alpha.1
and 16.6.0-alpha.0
. I basically need to include all this on a single range.
Disclaimer: Minor version is changed when there is a breaking change going on. Yet again, I am well aware that this versioning is not up to semver regulations and advising it unfortunately will not solve the problem at hand.