Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions lib/tags.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
// Packages
const semVer = require('semver');
const taggedVersions = require('tagged-versions');

const defaultRev = 'HEAD --first-parent `git rev-parse --abbrev-ref HEAD`';
const childProcess = require('child-process-promise');

let defaultRev = 'HEAD --first-parent ';

runCommand('git rev-parse --abbrev-ref HEAD').then((output) => {
defaultRev += output;
})

/**
* Run shell command and resolve with stdout content
*
* @param {string} command Shell command
* @return {Promise<string,Error>}
*/
function runCommand(command) {
return childProcess.exec(command)
.then(result => result.stdout);
}

const defaultOptions = {
rev: defaultRev,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"semver": "5.5.0",
"tagged-versions": "1.3.0",
"then-sleep": "1.0.1",
"update-check": "1.3.2"
"update-check": "1.3.2",
"child-process-promise": "^2.1.3"
},
"eslintConfig": {
"extends": [
Expand Down