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

Use npmignore file on fetch #8010

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

wethil
Copy link

@wethil wethil commented Mar 23, 2020

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)

@@ -87,6 +92,20 @@ export async function fetchOneRemote(
}
}

export async function unlinkIgnoredFiles(dest: string): Promise<void> {
Copy link
Contributor

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.

Copy link
Author

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.

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? :)

Copy link
Author

@wethil wethil Jul 23, 2020

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

@merceyz merceyz added the fixed-in-modern This issue has been fixed / implemented in Yarn 2+. label Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Yarn needs to use .npmignore file when installing from repo
4 participants