Skip to content

Refactor Generator#1772

Merged
jribbink merged 17 commits into
masterfrom
jribbink/refactor-generator
Sep 26, 2024
Merged

Refactor Generator#1772
jribbink merged 17 commits into
masterfrom
jribbink/refactor-generator

Conversation

@jribbink

@jribbink jribbink commented Sep 24, 2024

Copy link
Copy Markdown
Contributor

Closes #1774

Description

Most of the work is just reoganizing logic

  • Removed branching logic based on template type in Generator.generate function. This logic was all moved to the TemplateType structs. This helps us generalize a bit better without needing special handling for each new type (i.e. README.md, tests, and anything else in the future.
  • Added a "TestTemplate" for generating tests instead of embedding this logic inside of Contract templates

I feel like this could be potentially abstracted further by breaking the template files themselves out of the generator, but probably out of scope for this PR/unnecessary right now and I think what's been changed in this PR is already an improvement.


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@jribbink jribbink added the Improvement Technical work without new features, refactoring, improving tests label Sep 26, 2024
@jribbink jribbink changed the title Jribbink/refactor generator Refactor Generator Sep 26, 2024
@jribbink jribbink marked this pull request as ready for review September 26, 2024 10:01
@codecov-commenter

codecov-commenter commented Sep 26, 2024

Copy link
Copy Markdown

@chasefleming

Copy link
Copy Markdown
Member

@jribbink You tested this manually with init, generate, and with the custom directory flag in generate?

@jribbink

Copy link
Copy Markdown
Contributor Author

@jribbink You tested this manually with init, generate, and with the custom directory flag in generate?

Yup. No regressions. It fixes some issues in scripts/tx/test templates with missing values as well.

@jribbink jribbink merged commit 5ab1b47 into master Sep 26, 2024
@jribbink jribbink deleted the jribbink/refactor-generator branch September 26, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement Technical work without new features, refactoring, improving tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generalize & refactor project generator utility

3 participants