Just an update that we have tightened down the installation and uninstallation algorithm a bit. It is still ForgeBox specific and doesn’t account for nested modules, but that will come in another version We will be documenting this soon in the usage docs that I have already started writing but for now I wanted to put it here for comments and testing.
Also, if you Preside guys see this, these updates mean you should be able to remove the directory property from your box.json altogether. People don’t need to specify a directory either. CommandBox will recognize that it is installing a command and place it in the user/.CommandBox/commands folder automatically.
Also, your package zip file doesn’t need any folders in the root unless they are part of the package. We’re following NPMs convention where the package manager creates the folder automatically to place your package in and the zip file is unpacked right there. That means box.json and all top level files should just be in the root of the zip.
-
Verify the slug against ForgeBox
-
If not found, error
-
Get slug information
-
Using that information, we verify if we have the package in the local cache according to version received
-
Download the package and place it in our artifacts cache according to our convention
-
package-name/version
-
Get descriptor data, if none found, everything is defaulted.
-
Installation Location
-
If directory parameter is provided, use it
-
If directory box.config property is set, then we use it,
-
if type box.json property is set then use the conventions
-
commandbox-commands – placed in user command directory
-
modules – placed in modules directory
-
plugins – placed in plugins directory and createPackageDirectory set to false
-
interceptors – placed in interceptors directory and createPackageDirectory set to false
-
Else CWD
-
Directory Name
-
if createPackageDirectory box.json property is set to false in the target package, the package will be unpacked directly into the install location. These packages cannot be uninstalled since they aren’t contained in a folder of their own.
-
The name of the package is appended to the installation directory by convention
-
Special Exceptions: The following special exception are needed for compatibility with our other installation tools and the lack of versions in ForgeBox. They can be removed later once we update all tools.
-
If the slug matches the internal folder in the root of the package, then we use that for installation
-
If a packageDirectory box.json property is set, then we will override the slug package container name
-
Updating the box.json
-
All dependencies are saved to box.json by default (created if it doesn’t exist).
-
Save as dev dependency with --saveDev
-
Turn off saving with --!save
-
If the package was installed in a dedicated directory, update the installPath property of box.json to store where it was installed to. This makes uninstall possible without forcing conventions on the user.