如何将我的github repo链接添加到npm包中?

Pra*_*idu 7 github npm

我需要将我的github存储库的链接添加到我的npm包中.我没有在npm文档中找到解决方案.

Mik*_*kaS 12

您在package.json中有一个名为repository的字段.如果没有,你可以自己做.在那里添加GitHub存储库URL:

"repository": {
  "type": "git",
  "url": "https://github.com/your-user/repo-url.git"
},
Run Code Online (Sandbox Code Playgroud)

确保将git指定为类型,并且URL指向实际存储库,而不是HTML页面.所以URL必须以.git结尾.您可以复制/粘贴在GitHub上单击克隆或下载按钮时找到的URL .

还有一个名为主页的字段,您可以使用该字段指向存储库登录页面.

顺便提一下,文档就在这里.

  • 你真的需要最后的“.git”吗? (3认同)
  • `"repository": "github:user/repo"` 请参阅:https://docs.npmjs.com/files/package.json#repository (2认同)