npm install if package.json was modified

Okay so I’m done with the package. Here it is. You can use it exactly the same way you specified in your ideal scenario. Just npm install install-changed and add it to a custom script, like pre-run in your example. It should figure out whether or not it needs to npm install and does so if it needs to.

 {
  "scripts": {
    "pre-run": "install-changed",
    "my-script": "…"
  },

You can also do this programatically but I don’t think you’re going to need this.

let installChanged = require('install-changed')

let isModified = installChanged.watchPackage() 

The function above does exactly the same thing, additonally it also returns a boolean value which you might find useful.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)