Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add new type generation #6

Draft
wants to merge 2 commits into
base: feat/refactor-project
Choose a base branch
from

Conversation

louis-pre
Copy link
Member

@louis-pre louis-pre commented Feb 22, 2025

Context

Lots of context here, I can't cover it all in a PR description. Will be discussed with the team.

High level explanation

This PR adds the generateTypes function, it reads a Zapatos schema file and generates a number of typescript type files from it.

Output:

  • A Kysely schema
  • A Knex schema (optional)
  • One type file per table organized in folders per schema
  • One customization file for each configured table (optional)
  • Pgtui bugs reproduction for each configured table (optional)

See this PR for an example of the output (with none of the optional stuff though)

Architecture

  • generateTypes takes a config as parameter that allows the user to customize the generated output.
  • The file-generators folder follows a Nextjs file-based routing style structure. In our case, each "route" is a file generator.
    Following this structure helps document where the generated files will be located and how they'll be named.

@louis-pre louis-pre self-assigned this Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant