How do I add comments to package.json for npm install?

后端 未结 20 1351
悲哀的现实
悲哀的现实 2020-12-07 07:30

I\'ve got a simple package.json file and I want to add a comment. Is there a way to do this, or are there any hacks to make this work?



        
20条回答
  •  眼角桃花
    2020-12-07 07:55

    For npm's package.json, I have found two ways (after reading this conversation):

      "devDependencies": {
        "del-comment": [
          "some-text"
        ],
        "del": "^5.1.0 ! inner comment",
        "envify-comment": [
          "some-text"
        ],
        "envify": "4.1.0 ! inner comment"
      }
    

    But with the update or reinstall of package with "--save" or "--save-dev, a comment like "^4.1.0 ! comment" in the corresponding place will be deleted. And all this will break npm audit.

提交回复
热议问题