wrangler-legacy
wrangler-legacy copied to clipboard
Wrangler generate accept a branch option for the template repository
What this PR does:
- introduce a
branchparam to thegeneratecommand to select a branch on the template used - branch param defaults to master
- branch param is passed down to cargo_generate
Context:
- Github default branch has switched from
mastertomain - I've recently created a template here
p-j/worker-eapi-templateI can't install with the current version ofwrangler generatesince the default branch ismainand notmaster: I'm getting the following error fromcargo_generate: Git Error: failed to find branchmaster cargo_generatecan take in abranchparam, which is what this PR use.
Outcome:
Once build & installed, I can successfully run
wrangler generate test-workerwrangler generate my-ts-project https://github.com/p-j/worker-eapi-template --branch=mainwrangler generate my-ts-project p-j/worker-eapi-template --branch=mainthanks to the upgrade of cargo_generate to 0.5.1
It's my first time ever writing some rust so do let me know if I'm not doing things correctly 👨🎓
The tests on windows seems unstable, they were passing before I fixed the update on the README and force pushed it.
I'm running the test suite locally on WSL and everything checks out, I'm unsure why it's not running correctly on the CI.
Thanks for working on this! I'm unsure if defaulting the branch to master is the right approach, especially as you pointed out, Github and other projects are using different default branches. If wrangler generate provides no --branch parameter, can we just default to the project's default branch?
I'd be more than fine with that as well.
Since cargo-generate v0.5.2 it is indeed possible to use the default branch directly instead of defaulting to master.
So it would make sense to take advantage of that and while keeping the --branch parameter to be more flexible and remove the master default.
I've updated the PR to make use of the 0.6.0 of cargo-generate and remove the master default.
Unfortunately, as pointed out by @xortive their latest versions have no binary release.
I've made this change a single commit so it's easy to revert.
This issue has been automatically marked as stale because it has not had recent activity in the last 180 days. It will be closed if no further activity occurs in the next week. Please feel free to comment if you'd like it to remain open, and thank you for your contributions.
I'll see to rebase this and update to latest version of cargo-generate which does provide binaries again
Thanks for creating this PR! Wrangler v1 is now deprecated and support is only being provided for critical updates or security concerns. As such, we are closing this PR.
New versions of Wrangler are maintained in the workers-sdk repo. If you are running into a similar issue with wrangler v2, please report it or create a new PR in the workers-sdk repo. For more info about wrangler v1 deprecation, please check out our blog post.