fix: cordova-fetch with npm@7 - #91
Merged
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #91 +/- ##
==========================================
+ Coverage 92.42% 93.33% +0.90%
==========================================
Files 1 1
Lines 66 60 -6
==========================================
- Hits 61 56 -5
+ Misses 5 4 -1
Continue to review full report at Codecov.
|
This addresses the following changes in behavior. Saved GitHub URL format in package.json: - npm 6: git+https://github.com/apache/cordova-android.git#4.1.x - npm 7: github:apache/cordova-android#4.1.x Empty devDependencies format in package.json: - npm 6: `{}` - npm 7: `undefined`
3 tasks
5 tasks
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
apache/cordova-lib#859
Description
Instead of parsing the installed package's name out of the output of
npm install <spec>(which does not work anymore withnpm@7) we now do the following:npm-package-arg. This is very cheap.pacote.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
pacoteandnpmshare 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
npm@7.Testing
npm@6andnpm@^7.2npm@^7.2(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)
TODO
npm@7uninstallseems to be broken with--no-saveonnpm@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 nowCheck ifMy latest tests show very similar running times. That's good enough for me.pacoteandnpmare 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👎 🤷♂️