Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add link of my github repo to npm package?

Tags:

github

npm

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.

like image 887
Prakash Naidu Avatar asked Jan 22 '18 09:01

Prakash Naidu


People also ask

How do I add a Git repo to a NPM package?

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.

Can you share GitHub repo with Link?

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.


1 Answers

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.

like image 149
Mika Sundland Avatar answered Oct 08 '22 14:10

Mika Sundland