node.jsgitgithubnpmpackage.json

How to add a git repo in package.json file


I have an app where I didn't add its repository in package.json while doing npm init.

Now I want to add repo in the package.json file, but couldn't find helpful solutions for me.

Also, I found repository url's ending like this .git but my repo address is simply this https://github.com/sonyzach/usfm-validator

  1. How can I add my repo url in my package.json?
  2. Which format need to add in package.json?

Solution

  • You can just open the package.json file with any editor and add the following in the main object

    "repository": {
        "type": "git",
        "url": "https://github.com/sonyzach/usfm-validator.git"
    },
    

    also I think you should add the .git version