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

后端 未结 20 1358
悲哀的现实
悲哀的现实 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:40

    I have a funny hack idea.

    Create an npm package name suitably as a comment divider for dependencies and devDependencies block in file package.json, for example x----x----x

    {
        "name": "app-name",
        "dependencies": {
            "x----x----x": "this is the first line of a comment",
            "babel-cli": "6.x.x",
            "babel-core": "6.x.x",
            "x----x----x": "this is the second line of a comment",
            "knex": "^0.11.1",
            "mocha": "1.20.1",
            "x----x----x": "*"
        }
    }
    

    NOTE: You must add the last comment divider line with a valid version, like * in the block.

提交回复
热议问题