feat: add bridgeable build cli
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
# Bridgeable Build
|
||||
|
||||
Shared production build CLI for Bridgeable Components source libraries.
|
||||
|
||||
The source library should contain author-owned files only:
|
||||
|
||||
```text
|
||||
assets/
|
||||
components/
|
||||
sections/
|
||||
styles/
|
||||
tokens/
|
||||
bridgeable.config.json
|
||||
```
|
||||
|
||||
Build tooling, dependency versions, Vite configuration, manifest generation, and artifact packing live here instead of inside each client component repository.
|
||||
|
||||
## Commands
|
||||
|
||||
Validate a source library:
|
||||
|
||||
```bash
|
||||
bridgeable-build validate --source .
|
||||
```
|
||||
|
||||
Build a production `dist` directory:
|
||||
|
||||
```bash
|
||||
bridgeable-build build --source . --out ./dist
|
||||
```
|
||||
|
||||
Pack an existing `dist` directory:
|
||||
|
||||
```bash
|
||||
bridgeable-build pack --dist ./dist --out ./bridgeable-components.zip
|
||||
```
|
||||
|
||||
Build and pack in one CI-style command:
|
||||
|
||||
```bash
|
||||
bridgeable-build publish \
|
||||
--source . \
|
||||
--out ./dist \
|
||||
--artifact ./bridgeable-components.zip
|
||||
```
|
||||
|
||||
## Build Contract
|
||||
|
||||
The CLI preserves the current Bridgeable Components production contract:
|
||||
|
||||
- `styles/global.css` is bundled as the shared global stylesheet.
|
||||
- `*.component.json` files under `components/` and `sections/` are discovered automatically.
|
||||
- Section CSS and JS are emitted as standalone hashed assets.
|
||||
- Component CSS is expected to be imported by global CSS or section CSS.
|
||||
- Component JS is emitted only when it self-registers with `window.initBlock`.
|
||||
- `*.twig` and `*.component.json` files are copied into the output.
|
||||
- Storybook-only files, fixture data, docs, build config, `node_modules`, `.git`, and previous build output are excluded.
|
||||
- Vite emits `manifest.json`, which the WordPress Bridgeable Components plugin uses to resolve hashed asset filenames.
|
||||
Reference in New Issue
Block a user