feat(pre): pass more information to the verification hook

This commit is contained in:
Christoph Witzko 2015-05-12 15:52:47 +02:00
parent 44db677c4a
commit 41c90124f6
2 changed files with 9 additions and 3 deletions

View File

@ -21,7 +21,7 @@
"semver": "^4.3.3"
},
"devDependencies": {
"cracks": "^2.0.0",
"cracks": "^2.0.1",
"github-release-fake-server": "^1.3.0",
"lodash.defaults": "^3.0.0",
"nano-uid": "^0.2.0",

View File

@ -24,11 +24,12 @@ module.exports = function (options, plugins, cb) {
pkg.version = res.version ? semver.inc(res.version, type) : '1.0.0'
var writePkg = function () {
if (!options.debug) fs.writeFileSync(path, JSON.stringify(pkg, null, 2))
if (!options.debug) fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n')
cb(null, pkg.version)
}
if (type === 'major' || !plugins.verification) return writePkg()
if (!plugins.verification) return writePkg()
var opts = {}
if (typeof plugins.verification === 'string') {
@ -38,6 +39,11 @@ module.exports = function (options, plugins, cb) {
opts = plugins.verification
}
opts.type = type
opts.commits = commits
opts.version = res.version
opts.nextVersion = pkg.version
var verification = require(opts.name)
verification(opts, efh(cb)(function (ok) {