build
Compile your stream/aggregation and realm definitions into a deployable manifesto JSON file.
Usage
bash
iwentsourcing build <src...> [options]| Argument | Description |
|---|---|
<src...> | One or more source entry files |
Options
| Flag | Default | Description |
|---|---|---|
-o, --output <dist> | iwentsourcing-manifesto.json | Output file path |
-t, --tenant <tenant> | default | Tenant name |
-v, --variable <name...> | — | Process only the specified named export(s) from the source file. By default, all exports are processed. |
What It Does
Bundles your stream/aggregation and realm source files using esbuild, executes the bundle to resolve all definitions, and writes the serialized manifesto to the output file. The manifesto contains everything the API needs to register your definitions: event schemas, state schemas, patterns, and versions. See the Manifesto docs for the full structure and breaking-change detection rules.
By default all exports from the entry file are processed. Use --variable to restrict processing to specific named export(s):
bash
# Only process the export named 'todoStream'
iwentsourcing build src/state/export.ts --variable todoStream
# Process multiple specific exports
iwentsourcing build src/state/export.ts --variable todoStream personalTodoAggregationExamples
bash
# Build with default output name
iwentsourcing build src/state/export.ts
# Custom output path
iwentsourcing build src/state/export.ts -o dist/manifesto.json
# CI pipeline usage
iwentsourcing build src/state/export.ts --tenant production -o manifesto.jsonCI/CD Integration
build and upload serve different purposes:
- Use
uploadas the default deployment command — it compiles and sends in one step:
yaml
# GitHub Actions — compile and push to production
- run: npx iwentsourcing upload src/state/export.ts --host $API_URL --tenant production- Use
buildwhen you need to inspect, store, or diff the manifesto, or to validate that your definitions compile correctly without deploying:
yaml
# Build for inspection / artifact storage
- run: npx iwentsourcing build src/state/export.ts -o manifesto.jsonyaml
# Validate-only (no output file needed, just check it compiles)
- run: npx iwentsourcing build src/state/export.ts