Sitelet https://web.archive.org/web/20210210085536/https://github.com/github/gitignore/pull/3204
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

Comment out / add note about conflicting gitignore lines #3204

Merged
merged 2 commits into from Oct 24, 2019

Conversation

@karlhorky
Copy link
Contributor

@karlhorky karlhorky commented Oct 15, 2019

Reasons for making this change:

Next.js recently introduced a feature to be able to use the public directory (should not be ignored), which conflicts with Gatsby's generate-only public directory (which should be ignored).

Since the Node.js gitignore file should be unopinionated when it comes to frameworks, I made the decision to move the files out to community/JavaScript. I also did this for Nuxt.js, since this is a similar type of framework.

Links to documentation supporting these rule changes:

Ref (introduction of a new "public" folder in Next.js):
https://nextjs.org/blog/next-9-1#public-directory-support

Ref: #2562 by @rgbkrk
Ref: #3180 by @ImedAdel

If this is a new template:

Alternatives considered:

An alternative would be to by default ignore all of the overlapping build directories (this would not ignore public) and then add a note for Gatsby (potentially with a commented-out line with public on it).

Ref (introduction of a new "public" folder in Next.js):
https://nextjs.org/blog/next-9-1#public-directory-support
@karlhorky
Copy link
Contributor Author

@karlhorky karlhorky commented Oct 15, 2019

Actually, the more I think about it, the more I like the simplicity of my other option - just to comment out public and leave everything in Node.gitignore.

I will change it to this now.

@karlhorky
Copy link
Contributor Author

@karlhorky karlhorky commented Oct 15, 2019

Ok, I have changed it to the second version - a single Node.js gitignore file with all of the frameworks in it (I've also moved over some Nuxt.js things), that ignores only the overlapping items.

The public line is commented out and a note is added above for Gatsby users.

@karlhorky
Copy link
Contributor Author

@karlhorky karlhorky commented Oct 15, 2019

I am also fine with going back to my original solution, in case that is more desirable for the project team.

@karlhorky karlhorky changed the title Remove conflicting gitignore lines, add reference Comment out / add note about conflicting gitignore lines Oct 15, 2019
@karlhorky
Copy link
Contributor Author

@karlhorky karlhorky commented Oct 16, 2019

@shiftkey Added an updated solution here, in case somehow this information got lost in the notifications.

Copy link
Member

@shiftkey shiftkey left a comment

Thanks all!

@shiftkey shiftkey merged commit 2644536 into github:master Oct 24, 2019
@nerdybeast
Copy link

@nerdybeast nerdybeast commented Nov 8, 2019

Ignoring a generic "dist" folder should not have been included in the node js ignore file. That is not unique to Next.js as a lot of projects build to a "dist" folder. I think that's too generic of a folder to be automatically ignored:
image

@shiftkey
Copy link
Member

@shiftkey shiftkey commented Nov 8, 2019

@nerdybeast if you'd like this reverted please open a PR so we can discuss it further

@karlhorky
Copy link
Contributor Author

@karlhorky karlhorky commented Nov 9, 2019

@nerdybeast I would argue that in most cases you will want to ignore the build output in dist - regardless of framework.

I think it's a reasonable default. You're going to need to go through this .gitignore anyway, in case you have special, uncommon requirements.

If this conflicts with some concrete, common use case that I haven't considered, then I would be all for making it optional!

@nerdybeast
Copy link

@nerdybeast nerdybeast commented Nov 15, 2019

@karlhorky you bring up a fair point. I was thinking of few edge cases but I agree we should cater to the majority. Thank you for the kind response!

tokuhira added a commit to tokuhira/gitignore that referenced this pull request Dec 16, 2019
* Remove conflicting gitignore lines, add reference

Ref (introduction of a new "public" folder in Next.js):
https://nextjs.org/blog/next-9-1#public-directory-support

* Improve solution to conflicting files
EffingFancy added a commit to EffingFancy/gitignore that referenced this pull request Feb 23, 2020
* Remove conflicting gitignore lines, add reference

Ref (introduction of a new "public" folder in Next.js):
https://nextjs.org/blog/next-9-1#public-directory-support

* Improve solution to conflicting files
r2pgl added a commit to r2pgl/gitignore that referenced this pull request Mar 15, 2020
* Remove conflicting gitignore lines, add reference

Ref (introduction of a new "public" folder in Next.js):
https://nextjs.org/blog/next-9-1#public-directory-support

* Improve solution to conflicting files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants