Publishing Plugins
How to publish your plugin to forgebox.io via CommandBox
So, you've created your new magic, world solving plugin, and naturally, you want to share it with the world. CFWheels uses forgebox.io as a plugins repository. This enables us to our CFWheels application's dependencies, install updates easily via CommandBox and more.
As a plugin author, it's well worth spending a little time setting yourself up to work with forgebox with the minimum amount of effort. Once done, you'll be able to either publish directly from the commandline, or upload to forgebox manually.
This tutorial makes extensive use of CommandBox, GIT and the CFWheels CLI.
Requirements
We strongly recommend always having the latest version of CommandBox.
You'll also want the CFWheels CLI. You can install that in CommandBox via install cfwheels-cli
. This will also update it if you've got an older version installed.
Some scripted commands also require the git CLI, although these are technically optional.
Setup a forgebox user account
If you've not got a forgebox.io account you can either register directly on forgebox or very quickly via CommandBox itself
Once you've got your credentials, you should be good to go.
If you've already got an account, you need to login at least once, which will store an API token for future use:
Ensure you've got a box.json in your plugin root
Forgebox uses your local box.json
- you'll need one! Critical package information like the name of your plugin and the location are stored here. You can create one manually, or you can run:
Ensure you've set some critical box.json attributes
In order for other CFWheels users to quickly identify and install your plugin via the CFWheels CLI, make sure you set the following box.json
attributes - whilst a standard box.json
might only have name, version,author
, we need a little more information. Here's a template to get you started: (replace the values in CAPS)
Your completed box.json
might look something like this:
Using the forgebox staging server (optional)
If this is the first time you've done this, you might want to try the forgebox staging server. That way you can make sure your publishing process is spot on without having lots of unnecessary versions pushed up. You can view the staging server version at http://forgebox.stg.ortussolutions.com/
Remember this configuration will "stick", so make sure you change it back afterwards. (I find once changed, it might not kick in until you reload the CommandBox shell via r
).
Publishing a plugin to forgebox
Both CFWheels CLI and Forgebox are expecting a tagged release with the plugin contents (e.g. zip). So the best way to publish is to...
Navigate into the plugin directory
Ensure that directory is authorized to publish the repo (e.g.
git remote -v
should list your fetch/push endpoints)
Note: Git dislikes nested repos, so it's best to setup a test wheels site specifically for plugin development/deployment. Then
git init
within each plugin directory itself, but not at the root. (e.g./plugins/PluginName/
)
ForgeBox does not store your actual package files like npm, but points to your download location.
The following should happen (again, assuming you have git publish rights from that plugin directory)
Auto increment your version number within box.json
Push updated box.json to forgebox (with new version number + location)
Create a git "Tagged Release" which is basically a zip containing the source files
Once you run this command, you can run forgebox show my-package
to confirm it's there. If you change the slug, a new package will be created. If you change the version, a new version will be added to the existing package.
Adding a new version via publishing scripts
By adding the following block to our box.json
, we can more easily deploy new versions with a single command:
Obviously, you'll need to change location='GITHUBUSERNAME/GITHUB-REPONAME#v
to your repo.
With these in place, once you've committed your changes to your local repository, you can now do:
This will:
Set the package location to include the new version number
Publish to forgebox.io
Push your changes to gitHub (assuming you've set that up)
Publish a gitHub tagged release
This saves you having to manually update the version number too!
Lastly, you can double check it's made it into the plugins list via wheels plugins list
Removing a plugin from forgebox
Likewise, you can unpublish a plugin, but keep in mind people might be relying on your plugin, so don't do this lightly!
Last updated