Into The Box Notes: Thinking Modularly - Brad Wood
what’s a package?
1. a folder
2. box.json file
3. some code
doesn’t have to be a full blown app.
could be a single UDF, an entire CMS, something in between, etc.
what’s a module?
a super set of what a package is
a package w/ additional conventional lifecycle methods defined by ModuleConfig.cfc
an Ortus convention
an advantage over Node.js
Node modules just sit in a folder
box modules have a lifecycle and can DO things.
simply by existing in the /modules folder
installing packages / modules —
all the Ortus packages
other packages from people in the community
don’t have to log in
free and easy to use
if you want to publish, you’ll need a login, but it’s free
categories for various types of packages
ForgeBox also has a REST API
to make an account from Commandbox on ForgeBox:
box forgebox register
forgebox login — logs you in
stores an api key internally in CommandBox
doesn’t send your password, sends an API key that can be revoked/generated
so it knows which things you have access to
package list —
lists dependencies in that package
CommandBox can install packages from anywhere, not just ForgeBox
as long you have an accessible url, you’re good
make a zip, put the code and box.json inside it, that’s all you need to do.
other fun stuff too
Package Dependencies —
packages can depend on other packages
only required for hacking on the project, not for running it in production
install testbox —saveDev
if you forget to do the —saveDev:
just do “uninstall textbox” then redo “install testbox —saveDev”
Let’s create a package!
CommandBox manages the /modules folder
YOU manage the /modules_app folder
Use semantic versioning to note when you change things in your package