Open
Conversation
styfle
reviewed
Dec 16, 2022
| @@ -1,5 +1,6 @@ | |||
| import fetch from 'node-fetch' | |||
| import { load } from 'cheerio' | |||
| import links from './links.json' assert { type: 'json' } | |||
Owner
There was a problem hiding this comment.
I didn't realize this feature is already available
Although it prints a warning every time https://nodejs.org/api/esm.html#json-modules
Owner
There was a problem hiding this comment.
I think we should just call it config.mjs to avoid the warning. The user can't even configure this as its written.
styfle
reviewed
Dec 16, 2022
| const res = await fetch(url, { headers: { 'user-agent': 'npm:links-awakening' } }).catch(e => e); | ||
| const html = res.ok ? await res.text() : null; | ||
|
|
||
| // deal with config cases |
Owner
There was a problem hiding this comment.
Suggested change
| // deal with config cases |
styfle
reviewed
Dec 16, 2022
|
|
||
| // deal with config cases | ||
| for (const link of links.config) { | ||
| if (url.href.includes(link.url)) { // TODO: this check needs precision in url comparison (www vs no www), etc |
Owner
There was a problem hiding this comment.
At the very least, we need startsWith. But we probably need something like this new feature in the future: https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
returns yellow status if: