Skip to content

package-lock.json version not updated correctly #257

@sdankel

Description

@sdankel

Newer versions of npm require updating package-lock.json in two places, like this:

--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "my-pkg",
-  "version": "0.3.1",
+  "version": "0.3.2",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "my-pkg",
-      "version": "0.3.1",
+      "version": "0.3.2",
       "license": "Apache-2.0",
       "dependencies": {

however, adding package-lock.json to the version-file property only results in the version being updated on one line:

--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "my-pkg",
-  "version": "0.3.1",
+  "version": "0.3.2",
   "lockfileVersion": 2,

What would be better is if there was a pre-commit hook that runs a bash command (npm i in this case) to update the package-lock.json. It looks like the pre-commit hook only accept a js script right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions