Overview
The CLI tool needs to be able to upload code components from a local codebase. This means sending their data with POST to the /api/v0/config/js_component endpoint.
→ See: #3525571: [Meta] CLI tool for code components
Proposed resolution
- Implement this command using the implementation as a reference from the POC: https://github.com/lauriii/experience-builder-cli/blob/main/src/commands.... Use
@clack/prompts. - Read the location for your local directory for components from an environment variable or
.envfile established in #3525579: Implement client credentials flow in CLI, centralize managing config. - Component format:
my-component/ ├── component.yml # Component metadata and configuration ├── index.jsx # React component source ├── index.css # Optional CSSThe
component.ymlfile can match the shape of the data the/api/v0/config/js_componentendpoint works with — excluding the JS and CSS source/compiled code. - Allow users to select components interactively or passed as a CLI argument. Make sure there is an option to select all.
- Upload the CSS source for the global asset library (
/api/v0/config/xb_asset_library/global) reading it from theglobal.cssfile located in the local folder for components. - Out of scope: compiling and uploading compiled JS/CSS.
Issue fork experience_builder-3525587
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- cli-upload
changes, plain diff MR !1148
- 3525587-cli-command-to
compare
Comments
Comment #3
hooroomooComment #7
balintbrews