简体   繁体   English

package.json `name` 和 `version` 是否应该放在 JSON 的顶层?

[英]Should package.json `name` and `version` be placed at the top level of JSON?

If the name field is not placed at the top level in package.json file in the manner illustrated below, is it recognized Or Not?如果 name 字段没有按如下所示的方式放置在 package.json 文件的顶层,它是否被识别?

Is there an npmjs specification indicating that these syntaxes are allowed?是否有 npmjs 规范表明这些语法是允许的?

{
  "dummy": {
    "name": "project"
  },
  "version": "1.0.0"
}

I read this page, but there was no description of how deep each field should be placed in package.json, and if there is no name, version field, etc. https://docs.npmjs.com/creating-a-package-json-file我读了这个页面,但是没有描述package.json中每个字段应该放置多深,如果没有名称,版本字段等。 -json-文件

That way "name" won't be recognized by most tooling, no.这样,大多数工具都不会识别"name" ,不会。

Extensions not specified in the NPM package.json spec are allowed (but gently discouraged, IIRC). NPM package.json规范中未指定的扩展是允许的(但不鼓励,IIRC)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM