If I have a monorepo with packageA
and packageB
, with the latter having a dependency on the former. If I then run lerna version major
, for example, resulting in packageA
's version number being bumped, does the listing of the dependency on it in packageB
's package.json
also get bumped automatically, or should that be done manually?
(I tried setting up a test repository to do this, but then Lerna was complaining it didn't have a remote yet, so I'm hoping someone with experience using Lerna knows the answer.)
For the sake of this answer, I'm going to assume you are not using conventional Commits. Please feel free to respond with more specifics if I assume wrong.
Yes, if you run lerna version major
_all packages in your repo will be updated to a new major version and the package.json
file for packageB
will be updated with the new version number for packageA
.
Let's say you have your packageA
and packageB
packages in your monorepo and they have package.json
files that look like this:
# packageA/package.json
{
"name": "packageA",
"version": "1.0.0,"
}
# packageB/package.json
{
"name": "packageB",
"version": "1.0.0",
"dependencies": {
"packageA": "^1.0.0"
}
}
When you run `lerna version major:
version
field in packageA/package.json
will update to 2.0.0
version
field in packageB/package.json
will update to 2.0.0
dependencies.packageA
field in packageB/package.json
will update to ^2.0.0
# packageA/package.json
{
"name": "packageA",
"version": "2.0.0,"
}
# packageB/package.json
{
"name": "packageB",
"version": "2.0.0",
"dependencies": {
"packageA": "^2.0.0"
}
}