Prakash Naidu
Prakash Naidu

Reputation: 780

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

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.

Upvotes: 26

Views: 15796

Answers (1)

Mika Sundland
Mika Sundland

Reputation: 18969

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.

Upvotes: 53

Related Questions