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 🙏

© 2026 – Pkg Stats / Ryan Hefner

convert-to-fork

v1.0.1

Published

Rename origin to upstream, fork the repo via the GitHub REST API (no gh CLI needed), and point origin at your fork.

Readme

convert-to-fork

Turn a clone into a fork setup, in one command — no gh CLI required.

origin   (some-org/repo)     ──┐
                                ├──►  upstream = some-org/repo
origin   (you/repo, new fork) ◄┘     origin   = you/repo (created via GitHub API)

What it does

  1. Renames the current origin remote to upstream.
  2. Calls the GitHub REST API to fork that repo under your account.
  3. Adds a new origin remote pointing at your fork.
  4. Fetches origin (retrying briefly while GitHub finishes provisioning the fork).

Install

npm install -g convert-to-fork

Or run it without installing:

npx convert-to-fork

Use

Inside any git repo whose origin points at a GitHub repo you don't own:

convert-to-fork

That's it — no arguments needed. It reads origin, authenticates, forks, and rewires the remotes.

Auth

You need a GitHub token with public_repo scope (or repo for private repos):

  • Set GITHUB_TOKEN (or GH_TOKEN) in your environment, or
  • Pass --token <token>, or
  • Just run it — you'll be prompted for one (input is masked).

The first time you run it, you'll be prompted for a token once — it's then saved to ~/.convert-to-fork/config.json (mode 0600) so you're never asked again. Update it later with:

convert-to-fork --change-github

Options

convert-to-fork [--ssh | --https] [--token <token>]
convert-to-fork --change-github
convert-to-fork -v

--ssh             Force the new origin to use SSH ([email protected]:...)
--https           Force the new origin to use HTTPS (https://github.com/...)
--token <token>   GitHub token for this run only (not saved)
--change-github   Update your saved GitHub token
-v, --version     Show version and build credit
-h, --help        Show help

By default the new origin uses the same protocol (SSH or HTTPS) as the original origin had.

Token resolution order: --token flag → $GITHUB_TOKEN/$GH_TOKEN → saved token → interactive prompt (saved for next time).

Notes

  • Fails fast and rolls back the originupstream rename if the fork can't be created (e.g. you already own the repo, or auth fails).
  • Refuses to run if an upstream remote already exists, so it never clobbers one you've already set up.
  • Works against GitHub Enterprise hosts too (uses https://<host>/api/v3), based on the host in your existing origin URL.
  • Requires Node.js 18+ (uses the built-in fetch). Zero npm dependencies.

License

MIT