unified-cli
v0.5.37
Published
UnifiedReact is a low-code app builder environment, allowing for a single application runtime across multiple frontend projects.
Readme
Unified React
UnifiedReact is a low-code app builder environment, allowing for a single application runtime across multiple frontend projects.
UnifiedReact can be deployed using Terraform, to any AWS account (see deploy/ONBOARDING.md for setting up a new client deployment, including its DNS). The frontend and backend projects should be deployed once on a particular AWS/cloud account, and can be used to create any number of applications all running on serverless infrastructure.
unified-cli
Usage: yarn unified-cli [command] Commands Supported:
Deploy an application available in the 'applications' folder.
Run at local (debug)
1. Setup environments
yarn install
yarn build:debug && cd dist && npm i && npm link && cd ..2. Start application
cd frontend
unified-cli start <application_name> [port]Dependencies are resolved locally against the npm registry, using the same resolver as the server's CPM.
unified-cli install <application_name> works the same way.
Component packages
A component's npm packages are not listed in its config.json: unified-cli derives them from its imports (an
esbuild metafile) on deploy, install and start. Their versions are kept once per project, in the packages
map of unified-react.json next to components/ (frontend/unified-react.json for base), then UR's core
(core/constants.js CORE_DEPENDENCIES):
{ "packages": { "keen-slider": "^6.8.6", "react-markdown": "^9.0.1" } }When a component starts importing a package that isn't there yet, the next install / deploy / start adds it
with the version installed in the repo (node_modules, else package-lock.json) and prints what it added. Otherwise:
unified-cli package add <name[@range]>, package remove <name>, package why <name>, package init [--strip]
(create the map from an existing project's config.json files and remove theirs). A package loaded without an import
esbuild can see goes in the component's extraPackages: ["name"]. An application's dependencies only needs its own
extras: unified-cli package clean <application> --server <server> trims the rest (it changes the bundle, so deploy
and check). Design: docs/design/component-libraries.md §4 and "Phase 1 as built".
Applications that use studio need a unified-react server for dependency bundles: add --server <server>
(e.g. --server https://app.example.com). --server can also be passed to any start/install to resolve via
that server's CPM (<server>/cpm) instead of locally. To develop against a local CPM, run
node backend/lambda/cpm/local.js and use --server http://localhost:3002.
3. Start studio
Run setup once:
yarn setup:studio <your_domain>EG
yarn setup:studio danhvu.hosted-app.cloudStart studio and sign-in:
yarn start:studioDeploy to AWS
unified-cli deploy <server> application <appplication_name>Deploy with minify option
unified-cli deploy <server> application <appplication_name> -mOR
unified-cli deploy <server> application <appplication_name> -minifyDeploy with sourcemap
unified-cli deploy <server> application <appplication_name> -sm=linked|external|inline|bothOR
unified-cli deploy <server> application <appplication_name> -sourcemap=linked|external|inline|bothCustom domains
unified-cli domains <server> <application> [status|add|takeover|retry|verify|remove] [domain]status (the default) lists the application's custom domains in this environment with their provisioning steps and
the DNS records still to add (details: docs/custom-domains.md). For a
subdomain handed to UR (NS records) it also shows UR's zone and its four NS records, looks up from your computer
whether the parent domain's nameservers hand the subdomain to them, and says what to fix. --no-dns-check skips that
lookup and shows the server's last check instead.
Deploy a component available in the 'components' folder.
deploy component component-name,...
The component's studio icon (config.json icon)
A component's config.json can give the icon studio shows for it in the Elements palette, Layers and the inspector.
icon is one of:
- SVG markup, when its trimmed text starts with
<: the inside of a 24 x 24 line icon drawn in the text colour with a 1.5 stroke, for example"<rect x=\"3\" y=\"7\" width=\"18\" height=\"10\" rx=\"2\"/>". Only plain shapes are kept (path,rect,circle,ellipse,line,polyline,polygon,gand their geometry): no colours, fills, styles, links, images or scripts. - an icon name: a Material Symbols name such as
smart_button, orset:namesuch asmaterial-rounded:homeorcustom:logo(lower case letters, digits,_and-; pattern^([a-z0-9-]+:)?[a-z0-9_-]+$). Studio doesn't draw icon names yet, so for now they show the generic element icon.
Anything else, or no icon, shows the generic element icon.
Start a local UnifiedReact server
unified-cli start application-name [port]