Add 'starlight' as template alias (#7277)
* feat(create-astro): add starlight as template alias * chore: lint
This commit is contained in:
parent
c64dfdd3d8
commit
229affca40
2 changed files with 12 additions and 3 deletions
5
.changeset/chilled-insects-melt.md
Normal file
5
.changeset/chilled-insects-melt.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'create-astro': patch
|
||||
---
|
||||
|
||||
Add `starlight` template alias
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue