Try to get minTypeScriptVersion-compatible dependencies#121
Try to get minTypeScriptVersion-compatible dependencies#121sandersn merged 2 commits intomicrosoft:masterfrom
Conversation
| const dt = await getDefinitelyTyped(options, log); | ||
| await parseDefinitions(dt, nProcesses ? { definitelyTypedPath, nProcesses } : undefined, log); |
There was a problem hiding this comment.
This is expensive and unnecessary when testing all packages, which is why it wasn’t here before.
There was a problem hiding this comment.
👍 That line (parseDefinitions()) is easy enough to ax, however it looks like it's needed in order to get the minTypeScriptVersion of each package?
There was a problem hiding this comment.
Ah, I see. If that’s the case then it’s probably worth it. From the description I thought you were consolidating just for code reuse, so I wanted to be clear that there’s a pretty big performance tradeoff.
There was a problem hiding this comment.
I could get the minTypeScriptVersion a lot more efficiently than by calling parseDefinitions(), but on the other hand testing all packages is already an expensive operation. Like off the top of my head it currently takes about a couple hours, of which +/- 60 seconds is spent in parseDefinitions()? How does this optimization pay off?
There was a problem hiding this comment.
Yeah, you’re right. My bad 👍
|
I want to make sure this makes sense to @sandersn first |
|
Absolutely, thanks for your help 👍 |
We'll be testing the types with
minTypeScriptVersion(moduloonlyTestTsNext) so make an effort to get compatible external dependencies by adding the--tag ts${minTypeScriptVersion}option tonpm install. If a dependency provides such a tag then we'll get that compatible version. If not, well, we'll continue to get the current behavior.This adds the
--tagoption toprepareAffectedPackages()(trivial) andprepareAllPackages(), which previously used separate logic to crawl the types directory and bypassed@definitelytyped/definitions-parser. Adding the--tagoption means reading theminTypeScriptVersion, so I madeprepareAffectedPackages()andprepareAllPackages()share the same logic. I think this is desirable: You should get the same per-package behavior regardless ofonlyRunAffectedPackages?