diff --git a/.changeset/chilled-insects-melt.md b/.changeset/chilled-insects-melt.md new file mode 100644 index 000000000000..27e8c7fe5f82 --- /dev/null +++ b/.changeset/chilled-insects-melt.md @@ -0,0 +1,5 @@ +--- +'create-astro': patch +--- + +Add `starlight` template alias diff --git a/packages/create-astro/src/actions/template.ts b/packages/create-astro/src/actions/template.ts index aa0363694862..33a8b7881a92 100644 --- a/packages/create-astro/src/actions/template.ts +++ b/packages/create-astro/src/actions/template.ts @@ -68,11 +68,15 @@ const FILES_TO_UPDATE = { }), }; -export default async function copyTemplate(tmpl: string, ctx: Context) { - const ref = ctx.ref || 'latest'; - const isThirdParty = tmpl.includes('/'); +function getTemplateTarget(template: string, ref: string = 'latest') { + const isThirdParty = template.includes('/'); + if (isThirdParty) return template; + if (template === 'starlight') return `withastro/starlight/examples/basics`; + return `github:withastro/astro/examples/${template}#${ref}`; +} - const templateTarget = isThirdParty ? tmpl : `github:withastro/astro/examples/${tmpl}#${ref}`; +export default async function copyTemplate(tmpl: string, ctx: Context) { + const templateTarget = getTemplateTarget(tmpl, ctx.ref); // Copy if (!ctx.dryRun) {