The package.json file settings in JavaScript
When a programmer wants to make his
library available to everyone, he must
place it in the npm registry. To
do this, he must format a
package.json file of this
library in a special way, adding
some important settings.
These settings apply specifically to public libraries that you download from npm. In your projects for private use, you can choose not to install them.
So here is a list of the most popular settings:
| Field | Description |
|---|---|
name |
project name, must be written in lower case |
version |
version number, according to semantic versioning |
description |
project description |
main |
primary entry point to project |
keywords |
this is an array to help find a module in the npm registry |
author |
this field accepts an object with
the keys name, email
and url, which makes it easy
for people to contact the project author.
|
license |
accepts a license name using the SPDX identifier. The default license is ISC, another popular choice is MIT. You can also use UNLICENSED for private and closed source projects. |
private |
if this key is set to true, the project will not be able to be public in the npm registry. This prevents accidental publication of the project. |
homepage |
Project home page URL |
bugs |
URL address where issues and bugs can be reported. Often this is the address of the project page on Github. |
Install the
jQuery
library. Find a folder with the library
in node_modules and then a
package.json file in it.
Study it.
Install the
underscorejs
library. Find the folder with the library
in node_modules and then a
package.json file in it.
Study it.
Study the package.json file settings in
official documentation.