1

How do I specify exact git hash in package.json dependencies for a Github project, and have an easy way to upgrade it at the same time?

My package.json is as follow:

{
  "name": "my faboulous app",
  "version": "1.0.0",
  "dependencies": {
    // ...
    "request": "request/request#5ee89063cd"
  }
}

It relies on a Github project: https://github.com/request/request and uses specific revision which is 5ee89063cd.

I want to stick to specific version, so when someones clones my project and calls npm install she has the same request dependency version as me.

But at certain point in time, there comes an important bugfix for me, and I want to upgrade the revision in package.json to the newest version that is available at Github.

Is it possible to achieve this with npm update command? How can I upgrade the revision from command line, instead of manually editing the file?

My understanding is that, when I call npm install it always takes the hash that is specified in package.json. But when I call npm update I would like to have package.json request dependency updated to the latest repository version of it with the newest revision hash.

How can I achieve that? If not with npm update maybe there is the other simple way?

Dariusz Mydlarz
  • 2,940
  • 6
  • 31
  • 59
  • Possible duplicate of [npm install from Git in a specific version](https://stackoverflow.com/questions/14187956/npm-install-from-git-in-a-specific-version) – alexmac Dec 07 '18 at 07:40

1 Answers1

0

Update

Checkout the git-npm-updater package which can get the job done for you.

git-npm-updater automatically updates npm dependencies presented in your package.json and create pull requests to your git repo.

Hope this helps!

David R
  • 14,711
  • 7
  • 54
  • 72