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

git-signed

v0.1.3

Published

git commit signing made easy (and enforceable)

Downloads

17

Readme

Logo

GitHub tag npm npm

Why?

Signing your commits ensure:

  1. That your commits cannot be re-edited by someone else (using git commit --amend)
  2. That no one cant impersonate you and try to add commits to a codebase

However, getting started with commit signing is often a tedious process. Many developers still do not sign their commits despite both GitHub and GitLab promoting its use.

Also, without having imported the public key of collaborators on the project, you will not be able to confirm that their commits are indeed signed. This means that locally (either during development or on a CI server), you will likely not have a straightforward way to verify and ensure that all commits in your repository are indeed signed.

git-signed solves both problems by providing a workflow for creating, publishing, and locally syncing GPG keys. It also configures the local repository to automatically sign all commits with the selected key.

Requirements

You will need gpgme installed locally on your machine.

  • Arch Linux: pacman -S gpgme or yaourt -S gpgme
  • Ubuntu: apt-get install gpgme
  • macOS: brew install gpgme

Windows users do not need to install gpgme, we will be using the copy of gnupg that is installed alongside git.

Installation

npm install --save-dev git-signed

Usage

Tutorial

Click here to see our tutorial

In package.json:

{
  "scripts": {
    "collaborator:join": "git-signed --join",
    "collaborator:export-key": "git-signed --export",
    "collaborator:sync-keys": "git-signed --sync",
    "test:commit-signatures": "git-signed"
  }
}

Then, add yourself as a collaborator. This will add a collaborators entry in you package.json file that will be augmented with information about how to fetch your key.

npm run collaborator:join

On GitHub and GitLab PRs, signed commit will have a "verified" badge attached to them.

verified badge

To add your GPG key to GitHub, GitLab, or other systems, export your key.

npm run collaborator:export-key

As collaborators join the project, more collaborators entries will be added to your package.json. You will need to fetch their keys so to see their commits as properly signed.

npm run collaborator:sync-keys

Once you have synced the keys to your localk keyring, you can now test that all commits are indeed signed.

test:commit-signatures

In some cases, you will want to start checking for signed commits only from a certain point in history (for instance, if all previous commits on the project were not signed until this point). Adding a commit short hash to the git-signed command will ignore all previous commits in your commit tree.

{
  "scripts": {
    "test:commit-signatures": "git-signed 86ce8bc"
  }
}

Finally, note that git-signed will only scan commits in the current branch. To scan another branch, simply switch to it, and run git-signed again.

Integrating with Husky

Husky allows for the automated setup of commit hooks. One common use of git-signed is to add a post-commit test to let developers know that they need to sign their work.

{
  "scripts": {
    "precommit": "npm run test",
    "postcommit": "npm run test:commit-signatures",
    "postmerge": "npm install && npm run collaborator:sync-keys",
    "update": "npm install && npm run collaborator:sync-keys"
  }
}

You may find a more complete example in the package.json file of this project.

Repository configuration

repo settings

If you are using GitHub or GitLab, you will need to disable Allow squash commit and Allow rebase commit; this is due to the fact that signed commits would eithet be squashed into an unsigned one, or simply get unsigned.

License

MIT.

Acknowledgements

Git graphic by tnp_sergey_novosyolov from TheNounProject is licensed under CC BY 3.0. Check out the new logo that I created on LogoMaker.com https://logomakr.com/1D6HDT