Publish packages

This is for:

Developer

Packages are an invaluable developer tool for code discovery and reuse. In this article, we will show you how you can publish your own packages.

Publishing public npm packages

The packages supported by Qubit experiences are by nature npm packages. If you wish to publish a package to the public npm registry, for use in your own experiences, and for others to use, follow the npm guide on How to Publish & Update a Package.

If you want to know more about packages, we recommend reading the npm documentation.

Using a private package scope

Qubit also allows you to publish private packages to our servers, which makes using them in your Experiences particularly easy.

To find out the scopes you can publish to, run qubit scopes. The output will indicate the scopes you have access to.

Warning

When using a private package scope you must make sure you reference it’s full name in the name field in your package’s package.json file, as shown in the following example.

{
  "name": "@my-scope/mypackage",
  "version": "1.0.0"
}

Publishing your package

A publishable package consists of a directory containing at least a package.json file, much like the package.json file in your experiences.

From that directory you can then run:

qubit release

This command is like npm publish, but it does a lot of work for you, authenticating you on the Qubit servers where your package will be stored, and helping you to set, amongst other things, a new version number.

It uses the qubit command-line client.

Once published, the package should be available for use. See Using Packages.