Packagecloud logo

Announcing NPM registry support

TL;DR

We are thrilled to announce that you can now upload Node.js packages to your packagecloud repositories! You can upload using npm publish, the packagecloud CLI or the packagecloud API.

The NPM registry support added to packagecloud includes support for scoped Node.JS packages and the Yarn package manager right out of the box, with no additional configuration needed.

 

Features

Automatic proxying from the official NPM registry

When you install a package using npm install, the npm program will automatically attempt to install any dependencies required by the package. If those dependencies are not found in your packagecloud repository, packagecloud will automatically forward requests for those missing dependencies to the official NPM registy. This way you only have to upload your main packages and not have to worry about also uploading their dependencies.

If you would like to only install Node.js packages and their dependencies from your packagecloud repository without relying on the official NPM registry, you can disable automatic proxying by changing the toggle found in your repository’s settings.

NPM proxy support

Note: If you disable this setting, you will then need to upload every dependency for every package you upload to your packagecloud repository, or npm install will fail. Most users will want to leave this setting enabled (the default).

Works with Yarn

Using the popular Yarn package manager? No problem. It works out of the box without any extra configuration.

$ yarn add packagecloud@0.1.0

 

Scoped Package support

Node.js packages can be namespaced by adding what is known as a “scope” to your package name. Doing this allows you to easily create a namespace for packages that should be grouped together.

You can learn more about this feature of NPM by reading the scoped packages documentation available on the NPM website.

Working with scoped Node.js packages using packagecloud is simple! You can use npm publish, the packagecloud CLI or the packagecloud API just as you normally would. packagecloud will detect and properly handle scoped packages, automatically.

You can then install scoped packages from your repository just as you normally would using the npm install command.

For example to install the scoped package @julio/express version 9.1.0, you would run:

$ npm install @julio/express@9.1.0

 

Easy to use

Just like our Java, RPM, Debian, Rubygem and Python support, we automatically infer the necessary metadata right from the uploaded Node.js package. No manual data entry needed!

 

SSL, authentication, IPv6, and private NPM registries

packagecloud supports only HTTPS over both IPv4 and IPV6; there is no plain text HTTP support, whatsoever.

You can create both public and private repositories on packagecloud for storing Debian, RPM, RubyGem, Java, and Node.js packages.

Access to repositories is controlled by issuing read only access tokens. You can read more about our token authentication system in our documentation.

 

Installation instructions

Your customers or colleagues can easily install packages using NPM or Yarn from your repository using our installation scripts and simple instructions.

Install Instructions

 

Served via Fastly CDN

All Node.js packages and registry metadata are hosted on Amazon S3 and served via Fastly’s super fast global CDN.

 

Uploading Node.js packages

You can upload your Node.js packages to your public or private packagecloud repositories using npm publish, the packagecloud CLI or the API.

 

Using NPM publish

No need to learn new workflows, just use npm publish as you always have.

$ npm config set registry https://packagecloud.io/julio/testing/npm/
$ npm login
$ npm publish

 

From our CLI

You need to update your packagecloud CLI to version 0.3.02 (or newer) to upload and delete Node.js packages from the command line.

To upload NPM packages, just run push like so:

$ package_cloud push julio/testing/node packagecloud-0.1.0.tgz

From the Browser

You can also upload release packages with your web browser by clicking “Add a Package” on your repository page.

Upload NPM package from browser

 

Conclusion

packagecloud now has full support Node.js packages and acts as a public or private NPM registry! Use the NPM CLI or update to the latest CLI (0.3.02 or newer) and start uploading your Node.JS packages today.

You might also like other posts...