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-grapnel

v1.0.1

Published

A collection of useful git hooks written in Bash.

Downloads

13

Readme

License Latest release

This is a collection of custom git hooks.

Features

  • Automatically lint any modified files before committing
  • Smart spellchecking of commit messages
  • Can enforce the Conventional Commits specification
  • …and more!

Note: even thought these scripts can be configured to a certain degree, they can't possibly cover all existing use cases, and thus are meant more as blueprints and sources of inspiration rather than comprehensive solutions.

Installation

Clone the repo or download the scripts from the latest release, and make sure they're executable (chmod +x <scripts>).

For a single git repo

Place the scripts in a folder named hooks inside the .git directory of that repo.

For every git repo on a machine

Ensure the scripts are in your PATH so that git can execute them.

Then point the core.hooksPath config option to the folder containing the scripts, e.g. if they're stored in ~/.git-grapnel:

git config core.hooksPath ~/.git-grapnel

External dependencies

Some of the scripts use external tools to accomplish their tasks, so make sure you install them too:

  • jq to parse JSON data
  • aspell to spellcheck commit messages

Usage

Each of the hooks can be bypassed by calling its git command with the --no-verify option.

All the features are disabled by default, and each on can be enabled and configured by setting some environment variables (GIT_GRAPNEL_*).

pre-commit

This hook is run whenever committing to a repo.

Setting GIT_GRAPNEL_LINT_ON_COMMIT to 1 will enable the automatic linting of modified source files. The commit will be cancelled if any errors or warnings are produced.

commit-msg

This hook is run whenever committing to a repo.

Setting GIT_GRAPNEL_COMMIT_MSG_FORMAT to one of the following values will enforce that particular format for commit message:

  • basic: the message must start with a capital letter and not end with a full stop
  • conventional-commits: the message must conform to the Conventional Commits specification

It can also:

  • spellcheck the commit message and highlight possible typos (GIT_GRAPNEL_SPELLCHECK)
  • convert pairs of single quotes ('') into a single back quote — useful when you surround the message in double quotes on the command line (GIT_GRAPNEL_CONVERT_SINGLE_QUOTE_PAIRS)
  • automatically add a corresponding emoji at the start of Conventional Commits messages (GIT_GRAPNEL_ADD_EMOJIS)

pre-push

This hook is run whenever pushing to a remote.

Setting GIT_GRAPNEL_PRE_PUSH_CHECKS to 1 will automatically lint the codebase and run the testing scripts present in package.json, and abort the push if any of them fail.

post-merge

This hook is run after a successful merge.

Setting GIT_GRAPNEL_AUTO_INSTALL to 1 will reinstall the Node modules as needed to keep them in sync with package-lock.json.

Contributing

Contributions are welcomed! Please open an issue before submitting substantial changes.

Related

License

ISC