/ cordova-fetch Public
fix: cordova-fetch with npm@7 #91
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge.
Motivation and Context
Instead of parsing the installed package's name out of the output of
npm install <spec>(which does not work anymore with
npm@7) we now do the following:
npm-package-arg. This is very cheap.
Both of these libraries are also used by npm itself.
Fetching the manifest can be expensive (e.g. for a git repo spec). But since
npmshare a cache and we always install a package after fetching a manifest anyway, the additional cost should be negligible in our case. Measuring the execution time of this repo's tests on my machine seems to confirm this: the time is roughly the same before and after this PR.
Furthermore this PR makes some adjustments to test expectations to handle minor behavior changes in
(The one that doesn't, is due to npm v7 does not install linked packages dependencies npm/cli#2339 and unrelated to the changes here)
uninstallseems to be broken with
npm@7([BUG] uninstall does not remove --no-save installed package from node_modules npm/cli#2309)
Do something about the test that is failing due to [BUG] uninstall does not remove --no-save installed package from node_modules npm/cli#2309Using fixed npm 7.2 now Check ifMy latest tests show very similar running times. That's good enough for me.
npmare sharing a cache as expected. The test duration increased from 90s to 110–120s with this change. So we are actually spending a bit more extra time than expected.
Maybe replace a few of the unit tests I threw out here