From cbd770d8ae418c076bc91f8f34ec6f6226b71cd8 Mon Sep 17 00:00:00 2001 From: Ritesh Rajput Date: Thu, 28 Mar 2019 16:52:52 +0530 Subject: [PATCH] Fix issue 129 it was not working in windows. git command format was not correct --- lib/tags.js | 20 ++++++++++++++++++-- package.json | 3 ++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/tags.js b/lib/tags.js index 30dfda3..699a297 100644 --- a/lib/tags.js +++ b/lib/tags.js @@ -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} + */ +function runCommand(command) { + return childProcess.exec(command) + .then(result => result.stdout); +} const defaultOptions = { rev: defaultRev, diff --git a/package.json b/package.json index 9bbdedc..6e23b4b 100644 --- a/package.json +++ b/package.json @@ -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": [