1.2.9 • Published 5 years ago

ddc-commit-hooks v1.2.9

Weekly downloads
11
License
ISC
Repository
github
Last release
5 years ago

Commit Hooks

CircleCI   codecov   npmVersion

DDC-Commit-Hooks is designed to allow the implementation of pre-defined tasks to be implemented during git hooks. These tasks are intended to maximise code quality.


Install

npm install ddc-commit-hooks --save-dev

Run

To run the package, add the following to your npm scripts:

ddc-commit

this can be followed by the following options :

-preCommit - To run all user defined pre commit hooks

-commitMsg - To run all user defined commit-message hooks

It is recomended to use this package with Husky. Configuration would look as follows:

// .huskyrc
{
  "hooks": {
    "pre-commit": "npm test && ddc-commit -preCommit",
    "commit-msg": "ssc-commit -commitMsg"
  }
}

Configuration

To configure Hooks, create a .commithooksrc file.

// .commithooksrc
{
  "preCommit": {
    "maxFileSize": 2,
    "esLintCheck": true
  }
}

It is also possible to create a commithooks.json to achieve the same result (Note - content in the .commithooksrc file will override commithooks.json)


Options

The following options are available in v1.0.0 :

preCommit

Any of these properties will work inside a preCommit key:

PropertyTypeDefaultDescription
gitlabCiBooleanfalseChecks for the presence of a .gitlab-ci.yml file
circleCiBooleanfalseChecks for the presence of a .circleci directory
esLintCheckBooleanfalseChecks for the presence of a .eslintrc file
maxFileSizeNumber2Max size in mb allowed for any single file
cypressString""Directory of cypress tests if applicable
robotString""Directory of Robot Framework tests if applicable
dotOnlyCheckBooleanfalseSearches test files for .only

commitMsg

Any of these properties will work inside a commitMsg key, and will be run on the users commit message:

PropertyTypeDefaultDescription
globRegex". *"Regex patter to check for in the commit title
maxLineLengthNumber79Set max line length allowed in a commit message
titleLengthNumber25Sets max length for a commit title
1.2.9

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.0.0

5 years ago