Skip to content

Commit

Permalink
always trim command output
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Jenkinson committed Jan 27, 2019
1 parent f69bf3e commit e2e71c7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/set-package-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ try {
process.exit(0);

function getCommitNum() {
return parseInt(require('child_process').execSync('git rev-list --count HEAD').toString(), 10);
return parseInt(exec('git rev-list --count HEAD'), 10);
}

function getCommitHash() {
return require('child_process').execSync('git rev-parse HEAD').toString();
return exec('git rev-parse HEAD');
}

function getLatestVersionTag() {
return require('child_process').execSync('git describe --abbrev=0 --match="v*"').toString().trim();
return exec('git describe --abbrev=0 --match="v*"');
}

function exec(cmd) {
return require('child_process').execSync(cmd).toString().trim();
}

0 comments on commit e2e71c7

Please sign in to comment.