Skip to content

Commit

Permalink
Add shorthand for Starlight templates to create astro (#7993)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
delucis and natemoo-re authored Aug 8, 2023
1 parent 4d160fa commit 315d58f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dry-pandas-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-astro': patch
---

Add support for more Starlight templates
5 changes: 4 additions & 1 deletion packages/create-astro/src/actions/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}

Expand Down

0 comments on commit 315d58f

Please sign in to comment.