Skip to content

Replacing hostile with first-party solution - #1734

Merged
williamlark merged 4 commits into
masterfrom
removing-hostile
Sep 30, 2026
Merged

williamlark merged 4 commits into
masterfrom
removing-hostile

Conversation

@williamlark

Copy link
Copy Markdown
Contributor

We used hostile to modify the users hosts entries in the sku setup-hosts command. It's been useful, but it contains a CLI which sku does not need. Since sku only uses hostile for adding entries to hosts and doesn't need all of its more complex logic, we can roll our own implementation pretty simply while fixing a few quirks.

What changed

  • We now only appends lines to the hosts file. It does not change existing lines, comments, tabs or inline comments. hostile rewrote every entry line in the file.
  • No longer replace the IP address on an existing line for an app host. If the hosts file maps an app host to a different IP address of the same version (IPv4 or IPv6), setup-hosts shows a warning. The warning is needed since the existing line may take precedence over the line that sku appends and I don't want to silently overwrite it.
  • Only log lines that are added, rather than saying everything was added every time. If the file already contains all app hosts, it logs a message that says so.
  • sku start now waits for checkHosts to finish before it continues.
  • checkHosts finds hosts on lines that contain more than one host name, for example 127.0.0.1 a.test b.test. Before this change, checkHosts showed a false "not configured" warning for these hosts, unless the host name ended in .localhost.

Setting up new hosts
CleanShot 2026-09-29 at 3 52 23 PM

All entries exist
CleanShot 2026-09-29 at 3 53 05 PM

Conflicting IPs
CleanShot 2026-09-29 at 3 53 40 PM

@williamlark
williamlark requested a review from a team as a code owner September 29, 2026 06:51
@changeset-bot

changeset-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 535987b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
sku Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@askoufis askoufis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Neat! Just one non-blocking suggestion.

Comment thread packages/sku/src/context/hostsFile.test.ts Outdated
@williamlark
williamlark merged commit 9b13197 into master Sep 30, 2026
4 checks passed
@williamlark
williamlark deleted the removing-hostile branch September 30, 2026 01:03
@seek-oss-ci seek-oss-ci mentioned this pull request Sep 30, 2026
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.

2 participants