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-hooks-toolkit

v0.0.2

Published

Git Hooks Toolkit is a lightweight library to simplify the use of git hooks in a collaborative workflow. Git Hooks Toolkit can be used on any git repository and comes with a few added features like branch name, file name and commit message linting.

Downloads

4

Readme

Git Hooks Toolkit

Git Hooks Toolkit is a lightweight library to simplify the use of git hooks in a collaborative workflow.
Git Hooks Toolkit can be used on any git repository and comes with a few added features like branch name, file name and commit message linting.

Installation

NPX

Git Hooks Toolkit can be automatically installed with npx.

npx git-hooks-toolkit --init=maven

Git Hooks Toolkit needs to be wired on each collaborator local repository. Otherwise the hooks won't be automatically executed.

npx git-hooks-toolkit --wire

Manual installation

  • Copy the .git-hooks-toolkit folder in your project.
  • Run the installation script install.sh.
  • Create your config file from the documentation or use a predefined template.
    The installation script needs to be run on each collaborator local repository.

Usage

To configure different scripts to be run you need to place a git-hooks.yml in the .git-hooks-toolkit folder or at the root of your project. You can find configuration templates in the templates folder.

To bypass the hooks for a specific commit add --no-verify to your git command. Example: git commit -m 'yolo' --no-verify
More information on which git command support the --no-verify argument on Git

Set a pre-commit hook

pre_commit: npm run lint && npm run test

The pre-commit hook is run first, before you even type in a commit message. It’s used to inspect the snapshot that’s about to be committed, to see if you’ve forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code. Git

Set a pre-push hook

pre_push: npm run lint && npm run test

The pre-push hook runs during git push, after the remote refs have been updated but before any objects have been transferred. You can use it to validate a set of ref updates before a push occurs. Git

Prevent commits to branches

no_commit_to: 
  branches:
    - master
    - develop
  message: 'Committing to the following branches is not allowed : master, develop'

Lint branch names

branchname_lint:
  regex: '^(develop|main|master|((feature|hotfix)/[a-zA-Z0-9\_]+))$'
  message: 'Commit aborted: branch name does not follow naming convention.'

Lint file names

filename_lint: 
  regex: '^[a-zA-Z\_\.\-]+$'
  message: 'Non-alphanumeric file names are not allowed.'

Lint commit messages

commit_lint: 
  regex: '^(add|fix|remove): .*'
  message: 'Commit message must contain a verb (ex: \"add: awesome feature\").'

Uninstall

NPX

To completely remove git-hooks-toolkit run:

npx git-hooks-toolkit --uninstall

To disable your custom git hooks in the current git repository but keep the git-hooks-toolkit config run:

npx git-hooks-toolkit --unwire

Manual

To completely remove git-hooks-toolkit run the script uninstall.sh.

To disable your custom git hooks in the current git repository but keep the git-hooks-toolkit config run the command git config --unset core.hooksPath.

Alternatives

Husky: https://github.com/typicode/husky

Pre-commit: https://github.com/pre-commit/pre-commit