Javascript Package - Registry

About

Code Shipping - Registry in Javascript

A registry is:

Articles Related

Properties

Scope

If a scope is associated with a registry:

  • any install for a package with that scope will request packages from the scoped registry
  • any publish for a package name that contains the scope will be published to the scoped registry.
npm config set @myco:registry http://reg.example.com

List

See also: cdn to get a link to the library

CDN

Network - Content Delivery Network (CDN) - Edge computing

Management

Set

Set globally

npm set registry http://localhost:4873

Set for a project

Javascript Package - Package.json has a publishConfig property with:

Example:

{
    .....
    "publishConfig": {
        "registry": "https://your-host:8081/repository/npm-private/"
    }
    ....
}

Set at the command line

  • For one package
// locally for the project
npm install lodash --registry http://localhost:4873
// globally
npm --registry https://your-host:8081/repository/npm-group/ install -g packageName

Command

Publish

To publish

  • Filter the file to publish by adding the files to ignore in .npmignore or .gitignore
  • Be sure to not have the private property
{
   ....
   "private": true, // Prevent every publication
   ....
}
  • Generate a hash from the credential
echo -n 'admin:admin123' | openssl base64
YWRtaW46YWRtaW4xMjM=  # verify that you get the same value (this command can run also on windows and will not give the same result)

Powered by ComboStrap