About
Code Shipping - Packaging ( Archive | Container ) in Javascript.
A Package is a distribution format that wraps:
- one or several Module.
- along side the package.json (called a manifest) which describes the package (its version, …)
All packages follow the npm specification and adhere to the package.json semantic.
How to create a package (module): Node - Module (ie NPM Module)
Properties
Id
The unique identifier is its name and version together defined in the package.json
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://[email protected]:isaacs/sax-js.git#cae7b6fb8c
npm install sax@git+ssh://[email protected]:isaacs/sax-js.git#cae7b6fb8c
npm install git+https://[email protected]/isaacs/sax-js.git#cae7b6fb8c
Scope (Private Module)
To create a scoped package, you simply use a package name that starts with your scope.
{
"name": "@username/project-name"
}
See:
Version
Management
Create
Turn the folder into a package by generating a package.json file
yarn init
// or
npm init -y
Installation / Update / Delete
A package can be installed
- Locally. See Local package (for your own module, used with the require expression, npm install's default behavior
- Globally. See Global Package (for the whole OS).
See:
- Internet Package: Node module are available after publication to npm through https://unpkg.com/