npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

website-blocker-macos

v0.1.1

Published

Browser-agnostic website blocker for macOS using /etc/hosts with scheduled rules and a launchd daemon.

Readme

Website Blocker for macOS (Node.js)

  • Browser-agnostic, system-wide blocking by editing /etc/hosts.
  • Supports one-off sessions by date/time and recurring daily/weekly schedules.
  • Installs a root launchd daemon that enforces the schedule every minute.

Requirements

  • macOS
  • Node.js 16+ (uses Intl time zone support)

Quick Start

  • Install globally: npm install -g website-blocker-macos (or from this repo: npm i -g .)
  • Create config: website-blocker init-config
  • Add domains and schedules with helper commands (below).
  • Install daemon (requires admin):
    • sudo website-blocker install-daemon --config "$HOME/.config/website-blocker/config.json"

Uninstall the daemon:

  • sudo website-blocker uninstall-daemon

Run once (manual tick) to apply/remove based on current time:

  • sudo website-blocker tick --config "$HOME/.config/website-blocker/config.json"

Show status (no sudo needed):

  • website-blocker status --config "$HOME/.config/website-blocker/config.json"

Config File

  • Default path: ~/.config/website-blocker/config.json
  • Specify another path with --config PATH.

Example (examples/config.example.json): { "domains": ["twitter.com", "news.ycombinator.com"], "sessions": [ {"start": "2025-09-10T09:00:00-04:00", "end": "2025-09-10T17:00:00-04:00"} ], "recurring": [ {"type": "daily", "start_time": "09:00", "end_time": "17:00", "tz": "America/New_York"}, {"type": "weekly", "days": ["Mon","Tue","Wed","Thu","Fri"], "start_time": "09:00", "end_time": "17:00", "tz": "America/New_York"} ] }

Notes:

  • daily/weekly support overnight ranges (e.g., 22:0007:00).
  • If tz is omitted, local system time is used.
  • One-off sessions should use ISO8601 with timezone.

Helper Commands

  • Add/remove domains:
    • website-blocker add-domain twitter.com
    • website-blocker remove-domain twitter.com
  • Add recurring rules:
    • website-blocker add-daily 09:00 17:00 --tz America/New_York
    • website-blocker add-weekly Mon,Tue,Wed,Thu,Fri 09:00 17:00 --tz America/New_York

How it works

  • A launchd daemon runs as root every minute and updates a managed block in /etc/hosts:
    • Between # website-blocker-macos START and # website-blocker-macos END.
    • Domains are redirected to 127.0.0.1 and ::1.
  • When no rule is active, the managed block is removed.

Troubleshooting

  • After changing the config, the next minute tick applies it, or run tick manually.
  • Flush DNS cache if needed: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  • If the daemon doesn’t appear to run, check logs:
    • /var/log/website-blocker-macos.out.log
    • /var/log/website-blocker-macos.err.log

For detailed instructions, see docs/USAGE.md.