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

cargo generate #75

Merged
merged 26 commits into from
Jun 13, 2024
Merged

cargo generate #75

merged 26 commits into from
Jun 13, 2024

Conversation

Buckram123
Copy link
Contributor

This PR aims to make our template cargo-generate friendly.
Asking for a quick glance, before I fix CI/readme etc @CyberHoward
It does make it much more messier and unusable without cargo-generate, so I wonder if that's something we should put into separate repo/branch? It's possible to do search-replace script with rhai for it (supported by cargo-generate as init/pre/post/ generate hook) and keep this repo clean, but don't think it worth the effort

Copy link
Contributor

@CyberHoward CyberHoward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you doing the development of this? I'd like to see a justfile with a command to run the generation into a gitignored folder and then run cargo-check. Preferably the command uses cargo-watch so anytime you do a change in the template it generates and tries to compile.

- name: install cargo-generate
run: cargo install cargo-generate --locked
- name: cargo clippy
run: CARGO_GENERATE_TEST_CMD="cargo clippy --all-features -- -D warnings" cargo generate -d app_name=my_app -d adapter_name=my_adapter --test
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CyberHoward There is cargo-generate --test command that allows to override "test command", I guess that will do the trick,

@Buckram123
Copy link
Contributor Author

How are you doing the development of this? I'd like to see a justfile with a command to run the generation into a gitignored folder and then run cargo-check. Preferably the command uses cargo-watch so anytime you do a change in the template it generates and tries to compile.

Careful search and replace and then check output with clippy/tests/eyes

@CyberHoward CyberHoward merged commit c81ac45 into main Jun 13, 2024
4 checks passed
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.

None yet

2 participants