Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong starter template description (and typo) #2372

Closed
ohansemmanuel opened this issue Jan 14, 2023 · 6 comments · Fixed by #2413
Closed

Wrong starter template description (and typo) #2372

ohansemmanuel opened this issue Jan 14, 2023 · 6 comments · Fixed by #2413

Comments

@ohansemmanuel
Copy link
Contributor

What?

The following is a rather ambiguous (slightly misleading) sentence as it gives the impression you can take any public Github astro project and start a new project based on it (i.e., copy the files as a "template")

CleanShot 2023-01-14 at 08 51 57@2x

You can also start a new astro project based on an existing GitHub repostory by passing a --template argument to the create astro command.

In reality, this does not seem to be the case.

How?

CleanShot 2023-01-14 at 08 39 04@2x

it appears (as I suspected), the creation from an "existing Github repository" command/description only works with existing starter templates

e.g.,

✅ this works:

npm create astro@latest -- --template satnaing/astro-paper

❌ this does not work:

npm create astro@latest -- --template ohansemmanuel/astrojs-ditch-the-runtime-react 

Suggestion

If the assumption above is correct i.e., this works for existing templates, then it's perhaps worth reconsidering rewording the sentence to:

You can also start a new astro project based on an existing starter template GitHub repostory repository by passing a --template argument to the create astro command.

CleanShot 2023-01-14 at 08 58 12@2x

@delucis
Copy link
Member

delucis commented Jan 16, 2023

Hmm. Interesting I’m not actually clear what the difference between those two repos is that makes one fail, I think theoretically they should both work. It might be the branch name? Noticing that the one that fails uses master instead of main for the primary branch. Wonder if create astro specifically expects to copy from main.

@ohansemmanuel
Copy link
Contributor Author

@delucis you're right. create astro seems to specifically copy from main.

I added a main branch and this worked:

CleanShot 2023-01-16 at 16 46 20

Is this worth documenting? Or perhaps create astro tweaked to copy from the default branch?

@delucis
Copy link
Member

delucis commented Jan 16, 2023

Let me check with the core team. Maybe we can use the default branch in create astro. Feels like a bug to me, but if we can’t fix it, at that point it might make sense to document.

@delucis
Copy link
Member

delucis commented Jan 16, 2023

As a side note, it looks like you can also specify the branch name after a # in the command, e.g.

npm create astro@latest -- --template ohansemmanuel/astrojs-ditch-the-runtime-react#master

It looks like this could be a limitation of the underlying tool Astro uses: https://github.com/unjs/giget/

When parsing the template location, they look for #<branch-name-or-commit-ref> and otherwise default to main: https://github.com/unjs/giget/blob/4c55d188222c4e129e51e4894c0797a4bd7b2149/src/_utils.ts#L35-L44

@ohansemmanuel
Copy link
Contributor Author

It looks like this could be a limitation of the underlying tool Astro uses

That makes sense. It does work with the branch name after a #.

Thanks for the input @delucis - Please feel free to either close this issue or consider a possible next step: documenting this limitation (with a small note after the instructions)

@delucis
Copy link
Member

delucis commented Jan 19, 2023

Opened #2413 to address this. Thanks for raising this issue @ohansemmanuel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants