How do you define an npm dependency nested in a git repo?
سؤال
If I have an npm dependency that is nested in a git repo, how would I define that dependency in the package.json
file?
Say the git repo is at git://github.com/user/myrepo.git
on the dev
branch, at the relative path ./mylib
from the git repo's root.
Is this possible?
Update: found this which is very close to what I want. Now, I just need to know how to specify the path within the repo+branch.
المحلول
I don't think it's possible. However, you could specify the repo as a dependency. Then add mylib
to bundledDependencies
in package.json
and put a shim into node_modules/mylib/index.js
:
module.exports = require('myrepo')
And yes, you don't need ..
or so, nodes magic does that for you.
نصائح أخرى
It is now pretty easy:
{
"dependencies": {
"sendwithus": "git+https://git@github.com/<repoowner>/<reponame>.git#<branch_name_or_commit-sha>"
}
}
لا تنتمي إلى StackOverflow