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

validate-commit-msg-regexp

v1.0.1

Published

Set validation rules for commit messages.

Downloads

32

Readme

validate-commit-msg-regexp

MIT License All Contributors PRs Welcome

Declaration

This is a project base on validate-commit-msg. The original GitHub code and npm modules had been deprecated (not quite sure will they reuse the code again or not), but if you are one of the original users and also if you like the project, welcome to play and discuss together.

Demo

Installation

step.1 👉🏻 npm

This module is distributed via npm which is bundled with node and should be installed as one of your project's devDependencies:

npm install --save-dev validate-commit-msg-regexp

Now, you can choose one setting option from below.

step.2 👉🏻 configuration

You can create and specify options in .vcmrc file. It must be valid JSON file.

{
  "types": [
    "feat", "fix", "docs", "style", "refactor",
    "perf", "test", "build", "ci", "chore", "revert"
  ],
  "scope": {
    "required": false,
    "allowed": ["*"],
    "validate": false,
    "multiple": false,
    "regexpMode": false,
  },
  "warnOnFail": false,
  "maxSubjectLength": 100,
  "subjectPattern": ".+",
  "subjectPatternErrorMsg": "subject does not match subject pattern!",
  "helpMessage": "",
  "autoFix": false
}

or... you can specify options in your package.json file. It must be valid JSON file, as well.

{
  "config": {
    "validate-commit-msg": {
      // ... your custom setting here
    }
  }
}

step.3 👉🏻 git hooks

Set this validation mechanism to where ever you want it can collaborate with, like your git hook system. You can read from Recommend Using⬇️⬇️⬇️

Recommend Using

  • husky ⇨ Git hooks made easy. ⭐⭐⭐⭐⭐
// edit package.json
...
{
  "scripts": {
    "...": "...",
    "commitmsg": "validate-commit-msg-regexp",
    "...": "..."
  }
}
...
  • commitizen ⇨ Help you to create a regular commit msg. ⭐⭐⭐
// edit package.json
...
{
  "scripts": {
    "...": "...",
    "commit": "git-cz",
    "...": "..."
  }
}
...
{
  "config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }
}
...

Options

types 🐡

These are the types that are allowed for your commit message. If omitted, the value is what is shown above.

You can also specify: "types": "*" to indicate that you don't wish to validate types.

Or you can specify the name of a module that exports types according to the conventional-commit-types spec, e.g. "types": "conventional-commit-types".

scope 🐙

This object defines scope requirements for the commit message.

  • required ➡ a boolean to define whether a scope is required for all commit messages.

  • allowed ➡ an array of scopes that are allowed for your commit message. You may also define it as "*" which is the default to allow any scope names.

  • validate ➡ a boolean to define whether or not to validate the scope(s) provided.

  • multiple ➡ a boolean to define whether or not to allow multiple scopes.

  • regexpMode ➡ a boolean to define whether or not to validate allowed array with regular expression.

warnOnFail 🦄

If this is set to true errors will be logged to the console, however the commit will still pass.

maxSubjectLength 🐨

This will control the maximum length of the subject.

subjectPattern 🐝

Optional, accepts a RegExp to match the commit message subject against.

subjectPatternErrorMsg 🐧

If subjectPattern is provided, this message will be displayed if the commit message subject does not match the pattern.

helpMessage 🐔

If provided, the helpMessage string is displayed when a commit message is not valid. This allows projects to provide a better developer experience for new contributors.

The helpMessage also supports interpolating a single %s with the original commit message.

autoFix 🐳

If this is set to true, type will be auto fixed to all lowercase, subject first letter will be lowercased, and the commit will pass (assuming there's nothing else wrong with it).

Contributors

| Dylan Yang | | :---: |

This project follows the all-contributors specification. Contributions of any kind welcome 🎉🎉🎉