CLI (Command-line Interface)
We offer a CLI tool to simplify and facilitate installation and publishing of modules with the Web Base
. The tool
comes pre-installed as a dependency in the Web Base
.
Commands
To view the commands available, run:
npx cli
The current list of commands are:
We are currently expanding the CLI tool to have a initialization feature, as well as registering all the modules with the tool itself for a better installation experience.
install
Modules that come with web components can be installed using this CLI tool via the "install" command. Running install
for a chosen module will install all its required dependencies (via npm install
), as well as copy out its respective
component source code to your Web Base
, and perform any additional module-specific steps that can be done
automatically.
For example, to install the Incident Management System (IMS)
, run this command:
npx cli install @mssfoobar/ims
At the moment, you need to go to each individual module's documentation to find the appropriate installation command (to
figure out the appropriate package name, such as @mssfoobar/ims
for the IMS
).
In the future, you will be able to browse the available modules to be installed directly within the CLI.
package
The package command is used to help package web modules into an publishable folder, and publish it to the
desired npm
package registry.
You only need this command if you're contributing modules back to our system - please ensure you have read the Modlet Development section before continuing.
- Package Name: This corresponds to your module name, and the folder you place all your module files in (for example see "bar" here)
- Project Name: The name of your project - this is always
aoh
when performing development for AGIL Ops Hub modules (for example see "foo" here). - Web Folder: This is the folder of the web project that you're trying to package.
- package.json: The absolute path to the
package.json
file, which ensures that the package has the necessary dependencies. The manager takes your package.json and constructs its own to ensure that it has the necessary dependencies. - Lib Folder: The absolute path to the lib folder containing all your web components and libraries. The default
assumes it will be in
src/lib/<project-name>/<module-name>
. - Public & Private Route Folders: These are the absolute paths to the public and private route folders - your modules may have API routes that need to be called and these steps allow you to include them in your package. The installation step will later copy these out for the developers, following the same folder structure.
- npm package registry URL: The final steps is to confirm the repository URL for your package - the tool is
currently built to support publishing to
GitHub Packages
.
npx cli pack
If this is successful, there will be a mod folder with all your exported files and folders inside at the root of your directory. This is published to the URL supplied in step 7.
The mod folder is used the publishing step and can be deleted when your package has been published.