npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details


  • User packages



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.


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 🙏

© 2023 – Pkg Stats / Ryan Hefner




A CLI tool to rename master branch to main for GitHub repos




Master to Main

A CLI tool to rename master branch to main for GitHub repos.

Quick Start

master-to-main can be installed using either npm or yarn

npm install -g @guardian/master-to-main
yarn global add @guardian/master-to-main

It can then be run as follows

running command...

View all options and help information

$ m2m --help

View installed version

$ m2m (-v|--version)
master-to-main/0.0.0 darwin-x64 node-v14.9.0

It can also be used directly via npx

npx @guardian/master-to-main --help


This tool requires two arguments.

| Argument | Description | | ----------- | -------------------------------------------------------------------------------- | | accessToken | A GitHub personal access token. See the auth section for more details | | repoName | The name of the repository to migrate in the form owner/repository |

This tool can also be run with a number of options. The following table lists them all.

| Option | Short | Description | Default | | -------- | ----- | ----------------------------------------------------------------------------------------- | ------- | | from | -f | The current name of the branch | master | | to | -t | The new name of the branch | main | | force | - | Disable any user prompts | false | | execute | -x | Execute the migration | false | | verbose | - | Output debug logs | false | | guardian | - | Run the guardian specific steps around build configuration. Disable using --no-guardian | true | | issues | - | Open issues for any further changes required. Disable using --no-guardian | true |

As well as this, the --version option can be used to display the current version install and the --help option can be used to display the help information.


This tool is built on top of the oclif library to provide CLI functionality.

It interfaces with the GitHub API to carry out the necessary steps for the migration (more information below). It makes use of the octokit library.


By default, the app runs in dry run mode. This will perform GET requests and log all steps as if they were to be executed. This can be useful both to see how the process works without making changes and to run checks to reduce the chance of encountering an error partway through the process. To execute the change, pass the -x or --execute flag.


Authentication and authorisation is handled using GitHub Personal Access Tokens (PATs). You will need to provide this as the second argument (after the repo name) when you run the tool.

N.B. Treat your tokens like passwords and keep them secret. Consider using environment variables to store tokens during use and remove any tokens that are not in use.

You can create a token from the Developer settings tab within GitHub settings. For public repos, the public_repo scope will suffice. For private repos, the repo scope is needed.

It is recommended that a new token is created specifically for the purpose of running this tool, so that the token can be removed from your account immediately after the process is complete.


The process carries out the following steps in order:

  1. Check if the repository exists (by getting the repo object)
  2. Check that the old branch name exists
  3. Check if the new branch name already exists
  4. Check if the user is an admin (by getting the username from the access token and then calling the get repository permissions for user endpoint)
  5. Get the number of open PRs and check with that user that they're happy to proceed
  6. Rename the branch using the new rename a branch API
  7. Check if a riff-raff.yaml file is present and open an issue if it is (unless the --no-guardian option is passed)
  8. Check for any files that reference the old branch name and open an issue if any exist
  9. Open an issue to cover any (other) build configuration that may need updating


We follow the script/task pattern, find useful scripts within the script directory for common tasks.

  • ./script/setup to install dependencies
  • ./script/start to run the Jest unit tests in watch mode
  • ./script/lint to lint the code using ESLint
  • ./script/test to run the Jest unit tests
  • ./script/build to compile TypeScript to JS

There are also some other commands defined in package.json:

  • yarn lint --fix attempt to autofix any linter errors
  • yarn format format the code using Prettier

However, it's advised you configure your IDE to format on save to avoid horrible "correct linting" commits.