-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Use npmignore file on fetch #8010
base: master
Are you sure you want to change the base?
Conversation
@@ -87,6 +92,20 @@ export async function fetchOneRemote( | |||
} | |||
} | |||
|
|||
export async function unlinkIgnoredFiles(dest: string): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this! I'm not entirely sure if this is the right place to apply this filter. Could we instead apply this while we unpack so that ignored files are never even written? If we scope it to git dependencies only it shouldn't have an impact on install time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your welcome! Okay, I will work on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, how'd you get on? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey! sorry, i have been super busy, dealing with the conditions that comes with Covid, but I started to working on again
Summary
I created this PR for fix 2090
Normally yarn doesn't use the .npmignore and install unnecessary files to our node_modules In this branch, while fetching process, yarn read the .npmignore file and delete ignored files with respecting the globs.
I added the del package to delete files with respecting globs, on the other hand, the other way was using the fs.unlink with a loop of file list on npmignore. But I am not sure if it lets us do the proccess without any error, for example deleting a directory or files except the ones that wanted to be kept with NEGATE mark
Test plan
I wrote the test on /tests/fetchers.js/ file. You can run it with
alias testnow="node --max_old_space_size=4096 node_modules/jest/bin/jest.js --verbose __tests__/fetchers.js"
(it will only make test of fetchers.js run)