Skip to content
Open
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
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