Npm - Package (or Module)

> (World Wide) Web - (W3|WWW) > Javascript (Js|ECMAScript) > Node - npm cli (Node package manager)

1 - About

package (ie module) in Node Npm

A Package is the installation or public property of a Module.

The unique identifier is its name and version together defined in the package.json

A package can be installed

Advertising

3 - Management

3.1 - Name

A package is:

  • a folder containing a program described by a package.json file
  • a gzipped tarball containing the folder
  • a url pointing to a tarball
  • a <name>@<version> that is published on the registry
  • a <name>@<tag> (see npm-dist-tag)
  • a <name> that has a “latest” tag satisfying
  • a <git remote url> that resolves to a folder
npm install git+ssh://git@github.com:isaacs/sax-js.git#cae7b6fb8c
npm install sax@git+ssh://git@github.com:isaacs/sax-js.git#cae7b6fb8c
npm install git+https://isaacs@github.com/isaacs/sax-js.git#cae7b6fb8c

3.2 - Installation / Update / Delete

See:

Advertising

3.3 - Install all project dependency

3.4 - How to create a package (module)

3.5 - Scope (Private Module)

To create a scoped package, you simply use a package name that starts with your scope.

{
  "name": "@username/project-name"
}

See:

3.6 - Version

If there is no package.json file in the root directory, the latest version of the package is installed.

If there is package.json file, the latest version satisfying the semver rule declared in package.json for that package (if there is any) is installed.

See https://docs.npmjs.com/getting-started/semantic-versioning

Tags are a supplement to semver (e.g., v0.12) for organizing and labeling different versions of packages. In addition to being more human-readable, tags allow publishers to distribute their packages more effectively.

Advertising

3.7 - Repository

web/javascript/npm/package.txt · Last modified: 2019/05/11 23:17 by gerardnico