Skip to content

Commit

Permalink
Directly depending on 'gift' library, rather than 'gift-wrapper'
Browse files Browse the repository at this point in the history
  • Loading branch information
mhelvens committed Nov 6, 2017
1 parent 2199957 commit 44d4835
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/gitMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var path = require('path')
var gift = require('gift-wrapper')
var co = require('creed').coroutine
var log = require('./log')
var promisify = require('./promisify')

var gitRoot = findGitRoot()

Expand All @@ -19,10 +20,10 @@ module.exports = co(function * (asBranch) {
if (asBranch) {
branch = asBranch
} else {
branch = (yield repo.branch()).name
branch = (yield promisify(repo, 'branch')()).name
}

var commit = (yield repo.current_commit()).id
var commit = (yield promisify(repo, 'current_commit')()).id

return { branch, commit }
})
Expand Down
10 changes: 10 additions & 0 deletions lib/promisify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = function promisify (obj, method) {
return function () {
return new Promise((resolve, reject) => {
obj[method]((err, val) => {
if (err) return reject(err)
resolve(val)
})
})
}
}
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"cli-color": "^1.1.0",
"commander": "^2.9.0",
"creed": "^1.0.1",
"gift-wrapper": "^1.1.1",
"gift": "^0.10.1",
"klaw": "^1.2.0",
"lodash": "^4.15.0",
"mime": "^1.3.4",
Expand All @@ -22,9 +22,6 @@
"devDependencies": {
"kn-release": "^1.0.1"
},
"resolutions": {
"gift": "^0.10.1"
},
"scripts": {
"test": "standard",
"release": "release"
Expand Down

0 comments on commit 44d4835

Please sign in to comment.