Package.json Field Full Solution __js

Source: Internet
Author: User
Name

must be field.

Tips: Do not include JS in the name, node words; the name will eventually be part of the URL, the command line parameter, the directory name, so it cannot begin with a dot or underscore; the name may be invoked in the Require () method, so it should be as short as possible;

must be field. Description

Optional field, must be a string. NPM will use it when it's search. Keywords

An optional field, an array of strings. NPM will use it when it's search. Homepage

Optional field, no http://, and so on, with protocol prefix URLs. Bugs

Optional field, problem tracking system URL or email address;NPM bugs .

{"url": "Http://github.com/owner/project/issues",

"Email": "project@hostname.com"

} License

An optional field.

If you are using a universal license, such as Bsd-3-clause or MIT, use it directly:

{"License": "Bsd-3-clause"}
Author, Contributors

are optional fields. Author is a person, contributors is a group of people.

The author format is as follows:

{' name ': ' Barney rubble ',
"Email": "b@rubble.com",
"url": "http://barnyrubble.tumblr.com/"
}

This format can also be:

"Barney rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
Files

An optional field in which a project contains a set of files. If it is a folder, the files under the folder will also be included. Add a ". Npmignore" file if you need to include some files in the project. This file is similar to "Gitignore". Main

An optional field. The value of this field is the ID ofYour program's main entry module. If another user needs your package, when the user invokes the Require () method, the export of the module is returned (exports). Bin

An optional field. A lot of packages will have execution files that need to be installed in path.

This field corresponds to a map, each element corresponding to a {command name: file name}.

{' bin ': {' npm ': './cli.js '}}
Directories

Directory structure to indicate package: Directories.lib

Indicates the location of the library file. Directories.bin

It's the same as the previous bin, but if there is already a bin in front of it, then this is not valid.

In addition to the above two, there are directories.doc& Directories.man & Directories.example. Repository

An optional field. Used to indicate where the code is stored.

"Repository":
{' type ': ' Git '
, "url": "Http://github.com/npm/npm.git"
}
"Repository":
{' type ': ' SVN '
, "url": "http://v8.googlecode.com/svn/trunk/"
}
Scripts

Optional field, object. The key is the lifecycle event name, and value is the command to run at the event point. Reference npm-scripts. Config

Optional field, object.

The values in the Config object are available throughout the Scripts cycle and are designed to provide configuration parameters to Scripts. Dependencies

An optional field that indicates the other packages on which the current package depends.

{"Dependencies":
{"Foo": "1.0.0-2.9999.9999"
, "bar": ">=1.0.2 <2.1.2"
, "Baz": ">1.0.2 <=2.3.4"
, "Boo": "2.0.1"
, "Qux": "<1.0.0 | | >=2.3.1 <2.4.5 | | >=2.5.2 <3.0.0 "
, "ASD": "Http://asdf.com/asdf.tar.gz"
, "til": "~1.2"
, "Elf": "~1.2.3"
, "two": "2.x"
, "THR": "3.3.x"
}
}

The version format can be any of the following: version exactly matches >version greater than this version >=version is greater than or equal to this version <version <=version ~version is very close to this version ^version with The current version of the compatible 1.2.x x represents any number, so 1.2.1, 1.2.3, etc. can http://... The URL of the tarball used under UNIX systems. * Any version can be version1-version2 equivalent to >=version1 <=version2. Range1 | | Range2 satisfy any one can git ... git address User/repo devdependencies

An optional field. If you only need to download some modules and not download the test and documentation framework for these modules, it's better to put them under this. peerdependencies

An optional field. Compatibility dependencies. If your package is plug-in, fit this way. bundleddependencies

An optional field. Other dependencies that are packaged at the same time the package is published. optionaldependencies

An optional field. NPM continues to execute if you want to have some dependencies that are not found, or if the installation fails. So these dependencies fit right here. Engines

An optional field. You can specify either the node version:

{' engines ': {' node ': ' >=0.10.3 <0.12 '}}

You can also specify the NPM version:

{"Engines": {"NPM": "~1.0.20"}} Enginestrick

Optional field, Boolean value. Set to True if you are certain that your program can only be run on a engine. Os

An optional field. Specify what operating system the module can run on:

"OS": ["Darwin", "Linux"]

"OS": ["!win32"] CPU

An optional field. Specifies the CPU model.

"CPU": ["x64", "IA32"]

"CPU": ["!arm", "!mips"] preferglobal

Optional field, Boolean value. If your package is a command-line application that requires global installation, you can set it to true. Private

Optional field, Boolean value. If private is TRUE,NPM, the publication will be rejected. This prevents private repositories from being released accidentally. Publishconfig

An optional field. The configuration values used when publishing are placed here. Default Value

· "Scripts": {"Start": "Node Server.js"}

If you have server.js files in your bag, NPM defaults to: Node server.js.

· "Scripts": {"Preinstall": "Node-gyp Rebuild"}

If there is binding.gyp,npm in the package default preinstall command, use NODE-GYP to do the compilation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.