-
Notifications
You must be signed in to change notification settings - Fork 27
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
fix: cordova-fetch with npm@7 #91
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`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
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
pacote
andnpm
share 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@6
andnpm@^7.2
npm@^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@7
uninstall
seems to be broken with--no-save
onnpm@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.pacote
andnpm
are 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👎 🤷♂️