@flexacms/cli
v0.3.1
Published
Generate TypeScript types from your Flexa CMS content models.
Maintainers
Readme
@flexacms/cli
Generate TypeScript types from the content models of your Flexa workspace.
FLEXA_API_KEY=flx_... npx @flexacms/cli generate --out src/flexa.d.tsThe file contains one <Entity>Values interface per content model and a FlexaSchema map. Pass it to any Flexa SDK:
import type { FlexaSchema } from './flexa';
const flexa = createClient<FlexaSchema>({ url, apiKey });Field types map to their API values: translatable fields become Localized<T>, selects become unions of their options, repeaters become arrays of typed items, relationships become ids, and optional fields are | null. Run the command again whenever a content model changes.
| Option | Default |
| ------- | ------------------------------- |
| --url | $FLEXA_URL, then https://flexacms.com |
| --key | $FLEXA_API_KEY (Read ability) |
| --out | flexa.d.ts |
