From e6e2160614c9af320419a599c42211d0147760f4 Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Tue, 19 Jul 2022 14:24:19 +0000 Subject: [PATCH] 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 --- .changeset/lemon-tools-rescue.md | 5 +++++ packages/create-astro/src/index.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/lemon-tools-rescue.md diff --git a/.changeset/lemon-tools-rescue.md b/.changeset/lemon-tools-rescue.md new file mode 100644 index 000000000000..2d8044b61796 --- /dev/null +++ b/.changeset/lemon-tools-rescue.md @@ -0,0 +1,5 @@ +--- +'create-astro': patch +--- + +Fixes support for using templates from any GitHub repository diff --git a/packages/create-astro/src/index.ts b/packages/create-astro/src/index.ts index 839877ab670f..be6c6a6b9e51 100644 --- a/packages/create-astro/src/index.ts +++ b/packages/create-astro/src/index.ts @@ -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,