-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Removed node-fetch package and used native fetch #619
Conversation
I'd suggest smth like |
@antongolub Thank you for the review. Please correct me If I am wrong. Once I upgrade the node engine field then test cases will work without any node version check but in the case of the Fetch function if a user tries to run the zx with node 16 then we have to print the error(#589 (comment)) message that fetch is not supported so don't we need a check there? |
About |
src/goods.ts
Outdated
$.log({ kind: 'fetch', url, init }) | ||
return nodeFetch(url, init) | ||
export async function globalFetch(url: RequestInfo, init?: RequestInit) { | ||
if (isNodeEighteenOrGreaterThanEighteen) { |
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.
instead of checking version, why not just check if fetch exists?
if ('fetch' in globalThis)
or if (globalThis.fetch)
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.
@midzelis Thank you for the feedback. Updated that condition. Please take a look and let me know if you have any doubts.
90ff479
to
5701517
Compare
Thank you @theothirteen ! I'm do this in this branch and create pr in your repo: theothirteen#1 Chnges:
|
Hello @njfamirm Thank you for the PR and suggestions. The reason why I have added Furthermore, as |
5701517
to
a10f703
Compare
a10f703
to
1f6a3d8
Compare
Thanks for your review @theothirteen
but RequestInfo & RequestInit is built-in in typescript. (you can see this with vscode autocomplete and following type definition) Also if this types not exists, we have build error, but current have no error.
if we want to use fetch on typescript, we must add |
I'm update my pr and resolve conflicts, so ready for rereview |
@njfamirm Totally agree with you but in the initial requirement, it is mentioned that we can drop the DOM lib if we go with the native fetch. That is the reason I have removed the DOM lib. @antonmedv Could you please provide your inputs if we want to keep the DOM lib or not? |
@theothirteen Yes you are right 👍🏻 |
I'd like to drop DOM |
0d4fec9
to
963a5bc
Compare
Whats up? |
7bf67b1
to
1d37b70
Compare
finalizes google#619 relates google#722
finalizes google#619 relates google#722
Resolved in #722 |
Fixes #589 Issue. Option 4 Suboption 1.
Changes