Skip to content
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

Feat/fetch cjs update #58

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Feat/fetch cjs update #58

wants to merge 5 commits into from

Conversation

eddort
Copy link
Member

@eddort eddort commented Nov 10, 2022

No description provided.

@eddort
Copy link
Member Author

eddort commented Nov 10, 2022

I think these changes should be marked as a major release. How I can mark it correctly?

@eddort
Copy link
Member Author

eddort commented Nov 11, 2022

image
@infloop this error cathed in my local env. what does it means? in the CI all ok.

import fetch, { Response } from 'node-fetch';
import fetch, {
Response,
RequestInfo as RequestInfoDefault,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need RequestInfoDefault here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty messy because of this hack, maybe we can fix the types at the level of our node-fetch-cjs package? Or accept that Url is not supported by the type (we can always call .toString() before)

@@ -45,7 +45,7 @@
"@nestjs/core": "^8.2.5",
"@nestjs/testing": "^8.2.5",
"@types/lodash.snakecase": "^4.1.6",
"@types/node-fetch": "^2.5.12",
"@types/node-fetch": "^2.6.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The declared dependencies are: @lido-nestjs/fetch, node-fetch, @types/node-fetch, but uses the @lido-js/node-fetch-cjs module

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should leave only @lido-nestjs/fetch and try to import types from it where possible

packages/fetch/src/fetch.service.ts Outdated Show resolved Hide resolved
Comment on lines +63 to +65
// node-fetch v3 lose the naive polyfill URLLike
// I add it in the fetch interface
// The reason is TS can't handle abstraction with .toString getter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest rewriting the comment to disclose what the code does, not how it appeared here

import fetch, { Response } from 'node-fetch';
import fetch, {
Response,
RequestInfo as RequestInfoDefault,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty messy because of this hack, maybe we can fix the types at the level of our node-fetch-cjs package? Or accept that Url is not supported by the type (we can always call .toString() before)

@@ -116,7 +116,7 @@ describe('Data fetching', () => {

await expect(fetchService.fetchJson(url)).rejects.toThrow(HttpException);
await expect(fetchService.fetchJson(url)).rejects.toMatchObject({
message: 'Internal Server Error',
// message: 'Internal Server Error', TODO: why this text showed in the prev version?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO is left here

packages/fetch/test/fetch.spec.ts Outdated Show resolved Hide resolved
href: string;
}
// node-fetch v3 lose the naive polyfill URLLike
// I add it in the fetch interface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest rewriting the comment to disclose what the code does, not how it appeared here

@avsetsin
Copy link
Contributor

I think these changes should be marked as a major release. How I can mark it correctly?

We use semantic release in this repo. https://github.com/semantic-release/semantic-release#commit-message-format
So you need to add BREAKING CHANGE: in your commit message body

eddort and others added 2 commits November 21, 2022 18:31
Co-authored-by: avsetsin <mail@sjors.ru>
Co-authored-by: avsetsin <mail@sjors.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants