feat(version): Update 'version' field of package-lock.json
See original GitHub issueExpected Behavior
I would expect lerna version
to update the version
field of package-lock.json
files in packages that it updates the version of.
Current Behavior
Currently it seems like lerna version
only updates package.json
.
Solution
Update the version
field in package-lock.json
and npm-shrinkwrap.json
. Edit: and yarn.lock
I guess, and who knows what else, which also might explain why this isn’t currently implemented.
Steps to Reproduce (for bugs)
lerna init
lerna create foo
cd packages/foo && npm install && cd ../..
(generatepackage-lock.json
)lerna version
grep version packages/a/package{,-lock}.json
lerna.json
{
"packages": [
"packages/*"
],
"version": "0.0.0"
}
Context
I haven’t encountered any actual problems with it, but it just looks weird (and it’s wrong too).
Your Environment
Executable | Version |
---|---|
lerna --version |
3.13.0 |
npm --version |
6.9.0 |
yarn --version |
N/A |
node --version |
v11.11.0 |
OS | Version |
---|---|
NAME | VERSION |
Debian | 8.2.0-14 |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:12 (4 by maintainers)
Top Results From Across the Web
package-lock.json - npm Docs
Dependency objects have the following fields: version: a specifier that varies depending on the nature of the package, and is usable in fetching...
Read more >Frequently Asked Questions - semantic-release
As the @semantic-release/npm plugin uses the npm CLI to update the package.json version and publish the package, all npm hook scripts will be...
Read more >How to update version of a package in package-lock.json and ...
Now it works different, if you notice package versions in package lock.json have a prefix, sometimes its ~ sometimes ^ , they have...
Read more >The Complete Guide to package-lock.json - Medium
package.json · The dependencies object contains the package name mapped to the version range · Different symbols denote different version updating strategies.
Read more >Java (programming language) - Wikipedia
Java is a high-level, class-based, object-oriented programming language that is designed to ... As of September 2022, Java 19 is the latest version,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can offer some details for whoever might decide to work on a PR for this. There are two points in the lifecycle in which a
package-lock.json
might be updated. The first isversion
, which has already been discussed. The second is afterpublish
, where freshly published dependencies now have a newintegrity
hash.The publish work around that I’ve had success with is this script:
A quick summary is that
--no-push
will make lerna skip the git tag and push duringpublish
so that the script can update thepackage-lock.json
files, amend the commit, tag, and finally push.The above script only works for a project using fixed versions.
I would love to see this added to
lerna
, but I may not have time to submit a PR myself. I hope this helps someone who does!v3.18.2