Publishing Packages

❗️

Important!

This page describes the old version of the sdk, see https://community.c9.io/t/distributing-and-installing-custom-cloud9-plugins/15168 for description of current method of loading packages

In order to have others discover and install your plugin as well as provide feedback and contribute you'll want to publish your package to the c9.io registry. This will make your plugin available to all Cloud9 users. They can find and install your plugin.

This guide assumes your package's name is my-package but you should pick a better name.

Use the c9 cli

The c9 cli is pre-installed in all Cloud9 workspaces. When running the SDK locally or for SSH workspace you can install the c9 cli via:

npm install c9

Note that this might not work in the alpha version of Cloud9.

You can check that c9 is installed correctly by running the following command in the terminal:

c9 publish --help

You should see a message print out with details about the c9 publish command.

Prepare your package

If you've followed the steps in the your first package guide then you should be ready to publish and you can skip to the next step.

If not, there are a few things you should check before publishing:

  • Your package.json file has name, description, categories, plugins and repository fields.
  • Your package.json file has a version field with a value of "0.0.0".
  • Your package.json file has an engines field that contains an entry for c9 such as: "engines": {"c9": ">=3.0.0"}.
  • Your package has a README.md file at the root.
  • Your package is in a Git or Mercurial repository that has been pushed to a source control host.

Publish your package

It is important to make sure your package has a unique name. You can use c9 list to see which packages have already been registered. If the initial name you want is not available choose a new one and change the name in your package.

This is what c9 publish does:

  1. Registers the package name on c9.io if it is being published for the first time.
  2. Updates the version field in the package.json file and commits it.
  3. Creates a new Git tag for the version being published.
  4. Pushes the tag and current branch to origin.
  5. Updates c9.io with the new version being published.

To publish run the following command:

cd ~/.c9/plugins/my-package
c9 publish [version]

version can be either a specific version number you’d like it to be (e.g. 0.1.2) or one of the following:

major - Increments the major number (X.0.0) by 1 and publishes
minor - Increments the minor number (0.X.0) by 1 and publishes
patch - Increments the patch number (0.0.X) by 1 and publishes

We use semver versioning for plugins, please follow that guide when deciding what patch level you’re releasing. Plugins with a version < 1.0.0 are considered beta.

If this is the first package you are publishing, the c9 publish command may prompt you for your Cloud9 username and password. This is required to publish and you only need to enter this information the first time you publish.

Congratulations! Your package is now available on c9.io. Check if it's there by running c9 list.