-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Replace http-client got
with ky-universal
#695
base: master
Are you sure you want to change the base?
Replace http-client got
with ky-universal
#695
Conversation
got
with ky-universal
Remove "type: module" from package.json
966b3aa
to
e6df639
Compare
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, @Haschikeks, nice work.
The unit test probably don't run due to the credentials I use on the action to login into MusicBrainz.
I am more then happy to make you a collaborator @Haschikeks which gives you more control over the repository & GitHub actions.
lib/musicbrainz-api.ts
Outdated
@@ -15,13 +15,11 @@ import { DigestAuth } from './digest-auth'; | |||
import { RateLimiter } from './rate-limiter'; | |||
import * as mb from './musicbrainz.types'; | |||
|
|||
import got, { Options } from 'got'; | |||
import ky, {Options, ResponsePromise} from 'ky-universal'; |
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.
Just keep the code styke
import ky, {Options, ResponsePromise} from 'ky-universal'; | |
import ky, { Options, ResponsePromise } from 'ky-universal'; |
Sorry, I did a wrong test, I thought all was working, but I forgot to recompile. ky-universal is a pure ESM module since version v0.9.0. |
When downgrading to v0.8.2 downgrading I run into errors in the ky module. |
This is because the kv v0.26.0 is a pure ESM module as well. Using v0.25.1 works on my end. It also runs the tests. |
Yet it not really a sustainable solution as these commonjs modules are no longer supported. |
I agree. I'll list possible solutions I see for this problem below.
|
All very good suggestions @Haschikeks.
Pure ESM is nice, but users will complain they cannot get it to work in their CommonJS projects. Yet we choose to do so.
Sure.
I like that is well. At the same time, not all functions are unfortunately clean REST. Hence we need to work with cookies. This would make wiring a HTTP-client a little cumbersome and tricky. I not tracking changes in MusicBrainz API at all, could be that they have better implementations nowadays.
Essentially close to the "do nothing" option, but document this restriction better. I have no strong opinion on the direction. If you want to do more work, and you favor any of the above, I will support you. Are you avoiding the question to become a collaborator @Haschikeks? |
Ah, no I'm sorry, I don't try to avoid it. You already offered me to be a collaborator some time ago. I just took my time to accept the invite. But some time ago I accepted it. (At least thats what I think I did? Github shows me as a collaborator in this issue, so) Regarding how to move on:
For now I would go with this approach until we have a final decisions.
I think we should avoid having 2 packages with the same functionality. But we could think about doing it like
I can have a look at, how such an interface would need to look like and how we could handle the cookies. I'll also check the MusicBrainz-API in regards to the usage of cookies. |
Ah my bad, for some reason I thought you did not. So sorry.
It are essentially the functions in which you see |
84368ca
to
92cf26c
Compare
add "ky-universal" as "got" replacement, to improve browser compatibility
Closes #655