Skip to content

Commit

Permalink
change parameter to be more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
JTMCaplin committed Jun 3, 2019
1 parent 2000a2d commit 05466c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions caplin-versioning/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function getCommitCount() {
return execSync("git rev-list --count HEAD", execOptions).trim();
}

function getBranchDescriptor(defaultBranchName = "master") {
function getBranchDescriptor(dontAppendBranchName) {
let stdout;

// This approach to generating a version relies on the project being stored
Expand All @@ -38,11 +38,11 @@ function getBranchDescriptor(defaultBranchName = "master") {
// To prevent a trailing `-` being suffixed to the version if a
// `branchDescriptor` is available we prefix the descriptor with `-` if it
// exists else return a blank string.
return currentBranch === defaultBranchName ? "" : `-${currentBranch}`;
return dontAppendBranchName ? "" : `-${currentBranch}`;
}

module.exports = (semVer, { hashLength, masterBranchName } = {}) => {
const branchDescriptor = getBranchDescriptor(masterBranchName);
module.exports = (semVer, { hashLength, dontAppendBranchName } = {}) => {
const branchDescriptor = getBranchDescriptor(dontAppendBranchName);
const commitCount = getCommitCount();
const hash = getHash(hashLength);

Expand Down

0 comments on commit 05466c5

Please sign in to comment.