git-precommit

1.0.1 • Public • Published

Git Precommit

Execute commands on files that are part of the current commit. This project is an alternative to the usual bash scripts, which obviously won't work on windows machines.

There is also a much shorter version for bash in case your developers don't use windows.

Usage

# run this in your pre-commit hook
./git-precommit path/to/my/config.js

For example: If you are using husky, you need to add this in your package.json:

{
  "scripts": {
    "precommit": "git-precommit precommit.config.js"
  }
}

And don't forget the config file itself:

module.exports = {
  tasks: [{
    // files will be appended to this command
    // e.g.: eslint [file1] [file2]...
    command: "eslint",
    extensions: ["js", "jsx"],
    message: "Linting scripts"
  }, {
    command: "stylelint",
    extensions: /\.s?css/g, // Regex works as well
    message: "Linting stylesheets"
  }],
};

License

MIT, see License.md

Readme

Keywords

none

Package Sidebar

Install

npm i git-precommit

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • marvinhagemeister