Skip to content

fix ATA toplevel dep detection #47164

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

Merged

Conversation

zkat
Copy link
Contributor

@zkat zkat commented Dec 16, 2021

ATA tried to use the _requiredBy field to determine toplevel deps,
but this is not portable. Not only is it unavailable in npm@>=7, but
neither Yarn nor pnpm write this metadata to node_modules pkgjsons.

This patch changes that such that we do the only portable thing: Read
the toplevel package.json itself, collect its dependencies, and then just
take a look at the toplevel node_modules dependencies and filter based
on that.

Fixes: #44130

@typescript-bot typescript-bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Dec 16, 2021
@zkat zkat force-pushed the zkat/portable-typings-installer-filtering branch 2 times, most recently from 10228e6 to f1feb45 Compare December 16, 2021 19:14
@zkat zkat force-pushed the zkat/portable-typings-installer-filtering branch 3 times, most recently from 54b4c3d to f73bf36 Compare January 5, 2022 20:22
@zkat
Copy link
Contributor Author

zkat commented Jan 5, 2022

Alright, this is ready for another look-see :)

Copy link
Member

@minestarks minestarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see scoped package handling too!

ATA tried to use the `_requiredBy` field to determine toplevel deps,
but this is not portable. Not only is it unavailable in npm@>=7, but
neither Yarn nor pnpm write this metadata to node_modules pkgjsons.

This also adds support for ATA acquiring types for scoped packages.

Fixes: microsoft#44130
@zkat zkat force-pushed the zkat/portable-typings-installer-filtering branch from f73bf36 to f50c15a Compare January 7, 2022 17:29
@zkat zkat merged commit 7f189b9 into microsoft:main Jan 7, 2022
@zkat zkat deleted the zkat/portable-typings-installer-filtering branch January 7, 2022 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPM 7 causes ATA to discover too many dependencies
4 participants