Fix #2822: Respect files package content when using file:
dependencies
#8249
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2822
When using
file:
dependencies yarn ignores the files reference in the package.json and copies over the whole folder. This causes all kinds of issues for folks. See #2822 and related for the various ways it plays havok.This change addresses that by checking the package for a files array and if present only copying the files found there, along with the package.json file itself. I did update the broken contributing links mentioned below as well but there is another pr with those changes so I dropped those
Test plan
Added several new tests to
fetchers.js
. For a concrete test and repro see the original issue here: #2822Notes
I'm new to the codebase so I had a few notes/questions.
package.json
? I saw a few examples of this in the git-fetcher so figured it's ok but it seems like I should ask the manifest for its_filename
or something.fs.copy
command to correctly handle sources as files and destinations as directories as is idiomatic but given this is a first PR and that seems core I simply made sure I was copying files to files here.