我如何添加注释到package.json npm install? [英] How do I add comments to package.json for npm install?

查看:882
本文介绍了我如何添加注释到package.json npm install?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的package.json文件,我想添加一个注释。有没有办法做这个,还是有任何hack来使这项工作?

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?

{
  "name": "My Project",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "express": "3.x",
    "mongoose": "3.x"
  },
  "devDependencies" :  {
    "should": "*"
    /* "mocha": "*" not needed as should be globally installed */
  }
}

上面的示例注释不能作为npm中断。我已经尝试过//样式的注释。

The example comment above doesn't work as npm breaks. I've also tried // style comments.

推荐答案

/groups.google.com/d/msg/nodejs/NmL7jdeuw0M/yTqI05DRQrIJ\"> node.js邮寄名单。

This has recently been discussed in the node.js mailing list.

根据Isaac Schlueter创建的npm :

According to Isaac Schlueter who created npm:


...//键永远不会被npm用于任何目的,如果要使用多行注释,可以使用
数组或多个//键。

... the "//" key will never be used by npm for any purpose, and is reserved for comments ... If you want to use a multiple line comment, you can use either an array, or multiple "//" keys.



{ "//": "this is the first line of a comment", 
  "//": "this is the second line of the comment" } 

{ "//": [ 
  "first line", 
  "second line" ] } 

这篇关于我如何添加注释到package.json npm install?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆