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 🙏

© 2024 – Pkg Stats / Ryan Hefner

labeler

v5.0.0

Published

Easily manage default labels in GitHub repositories.

Downloads

19

Readme

Why?

Because I was sick of always deleting the default labels and uploading my own ones.

How?

By storing custom labels in a labels.json file, deleting the default ones from the repository and uploading those from said file.

Installation

npm install --global labeler

Usage

NAME
    labeler - Label manager for GitHub repositories.

SYNOPSIS
    labeler [OPTIONS]

DESCRIPTION
    Create custom labels on GitHub repositories automatically.
    This CLI helps you organize your GitHub labels by storing them in a 'labels.json' file. You can add new labels through the CLI with the -n flag.
    Whenever you create a new repository, instead of manually uploading your labels, use this CLI to have it done automatically!

OPTIONS
    -b, --bulkUpdate
        Update all repositories under GHE owner organization. Can only be used with a GitHub Enterprise host.

    -c, --config
        Launch interactive CLI to store data into config. Storing empty strings removes data from config.

    -d, --deleteAllLabels
        Delete all existing labels in repository.

    -e, --emptyLabelsFile
        Remove every label from the 'labels.json' file.
    
    -f, --force
        Ignore user confirmation.

    -h, --help
        Display this help page.
    
    -H, --host [HOST]
        Specify host. If not specified uses values in config, else ignores config.

    -n, --newLabel
        Launch interactive CLI to store new labels in the 'labels.json' file.

    -o, --owner [OWNER]
        Specify owner of repository. If not specified uses values in config, else ignores config.

    -p, --path
        Return the path for 'labels.json' file.

    -r, --repository [REPOSITORY]
        Specify GitHub repository name. If not specified uses values in config, else ignores config.

    -R, --resetLabelsFile
        Reset 'labels.json' by overwriting 'labels.json' with the default labels.

    -t, --token [TOKEN]
        Specify personal access token. If not specified uses values in config, else ignores config.

    -u, --uploadLabels
        Upload custom labels to repository. Skips already existing labels.

EXAMPLES
    Delete all labels from the repository and upload custom ones stored under 'labels.json' to the repository:
        labeler -dur Labeler

    Same as above but without the confirmation questions:
        labeler -fdur Labeler

    Delete every label from 'labels.json' and add new labels to it:
        labeler -en

    Using GitHub Enterprise hosts:
        labeler -dur Labeler -H github.yourhost.com
    
    Delete and upload all labels from a GHE organization:
        labeler -dub -H github.yourhost.com

I've tried my best to create a tool for everyone! If you prefer using flags, feel free to run labeler -t [TOKEN] -o [OWNER] -r [REPOSITORY] -du. If you fancy writing less, run labeler -c and save your values. Those will be your default ones (unless overridden by a flag).

labeler comes with some predefined labels, but you can of course use your own. By running labeler -en, you'll start a fresh new file. The path to the file will be in the terminal, in case you prefer to open and edit it with your editor of choice.

Commands

labeler -c

Interactive CLI for the config. Most likely the first command to run. I recommend setting the token and the owner, as they rarely change usually. If you want to remove an entry, simply enter nothing when asked.

  • token: Personal GitHub Access Token. Create one called "Labeler" here with the following permissions: repo and admin:org.
  • owner: Also known as the username. In my case it's Zebiano for example.
  • repository: Name of the repository. As an example, this repo would be labeler. It is not recommended to set this setting as it may cause non-intentional deletions of labels.
  • host: Custom host, useful for GitHub Enterprise Instances. For example github.yourhost.com.

In case you need to access a repository from another owner, simply run the -o [OWNER] flag and the one stored in the config will be ignored.

labeler -n

An interactive CLI to help you add new Labels to the labels.json file. You'll be asked wether you want to start a new file, or add labels to the already existing one. It also shows the path.

  • name: Name of label.
    • Example: Bug :beetle:
  • description: (Optional) Description of label.
    • Example: This is a bug.
  • color: Hex color of label.
    • Example: FC271E

Alternatively, run labeler -en. This way, every label inside the labels.json file will be removed first.

Note: Running labeler -fn will bypass the question, which defaults to "keep file as is".

labeler -fdur [REPOSITORY]

A very specific example, yet the one I think will be the most used. It's assumed that token and owner are set in the config!

  • -f: Ignore user confirmation
  • -d: Delete all labels from repository
  • -u: Upload custom labels to repository
  • -r: Specify the repository

Example: labeler -fdur Labeler

labeler -H [HOST]

In case you're using a custom host (for example a GitHub Enterprise host), use this flag to specify it. You may as well save the host in the config.

Example: labeler -fdur Labeler -H github.yourhost.com

labels.json

This is the file where all your custom labels are stored. Feel free to edit it. Run labeler -p to get the path. Just keep in mind it has to have the following structure:

{
    "labels": [
        {
            "name": "Label name",
            "color": "FC271E",
            "description": "Label Description."
        },
        ...
    ]
}