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..85b7d6f27b31 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'; +function getTemplateTarget(tmpl: string, ref = 'latest') { const isThirdParty = tmpl.includes('/'); + if (isThirdParty) return tmpl; + if (tmpl === 'starlight') return `withastro/starlight/examples/basics`; + return `github:withastro/astro/examples/${tmpl}#${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) {