3
verification hook
Stephan Bönnemann edited this page 2015-05-17 18:54:38 +02:00

If you want to use the verification hook (e.g. for breaking change detection) you can provide your own in the package.json.

Add a release field and provide a path where semantic-release can require your verification hook:

"release": {
  "verification": "./lib/custom-verification"
}

or with extra options:

"release": {
  "verification": {
    "path": "cracks",
    "silent": true
   }
}

The module should export a function that takes an options object and a callback(err, ok) function.

The options object contains the options defined in the package.json release.verification object and some default options:

{
  "path": "cracks",
  "silent": true,
  "type": "minor",
  "commits": [
    {
      "hash": "7ba1cb956f2efc2cd7e34f36cb8358baa09191b0",
      "message": "fix(pre): improved logging\n"
    },
    {
      "hash": "1f70215ffe4ac70669f918dd520aa9c49d6d865b",
      "message": "test(pre): verification hook\n"
    }
  ],
  "version": "3.2.2",
  "nextVersion": "3.3.0"
}

If you want to have an automatic breaking change detection you may use cracks.

Have a look at the verification test hook for a sample implementation.