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

Consolidate code generation in newtgenerator #3

Open
rsdoiel opened this issue Feb 8, 2024 · 1 comment
Open

Consolidate code generation in newtgenerator #3

rsdoiel opened this issue Feb 8, 2024 · 1 comment
Assignees
Labels
critical must be done before milestone is complete Refactoring Simplification or reorganizing code and program responsibilty.
Milestone

Comments

@rsdoiel
Copy link
Member

rsdoiel commented Feb 8, 2024

I don't want a sprawling set of tools. Code generation should be done in one program that can return the desired code. E.g. newtgen [CODE_TYPE] [NEWT_YAML_FILE]

@rsdoiel rsdoiel added enhancement New feature or request Refactoring Simplification or reorganizing code and program responsibilty. labels Feb 8, 2024
@rsdoiel rsdoiel added this to the Prototype 2 milestone Feb 8, 2024
@rsdoiel rsdoiel self-assigned this Feb 8, 2024
@rsdoiel rsdoiel pinned this issue Feb 8, 2024
@rsdoiel
Copy link
Member Author

rsdoiel commented Feb 26, 2024

Still evolving what the command line syntax looks like.

newtgen YAML_FILE TARGET [PARAMS]

For generating Postgres+PostgREST configurations we have several file types being generator, "setup.sql" (this should not be checked into your repository), "models.sql" (should be included in a repository), "models_test.sql" (should be included in a repository) and "postgrest.conf" (or similar name, might be included in the repository). E.g.

newtgen app.yaml postgres setup >setup.sql
newtgen app.yaml postgres models >models.sql
newtgen app.yaml postgres models_test >models_test.sql
newtgen app.yaml postgrest conf >postgrest.conf

For the Mustache templates I think a similar approach is called for except the templates would be derived from the CRUD-L operations combined with a model name. In this example the model id is "people".

newtgen app.yaml mustache create people >create_people.tmpl
newtgen app.yaml mustache read people >read_people.tmpl
newtgen app.yaml mustache update people >update_people.tmpl
newtgen app.yaml mustache delete people >delete_people.tmpl
newtgen app.yaml mustache list people >list_people.tmpl

This would keep the existing YAML as is and solve the problem of how a specific project might need to name or organize their source files.

@rsdoiel rsdoiel unpinned this issue Feb 29, 2024
@rsdoiel rsdoiel added the critical must be done before milestone is complete label Feb 29, 2024
@rsdoiel rsdoiel changed the title Consolidate code generation in newtgen Consolidate code generation in newtgenerator Feb 29, 2024
@rsdoiel rsdoiel removed the enhancement New feature or request label Feb 29, 2024
@rsdoiel rsdoiel pinned this issue Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical must be done before milestone is complete Refactoring Simplification or reorganizing code and program responsibilty.
Projects
None yet
Development

No branches or pull requests

1 participant