Add shorthand for Starlight templates to create astro
(#7993)
* Add shorthand for Starlight templates to `create astro` * Update packages/create-astro/src/actions/template.ts * Update packages/create-astro/src/actions/template.ts --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
parent
4d160fa1e2
commit
315d58f27b
2 changed files with 9 additions and 1 deletions
5
.changeset/dry-pandas-flash.md
Normal file
5
.changeset/dry-pandas-flash.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'create-astro': patch
|
||||
---
|
||||
|
||||
Add support for more Starlight templates
|
|
@ -67,9 +67,12 @@ const FILES_TO_UPDATE = {
|
|||
};
|
||||
|
||||
function getTemplateTarget(tmpl: string, ref = 'latest') {
|
||||
if (tmpl.startsWith('starlight')) {
|
||||
const [, starter = 'basics'] = tmpl.split('/');
|
||||
return `withastro/starlight/examples/${starter}`;
|
||||
}
|
||||
const isThirdParty = tmpl.includes('/');
|
||||
if (isThirdParty) return tmpl;
|
||||
if (tmpl === 'starlight') return `withastro/starlight/examples/basics`;
|
||||
return `github:withastro/astro/examples/${tmpl}#${ref}`;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue