Open Sapein opened 4 months ago
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.
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
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).
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!
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.