feat(cli): add datasources types to the cli types generate command #370
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds datasource type generation via the CLI.
If the user has already pulled datasources and any component fields are linked to a datasource, the CLI will now use the correct datasource type automatically.
If the user has no datasources pulled yet, the CLI will fall back to a string or number union for those fields.
It also introduces a general export type:
This type represents a union of all universal and content type blocks, allowing users to access all possible content types without maintaining them manually.
Closes #190
Note
Adds datasource-based typing and a
ContentTypeunion to the CLI types generator, with optional datasource loading and component field mapping.packages/cli/src/commands/types/generate):internaldatasource-backed fields to specific datasource types (arrays foroptions), usingdatasource_slug.entriesand include them in compiled output.ContentTypeunion type of all root components.getDatasourceTypeTitlehelper and collect content type blocks during schema build.index.ts):readDatasourcesFiles; merge with components before generating types.packages/cli/src/types/schemas.ts):ComponentPropertySchemawithdatasource_slug.Written by Cursor Bugbot for commit 296b4f1. This will update automatically on new commits. Configure here.