-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Question] What files should be listed in .gitignore
?
#454
Comments
Edit: I moved the content of my previous comment to the website, which will now be the reference for this answer. What follows is slightly outdated.
So to summarize: If you're using Zero-Installs: .yarn/unplugged
.yarn/build-state.yml If you're not using Zero-Installs: .yarn/*
!.yarn/releases
!.yarn/plugins
.pnp.* |
I don't think you'd want to ignore |
Good point! I've updated my post to reference those. |
This seems like it might be be out of date, my install process is generating more files than are mentioned here: How should the |
I moved the content of my previous comment to the website, which will now be the reference for this answer. To answer you @bbugh, the v2 shouldn't generate a |
Since the list of ignored files could keep changing, maybe there should be a Yarn could conservatively introduce the
I think parsing the .gitignore file and having yarn keep it updated might be the best DX |
I had a question along this as none of the guides I found so far speak about the
I am using zero-installs. |
The |
Ah ok, I think it might have been a residual folder left behind when I just used |
What if we use I'd love to move to Zero-Installs, but my project still has |
Ah looks like |
I'm adapting my publish process to https://yarnpkg.com/features/release-workflow, should |
Sorry, thanks for your response. |
This seems to be a rather complicated setup (many rules, and different versions for pnp/non-pnp versions). It's not a great developer experience for what is "critical path" for people to onboard onto yarn2. To improve the developer experience and increase adoption, wouldn't it be an idea to have a simpler file structure with only one ignore rule that would work for both pnp and non-pnp versions? E.g., something like |
At the very least we certainly could move the install state file into a subdirectory and change the recommended gitignore into: Without zero-install:
With zero-install:
If someone wants to give it a hand, I think it's mostly updating the default configuration and updating the doc (and perhaps adding a test, that would be nice to prevent regressions). |
Is there any danger in recommending the more complete .gitignore for all cases? It’s simpler to have “eternal” config - one less thing to worry about, one less friction/barrier, for people to move to zero-install, and one less thing to explain about .gitignore rules and yarn2.
… On Apr 14, 2021, at 13:47, Maël Nison ***@***.***> wrote:
At the very least we certainly could move the install state file into a subdirectory and change the recommended gitignore into:
Without zero-install:
.yarn/cache
.yarn/local
.pnp.*
With zero-install:
.yarn/local
If someone wants to give it a hand, I think it's mostly updating the default configuration and updating the doc (and perhaps adding a test, that would be nice to prevent regressions).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
There will always be two rules since the concept of zero-install is that you check-in more things in your repository for the benefit of running much less installs than before (sometimes even zero, depending on the dependencies). By necessity those are things that would otherwise be gitignored. |
I see - makes sense.
I guess another thought is whether the zero-install should be more “default" or not. If so, you could perhaps have a rule like this (assuming local and other things could be re-arranged cache/ or some other sub-dir):
.yarn/cache
and with zero-install exclude the directory that contains the stuff zero-install would also check in:
.yarn/cache
!.yarn/cache/modules
It seems to communicate intent quite clearly.
OR - control whether zero-install is used through a config setting that puts the "modules" inside of `.yarn/local/modules` or `.yarn/modules`.
|
Just to note, https://next.yarnpkg.com/getting-started/qa#which-files-should-be-gitignored is missing a mention of |
The |
Shouldn't there be some command line, like Every time I setup a new repo with yarn 2, I have to google, jump to this thread, and then to the yarn website. Also, why doesn't yarn make this simpler? I think about 2-3 lines in gitignore is perfect, the current gitignore is too complicated, hard to remember. Which files should be gitignored?If you're not using Zero-Installs:If you don't know which (zero vs non-zero), choose THIS! .pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions If you're using Zero-Installs:.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions |
See also: See also: yarnpkg/berry#454
See also: See also: yarnpkg/berry#454
See also: See also: yarnpkg/berry#454
See also: See also: yarnpkg/berry#454
Can we please maintain an authoritative, single, not-bikeshedded answer in https://github.com/github/gitignore |
berry
generates many files and directories like.yarn/cache/*
,.pnp.js
. Some of them seem better to be ignored, but I don't know what to ignore.There are no examples in https://github.com/github/gitignore , so we need
.gitignore
example for a project usingberry
.The text was updated successfully, but these errors were encountered: