@cloudbolt/xui-packager v1.1.2
CloudBolt XUI Packager
A helper tool called xui for the terminal that creates zip directories and metadata files necessary for turning a production build of a JS app into a XUI package for CMP.
Installation
Use as a global cli tool:
npm install -g @cloudbolt/xui-packagerOr as a dev dependency to use in npm scripts:
npm install --save-dev @cloudbolt/xui-packagerUsage
CLI Interface
Pass arguments like normal command line arguments, either --flag=value or --flag value like xui --source=dist --name=${npm_package_config_xuiName} --exclude=index.html --exclude=vite.svg. They are parsed with minimist
Any argument is valid, but most are ignored. These are the expected ones (all others are ignored):
--name NAMERequired name for the xui's identifier and unpacked directory--id IDRequired CUI Global id in the form ofXUI-xxxxxxxxwhere x is any number or lowercase letter.--vue_source DIRECTORYSource files directory for built vue files. Defaults todist--xui_src DIRECTORYSource for xui files likeviews.pyand others. Defaults toxui/src--additional_files_src DIRECTORYSource for additional files to be bundled into the final zip. Defaults toxui/additional_files--output DIRECTORYWhere the xui gets saved. Defaults toxui/dist--exclude PATHCan be added multiple times. Will ignore listed files in vue source directory (paths should be relative to it)--icon PATHIcon file to add to the zipped XUI and pointed to in the metadata.
In addition, any other argument that's prepended with met gets added to the metadata. Important examples and how the content library or CloudBolt uses them (note the underscores in the keys):
--met_description "TEXT"Content Library Description. Make sure to quote arguments that have spaces in them.--met_label LABELHuman-readable version of the name.--met_version VERSIONXUI version. By default, this is read from the package.json'sversionfield.--met_minimum_version_required VERSIONMinimum CloudBolt version number for the XUI--met_maximum_version_required VERSIONMaximum CloudBolt version number for the XUI--met_last_updated YYYY-MM-DDDefaults to today unless specified--met_inbound_web_hook_dependenciesOptional array of inbound web hook ZIP files that are dependencies for the XUI. ZIP files should be inxui/additional_filesor the custom directory argument provided to--additional_files_src
Paths are relative to the directory in which the command is run (this is the project root if run as an npm script) unless otherwise stated above.
Package.json Interface
As a convenience, you can also supply arguments in a configXui field in package.json that will be read when used in npm scripts. Any arguments passed by command-line will take precidence, so these are good for defaults. They are loaded with load-pkg. Example package.json fragment:
{
...
"configXui": {
"name": "cui",
"id": "XUI-cui12345",
"exclude": ["index.html", "vite.svg"],
"icon": "xui/CUI.png",
"met_description": "Next-Gen Consumer UI.\n\nAn end-user focused interface that brings a modern, responsive, snappy experience to CloudBolt's best-in-class functionality.\n\nCurrently in BETA.",
"met_label": "CUI Beta",
"met_maximum_version_required": "",
"met_minimum_version_required": "2022.4.2",
"met_inbound_web_hook_dependencies": [
"inbound_web_hook_upload_file.zip",
"inbound_web_hook_download_file.zip"
],
},
"scripts": {
...
"makeXui": "xui --met_built_on \"$(date)\""
}
}Development (for maintainers)
How to publish a new version
- Increment the version of the
package.jsonfor this project and do an install to be sure thepackage-lock.jsonis up to date as well.- The command
npm version patchdoes this for you. It creates a git tag too. npm version prepatch --preid betawill make a beta version.npm version custom-versionis also valid.
- The command
- Run the command
npm publish --access publicto publish this version to npm