Replace usage of NPM CLI with HTTP calls to the NPM Registry.
Created by: varungandhi-src
I will be adding support for credentials in a subsequent PR.
Questions:
-
There is a self-enforced rate limit code; I'm not sure if that's needed? - Resolution: kept self-enforced rate limit -
Naming: is NPMWebClient
fine? I was thinking of naming itNPMHTTPClient
, but that seemed like too many capital letters all at once. - Resolution: Renamed toHTTPClient
. -
Is there a way to expose a dependency for only testing (i.e. expose a type through a package's tests, making it available only to tests of other packages)? I read some SO answers and I don't think it's possible, and decided to put the MockNPMClient
in a separatenpmtest
package, so that I could reuse it in tests in different packages. - Resolution: Kept separatenpmtest
package. -
Should we be making actual NPM API calls in at least some of the tests here? Previously, we weren't making npm
CLI calls; does that consideration change if we're using the API? - Resolution: Added record + replay tests for API calls.