Reputation: 14866
In my package.json I have lines like the following:
"dependencies": {
"my-library": ""git+ssh://[email protected]/my_org/my-library.git"
}
This will always install the latest from the master
branch of my-library on github. What I would like is to be able to get the commit hash at the time this dependency is installed. Is this possible?
Upvotes: 6
Views: 4018
Reputation: 957
npm list my-library
inside your package will give the commit hash like below
[email protected] /.../sample-project
└── [email protected] (git+https://[email protected]/mylibrary/mylibrary.git#fadsf8972qrjafds76d7aa30ee4d7671c)
and also when npm install
is done from module that has dependency from git, node_modules/my-library/package.json
will have a key _resolved
which will give you the commit hash from which the module is installed.
it will look something like this
"_resolved": "git+https://[email protected]/mylibrary/mylibrary.git#fadsf8972qrjafds76d7aa30ee4d7671c"
Upvotes: 2