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

Find yarn dependency package paths via brute force #326

Merged
merged 1 commit into from
Nov 12, 2020

Conversation

jonabc
Copy link
Contributor

@jonabc jonabc commented Nov 4, 2020

Closes #243

After the linked bug had another hit as the underlying issue in #324, I took another look and couldn't find any logical way that made sense to detect yarn package paths under node_modules based on the output from any yarn CLI.

As an alternative, here's a solution that finds and parses every package.json file under node_modules to make a map of all "name@version" => directory pairs. The map is cached so it's at least only evaluated once.

The performance impact isn't too noticeable for small to mid-size projects, but it gets a little more expensive for larger projects. Still, it seems to only take a few seconds for larger projects so it's not too bad.

@jonabc
Copy link
Contributor Author

jonabc commented Nov 4, 2020

/cc @gareth @markphelps 👋 what do you think about this as a solution to #243?

@jonabc
Copy link
Contributor Author

jonabc commented Nov 12, 2020

Moving forward with this solution for now - the yarn source won't work well without this sort of change and the performance hit isn't too bad except for projects with a very large number of dependencies.

@jonabc jonabc merged commit e66a41f into master Nov 12, 2020
@jonabc jonabc deleted the fix-yarn-folder-locations branch November 12, 2020 20:57
jonabc added a commit that referenced this pull request Nov 20, 2020
## 2.14.2
2020-11-20

## Fixed
- Yarn source correctly finds dependency paths on disk (#326)
- Go source better handles finding dependencies that have been vendored (#323)
@jonabc jonabc mentioned this pull request Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Yarn source fails if dependency was installed in a devDependency location
1 participant