Adds back create-astro support for GitHub repos (#3971)

* adding create-astro support for GitHub repos

* chore: add changeset

* nit: adding a comment to document what the fix is doing
This commit is contained in:
Tony Sullivan 2022-07-19 14:24:19 +00:00 committed by GitHub
parent 91e4ba03da
commit e6e2160614
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'create-astro': patch
---
Fixes support for using templates from any GitHub repository

View file

@ -108,7 +108,10 @@ export async function main() {
const hash = args.commit ? `#${args.commit}` : '';
const templateTarget = `withastro/astro/examples/${options.template}#latest`;
// Don't touch the template name if a GitHub repo was provided, ex: `--template cassidoo/shopify-react-astro`
const templateTarget = options.template.includes('/')
? options.template
: `withastro/astro/examples/${options.template}#latest`;
const emitter = degit(`${templateTarget}${hash}`, {
cache: false,