I need to add an link of my github repository to my npm package. I did not find the solution yet on the npm documentation.
To npm install a public project that is hosted on Github, and not the NPM registry, add the Github repo to package. json dependencies using the username/repo#branch-name format. Run npm install and npm will download the project and save it into your /node_modules/ folder.
There is no way to share private repository among non-Github users. You need the Github account and be added as collaborator to the project.
You have a field called repository in package.json. If not, you can make it yourself. Add the GitHub repository URL there:
"repository": {
"type": "git",
"url": "https://github.com/your-user/repo-url.git"
},
Make sure you specify git as type and that the URL is pointing to the actual repository, not an HTML page. So the URL has to end with .git. You can copy/paste the URL you find when you click the Clone or download button on GitHub.
There is also a field called homepage that you can use to point to the repository landing page.
The documentation is here, by the way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With