| name | commandbox-package-management |
| description | Use this skill for CommandBox package management: box.json configuration, installing packages from ForgeBox/Git/HTTP/folder, semantic versioning, dependencies and devDependencies, updating packages, lock files, package scripts, private packages, publishing to ForgeBox, creating packages, and code endpoints. |
CommandBox Package Management
Overview
CommandBox is a full-featured package manager for CFML/BoxLang projects. Packages are hosted on ForgeBox and can also be installed from Git, HTTP/S, local folders, S3, or jar files.
box.json — Package Descriptor
Every package has a box.json in its root. Initialize one with:
init
init name="My App" slug=my-app version=1.0.0 author="Your Name"
init --wizard
Full box.json Reference
{
"name": "My BoxLang App",
"slug": "my-boxlang-app",
"version": "1.0.0",
"author": "Jane Doe <jane@example.com>",
"location": "",
"directory": "",
"createPackageDirectory": true,
"packageDirectory": "",
"homepage": "https://example.com",
"documentation": "https://docs.example.com",
"repository": {
"type": "git",
"URL": "https://github.com/org/my-app"
},
"bugs": "https://github.com/org/my-app/issues",
"shortDescription": "A brief description",
"description": "Full description or leave empty and add README.md",
"type": "projects",
"keywords": ["boxlang", "web"],
"private": false,
"engines": [
{ "type": "boxlang", "version": ">=1.0.0" }
],
"license": [
{ "type": "Apache-2.0", "URL": "https://www.apache.org/licenses/LICENSE-2.0" }
],
"dependencies": {
"coldbox": "^7.0.0",
"cbvalidation": "4.x"
},
"devDependencies": {
"testbox": "^5.0.0"
},
"installPaths": {
"coldbox": "modules/coldbox"
},
"ignore": [
".git",
"tests",
"workbench"
],
"scripts": {
"postInstall": "migrate up",
"postUpdate": "migrate up",
"build": "task run workbench/build"
},
"testbox": {
"runner": "http://localhost:8080/tests/runner.cfm",
"verbose": false,
"watchDelay": 1000,
"watchPaths": "/models/**.cfc"
}
}
Reading/Writing box.json Properties
package show
package show name
package show version
package show dependencies
package set name="New Name"
package set version=2.0.0
package set description="My app"
package set keywords="['newKeyword']" --append
Installing Packages
install coldbox
install coldbox@7.0.0
install coldbox@be
install coldbox@7.x
install "coldbox@>6.0.0 <=7.5.0"
install coldbox@~7.1
install coldbox@^7.0.0
install coldbox --noSave
install testbox --saveDev
install
install --production
install coldbox directory=./lib/
install coldbox --verbose
Installing from Different Endpoints
install git+https://github.com/org/my-module.git
install git+https://github.com/org/my-module.git#v1.0.0
install git+https://github.com/org/my-module.git#main
install https://example.com/mypackage.zip
install folder:../my-local-module
install file:/path/to/my-module.zip
install s3://my-bucket/packages/mymodule.zip
install gist:abcdef1234567890
install jar:https://example.com/my.jar
install java:org.apache.commons:commons-lang3:3.12.0
Semantic Versioning
| Range | Meaning |
|---|
* or x | Latest stable |
1.2.3 | Exact version |
^1.2.3 | Compatible: >=1.2.3 <2.0.0 |
~1.2 | Approx: >=1.2.0 <1.3.0 |
>1.5.0 | Greater than |
>=1.0 <=2.0 | Range |
1.2 - 3.2 | Between (inclusive) |
4.x | Any 4.* version |
@be | Bleeding edge (latest including pre-release) |
@stable | Latest stable only |
Dependencies vs devDependencies
install coldbox
install testbox --saveDev
uninstall coldbox
uninstall coldbox --noSave
Updating Packages
update
update coldbox
update coldbox --force
outdated
outdated --verbose
Lock Files
package lock
install --frozen
package lock --force
Package Scripts
Scripts in box.json run automatically at defined lifecycle events:
{
"scripts": {
"preInstall": "echo 'Before install'",
"postInstall": "migrate up",
"prePublish": "task run build",
"postPublish": "echo 'Published!'",
"build": "task run workbench/build",
"test": "testbox run"
}
}
run-script build
run-script test
run-script --list
Lifecycle hooks (auto-fired):
preInstall / postInstall
preUpdate / postUpdate
preUninstall / postUninstall
prePublish / postPublish
onRelease
Artifacts Cache
CommandBox caches downloaded packages locally for offline use:
artifacts list
artifacts clean
artifacts remove coldbox
artifacts list --verbose
Creating and Publishing Packages
package init slug=my-package type=projects
publish
package version patch
package version minor
package version major
publish
Set ForgeBox API Token
config set endpoints.forgebox.APIToken=your-forgebox-api-key
Private Packages
package set private=true
install my-private-package
System Modules
System modules install globally to ~/.CommandBox/cfml/modules:
install commandbox-cfconfig --system
list --system
Managing Versions
package version patch
package version minor
package version major
package set version=2.3.1
package show version