-
Notifications
You must be signed in to change notification settings - Fork 25
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
refactor(node): moving to native fetch
#1053
Conversation
@@ -1,4 +1,4 @@ | |||
import type { GroupingObject } from '../../src'; |
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.
GroupingObject
doesn't exist in src/index.ts
!
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.
went through and made a bunch of type fixes in #1056
// We have to explicitly list these config files | ||
// due to the dynamic require in certain envs | ||
"src/config/*.json" |
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.
We haven't had any JSON files on src/config
for a very long time.
@@ -1,4 +1,4 @@ | |||
import type { GroupingObject } from '../../src'; |
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.
went through and made a bunch of type fixes in #1056
## 🧰 Changes Noticed a bunch of type errors when running `npx tsc -p test/` from the `packages/node` directory. Not sure if we should do this typechecking in CI? ## 🧬 QA & Testing Do you notice any errors when running `npx tsc -p test/` from the `packages/node` directory?
🐳 Context
The amount of dependencies we use to make a
fetch
call to both the ReadMe and Metrics APIs is a bit off the rails right now:node-fetch
for the POST request to record a log.api@6
which uses not onlynode-fetch
, by way ofisomorphic-fetch
, but it also usesoas
,@readme/oas-to-har
,fetch-har
,json-schema-to-ts
, but also our OpenAPI definition to make very simple GET requests to retrieve project and version data.api@7
wouldn't be much of a change because that still uses everything listed her butnode-fetch
. The complexity overhead for these two small API calls is a bit much.api@6
also uses a very old version of ouroas
library and the work involved to upgrade that here, without just outright moving over toapi@7
is non-trivial. It's easier to move off it entirely.1So I'm refactoring all of this away.
🧰 Changes
node-fetch
for nativefetch
.fetch
is readily available to us.api
for ReadMe API calls for nativefetch
.json-schema-to-ts
.msw
to the latest release as the v2 release better supports nativefetch
.form-data
as we have access a nativeFormData
API.2multer
too because in the tests it was used it wasn't actually being used.caseless
.@types/har-format
to being a dev dependency as we're only using it for types and aren't exporting anything from it for external use.Footnotes
There's something to be said for dogfooding our own SDK software here but because we are unable to do so in any other SDK language, and
api
is unoptimized due to its design language requiring consulting an OpenAPI definition before every request IMHO it's not worth it for something as mission critical as our Metrics SDKs. ↩Not to mention one that actually follows the
FormData
spec. Don't get me started... ↩