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

Use LTS Node.js and drop HTTP request dependencies #21

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

Conversation

Zegnat
Copy link
Contributor

@Zegnat Zegnat commented Jul 23, 2023

Node.js has had native fetch for a while now. I would recommend just using the latest LTS release (for all maintenance and security reasons), which also ships with native fetch.

This drops node-fetch (as well as xmlhttprequest that seemed to be unused?) and requires LTS Node.js as the engine.

To make sure everything was still working I also updated tests.js to actually respond correctly. Previously it was not awaiting any of the Promises that were the result of fetch, so it was writing out “All tests passed!” before the requests had even finished.

I think tests.js is still a little undercooked. E.g. I tried adding a Bluesky link to urls that I knew did not exist, and that still passed the test. This because the bsky.link error page actually resolves as an HTTP 200 page with an h-entry. Is this expected?

As the testing is the only thing that does mf2 parsing, I moved the mf2 parser dependency to devDependencies. I am not sure how bsky.link is currently served in production, but to not package microformats-parser I recommend installing dependencies with: npm ci --omit="dev".

Zegnat added 2 commits July 23, 2023 15:22
This includes native fetch(), remove the unnecessary HTTP request dependencies.

Also move the mf2 parser into development dependencies as it is only used for tests, should not ship in production.
Actually wait for the fetches to complete before stating that the tests passed.
@Zegnat Zegnat mentioned this pull request Jul 30, 2023
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.

1 participant