Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can npm-check-updates lock a few dependency when doing ncu -ua?

We are using npm-check-updates to update our package.json dependency.

We have serious issues with it because we have many small projects that need to have a fixed version for a certain dependency.

I am a module writer and we do not want to fix version for our users in our package.json, but we want to support up to a version voluntary on our side.

Most of the time, when we build something on top of, we want to stick to show the dependency set by the core one.

We found ncu -ua to be an excellent command when we do not have a fixed version in our package, but we must proceed to a manual edition of package.json when we do have fixed version.

Is there a way using a file or whatever, to set a list of ignored dependency when using ncu -ua?

That would save us a lot of time.

like image 215
Dimitri Kopriwa Avatar asked Dec 11 '22 03:12

Dimitri Kopriwa


1 Answers

npm-check-updates has a flag -x, --reject to ignore certain packages when checking for updates.

ncu -u -x mobx,query-string

Will update all outdated dependencies except mobx and query-string (dropped IE11 support at certain versions).

To have a place where to write down the dependencies that shouldn't be updated anymore, the above command can be added to the scripts inside package.json like this:

{
  "name": "my-project",
  "scripts": {
    "update": "ncu -u -x mobx,query-string"
  }
}

Always remember to update through npm run update.

like image 52
matthiasgiger Avatar answered Jan 04 '23 23:01

matthiasgiger