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

fix: use custom HTTP server #265

Merged
merged 7 commits into from
Feb 7, 2021
Merged

fix: use custom HTTP server #265

merged 7 commits into from
Feb 7, 2021

Conversation

JustinBeckwith
Copy link
Owner

@JustinBeckwith JustinBeckwith commented Feb 6, 2021

Not quite ready for primetime yet. Fixes #233.

@JustinBeckwith
Copy link
Owner Author

@XhmikosR this is handling everything I've tested it with, including bootstrap. Could I trouble you to give this a shot, and make sure everything looks right? It's a bit of a scary change 😆

@XhmikosR
Copy link
Contributor

XhmikosR commented Feb 6, 2021

I checked out the branch, built it and replaced the local linkinator I had and it seems to work. Nice job!

# 2.11.2
C:\Users\xmr\Desktop\bootstrap>npm run docs-linkinator

> bootstrap@5.0.0-beta1 docs-linkinator C:\Users\xmr\Desktop\bootstrap
> linkinator _gh_pages --recurse --silent --skip "^(?!http://localhost)"

🏊‍♂️ crawling _gh_pages
🤖 Successfully scanned 705 links in 2.981 seconds.

# this branch
C:\Users\xmr\Desktop\bootstrap>npm run docs-linkinator

> bootstrap@5.0.0-beta1 docs-linkinator C:\Users\xmr\Desktop\bootstrap
> linkinator _gh_pages --recurse --silent --skip "^(?!http://localhost)"

🏊‍♂️ crawling _gh_pages
🤖 Successfully scanned 705 links in 3.006 seconds.

C:\Users\xmr\Desktop\bootstrap>

It feels like reinventing the wheel as long as it works fine :)

PS.

  1. still getting some failures on my Windows VM like on CI
  2. do you plan to switch to async/await for fs methods in server?
  3. I would suggest adding a test with a folder with periods
  4. should there be some kind of caching?

@JustinBeckwith
Copy link
Owner Author

Sweet. Looking at these:

still getting some failures on my Windows VM like on CI

Yeah I ran these on my windows machine, and the CLI tests just randomly will take 5 seconds to spawn a process. I have no idea what to do here, but I don't think this is new.

do you plan to switch to async/await for fs methods in server?

Done in the latest build

I would suggest adding a test with a folder with periods

lol good call, done

should there be some kind of caching?

So I thought about this, and no! The crawler caches all responses once it visits a url, so there's no way that you would need to load the same file twice. The cache would never actually get used - one of the many things in a normal static web server that I think it's easy to leave out here, because the only client for these requests will ever be gaxios/linkinator

@JustinBeckwith JustinBeckwith changed the title refactor: use custom server fix: use custom HTTP server Feb 7, 2021
@JustinBeckwith JustinBeckwith merged commit 9b0b206 into main Feb 7, 2021
@JustinBeckwith JustinBeckwith deleted the noserver branch February 7, 2021 00:17
@github-actions
Copy link

github-actions bot commented Feb 7, 2021

🎉 This PR is included in version 2.13.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@XhmikosR
Copy link
Contributor

XhmikosR commented Feb 7, 2021

So I thought about this, and no! The crawler caches all responses once it visits a url, so there's no way that you would need to load the same file twice. The cache would never actually get used - one of the many things in a normal static web server that I think it's easy to leave out here, because the only client for these requests will ever be gaxios/linkinator

Yeah, I wasn't sure if it was needed either, just thought I'd mention it :)

One last thing, it seems this PR introduces a few further CodeQL issues. Not sure if all apply since I don't see all the details yet (when LGTM runs, I should be able to see them, but I don't have access to the security tab). One of them should be easy to fix by escaping any characters like you do elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate failures in twbs/bootstrap
2 participants