generate
opentp generate
Section titled “opentp generate”Exports your tracking plan to various output formats.
opentp generate <target> [options]Targets
Section titled “Targets”| Target | Description | Output |
|---|---|---|
json | JSON export | opentp.events.json |
yaml | YAML export | opentp.events.yaml |
template | Custom template | Configured output |
Options
Section titled “Options”| Option | Description |
|---|---|
--root <path> | Project root directory |
--output <path> | Output file path |
--external-generators <path> | Load custom generators |
Examples
Section titled “Examples”Export to JSON
Section titled “Export to JSON”opentp generate jsonCreates opentp.events.json with all events.
Export to YAML
Section titled “Export to YAML”opentp generate yamlCreates opentp.events.yaml with all events.
Custom output path
Section titled “Custom output path”opentp generate json --output ./dist/events.jsonUsing custom generators
Section titled “Using custom generators”opentp generate my-format --external-generators ./my-generatorsOutput Format
Section titled “Output Format”JSON Output
Section titled “JSON Output”{ "version": "2025-06", "generated": "2025-01-10T12:00:00Z", "events": [ { "key": "auth::login_click", "taxonomy": { "area": "auth", "event": "login_click", "action": "User clicks the login button" }, "payload": { "platforms": { "all": { "active": "1.0.0", "schema": { "event_name": { "value": "login_click" } } } } } } ]}YAML Output
Section titled “YAML Output”version: 2025-06generated: 2025-01-10T12:00:00Zevents: - key: auth::login_click taxonomy: area: auth event: login_click action: User clicks the login button payload: platforms: all: active: 1.0.0 schema: event_name: value: login_clickCustom Generators
Section titled “Custom Generators”Create custom generators for any output format:
module.exports = { name: 'typescript', generate: async (events, config) => { // Generate TypeScript SDK return { files: [ { path: 'events.ts', content: '...' } ] }; }};See Custom Generators for details.