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

Perhaps support cargo-generate #59

Open
Sapein opened this issue Jul 4, 2024 · 4 comments
Open

Perhaps support cargo-generate #59

Sapein opened this issue Jul 4, 2024 · 4 comments

Comments

@Sapein
Copy link

Sapein commented Jul 4, 2024

Perhaps this repo should support cargo-generate, which allows git repositories to be used as a template to bootstrap the repository. This would mean that certain things (such as the project name) could be filled in automatically, and also allows things like a window to be added by default, which has the project's name. This is something I do in my personal template repository.

Furthermore, if cargo generate is used, this also means that the repository can be used as a Project Template by RustRover, which would be nice.

@benfrankel
Copy link

I'm not sure how cargo-generate works, but something like this would be useful. I recently added a shell script for this in my jam template: https://github.com/benfrankel/bevy_jam_template/blob/main/create.sh.

@mockersf
Copy link
Member

mockersf commented Jul 4, 2024

how does cargo-generate integrate with the repo being marked as a template for GitHub? https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository

@Sapein
Copy link
Author

Sapein commented Jul 4, 2024

It wouldn't necessarily integrate or cause any issues, strictly speaking, although github doesn't necessarily seem to integrate with it (which is fair enough).

If someone creates a github repository from the template on Github, they would get a repository that is also a cargo-generate template, and if integration remains basic they would only need to replace instances of things like {{ crate_name }} and/or {{ project-name }} with their project's name (which would have to be replaced with their project's name anyways even without it being changed for cargo-generate). At which point it would cease to be a cargo-generate template.

If someone creates a project using cargo-generate from here, it just creates an entirely new Cargo Project which is disconnected from this, with the things like {{ crate_name }} automatically replaced.

There are also templates which are both a github repository template, and a cargo-generate template (such as https://github.com/9999years/rust-cli-template although it is a bit old).

@janhohenheim
Copy link
Member

janhohenheim commented Jul 17, 2024

bevy_quickstart is using cargo-generate through a dedicated branch. This is working out pretty nicely so far, as the merges are usually trivial, but comes at the cost of having to remember to merge main into the branch regularly. An automated GitHub action would be nice for that.
Note: do not squash your commits into the cargo-generate branch or you'll have to repeat all merge conflict resolutions every time you merge!

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

No branches or pull requests

4 participants