wrangler-legacy icon indicating copy to clipboard operation
wrangler-legacy copied to clipboard

wrangler generate template support main branch

Open xtuc opened this issue 4 years ago • 5 comments
trafficstars

Instead of default to the master branch we should check for the main branch first or allow the user to provide the branch's name

xtuc avatar Dec 29 '20 12:12 xtuc

Hi @xtuc I've made a pull request for that a couple of month ago, still waiting for it to be acknowledge though. https://github.com/cloudflare/wrangler/pull/1653 Happy to take feedbacks in and help move this forward, that's actually an issue for a template I've made and use for some of my projects.

p-j avatar Jan 02 '21 16:01 p-j

Hi, I'm hitting this while following the docs for durable objects which is using https://github.com/cloudflare/durable-objects-template

$ wrangler --version
👷 ✨  wrangler 1.15.0-custom-builds-rc.2

$ wrangler generate rate-limit-actions https://github.com/cloudflare/durable-objects-template
🔧   Creating project called `rate-limit-actions`...
Error: ⛔   Git Error: failed to find branch `master`                                                                                                     
Error: tried running command:
/Users/jldec/Library/Caches/.wrangler/cargo-generate-0.5.0/cargo-generate generate --git https://github.com/cloudflare/durable-objects-template --name rate-limit-actions --force
exited with exit code: 1

jldec avatar Apr 04 '21 22:04 jldec

see https://discord.com/channels/595317990191398933/799437470004412476/828395478244524082

jldec avatar Apr 04 '21 22:04 jldec

Github actually lets you determine the primary branch automatically, there's no need to hard-code main or master. The latest version of cargo-generate does this automatically:

$ cargo generate --git https://github.com/cloudflare/websocket-template --name websocket
⚠️   Unable to load config file: /home/jnelson/.local/lib/cargo/cargo-generate.toml
🔧   Generating template ...
[ 1/14]   Done: .github/workflows/deploy.yml
[ 2/14]   Done: .github/workflows
[ 3/14]   Done: .github
[ 4/14]   Done: .gitignore
[ 5/14]   Done: .prettierrc
[ 6/14]   Done: CODE_OF_CONDUCT.md
[ 7/14]   Done: LICENSE_APACHE
[ 8/14]   Done: LICENSE_MIT
[ 9/14]   Done: README.md
[10/14]   Done: index.js
[11/14]   Done: package-lock.json
[12/14]   Done: package.json
[13/14]   Done: template.js
[14/14]   Done: wrangler.toml
🔧   Moving generated files into: `/home/jnelson/src/wrangler/websocket`...
✨   Done! New project created /home/jnelson/src/wrangler/websocket

So we just need to update it from 0.5 to 0.11.

jyn514 avatar Nov 10 '21 22:11 jyn514

I am facing the same issue. Can you merge the PR ASAP.

zashraf1985 avatar Nov 17 '21 22:11 zashraf1985

Thanks for suggesting this feature! Wrangler v1 is now deprecated and support is only being provided for critical updates or security concerns. As such, we are closing this issue.

New versions of Wrangler are maintained in the workers-sdk repo. If this is a feature you’d like to see in wrangler v2+, please feel free to report it in the workers-sdk repo. For more info about wrangler v1 deprecation, please check out our blog post.

penalosa avatar Feb 27 '23 16:02 penalosa