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

create-svelte output is missing .gitignore #1036

Closed
GrygrFlzr opened this issue Apr 15, 2021 · 9 comments · Fixed by #1084
Closed

create-svelte output is missing .gitignore #1036

GrygrFlzr opened this issue Apr 15, 2021 · 9 comments · Fixed by #1084
Milestone

Comments

@GrygrFlzr
Copy link
Member

Describe the bug
create-svelte output is missing .gitignore

To Reproduce

npm init svelte@next

Expected behavior
.gitignore is included in the default template

Severity
Oops.

Additional context
Probably got missed by accident when we re-wrote the template to generate the JS version from the single TS version.

@Conduitry
Copy link
Member

Conduitry commented Apr 15, 2021

Should we first ask people whether they want to use Git? (And default to yes.) And if they do, then not only create .gitignore, but also run git init for them? Even if they don't plan on pushing anywhere yet, they can at least see in their editor which files are generated/ignored if the editor grays them out or whatever.

@benmccann
Copy link
Member

I'm not sure I'd want git init run for me. I probably wouldn't realize that had happened and am not sure what happens if you run it twice

@Conduitry
Copy link
Member

It should be pretty much a no-op if you run git init in an already well-formed Git repo.

@benmccann
Copy link
Member

Yeah, looks like basically a no-op. I just tested and it says "Reinitialized existing Git repository"

@rmunn
Copy link
Contributor

rmunn commented Apr 16, 2021

I'd vote no on git init by default because there might be times when I'm creating a new directory in a monorepo or something. But running it after someone says "yes" to the "Do you want to use Git?" question would not be a problem.

However, I think adding too many questions to the template is something to avoid. Instead of asking "Do you want to use Git?" and then running git init for them, I think a better way to help users would to be suggest a series of steps after the template is created. In the template output, suggest running git init . followed by git add . and git commit -m 'Initial commit from template', but don't actually run those commands. That way there's still an easy-to-follow-without-thinking procedure for anyone who wants to use Git, but people who prefer Mercurial or some other solution can still blindly press the Enter key to accept all defaults without ending up with a version control system they didn't want.

@dummdidumm
Copy link
Member

I agree with too many steps being a concern but this step feels important enough for me. It's also the default for create-react-app and the Angular/Vue CLI I think.

@benmccann benmccann added this to the 1.0 milestone Apr 16, 2021
@benmccann
Copy link
Member

For anyone that runs into this issue, you can solve it by copying this .gitignore into your project: https://github.com/sveltejs/kit/blob/master/packages/create-svelte/templates/default/.gitignore

@nico-bachner
Copy link

I agree with too many steps being a concern but this step feels important enough for me. It's also the default for create-react-app and the Angular/Vue CLI I think.

Nuxt also does it that way:

Nuxt.js git setting

However, I think adding too many questions to the template is something to avoid. Instead of asking "Do you want to use Git?" and then running git init for them, I think a better way to help users would to be suggest a series of steps after the template is created. In the template output, suggest running git init . followed by git add . and git commit -m 'Initial commit from template', but don't actually run those commands. That way there's still an easy-to-follow-without-thinking procedure for anyone who wants to use Git, but people who prefer Mercurial or some other solution can still blindly press the Enter key to accept all defaults without ending up with a version control system they didn't want.

Personally, I find the 'select option' method to be a smoother experience than being suggested code to copy & paste.

@Rich-Harris
Copy link
Member

I PR'd this issue without actually reading the thread above — will create a separate issue about git init

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.

7 participants