Skip to content

Commit

Permalink
feat: Add toggle whether artifact includes branch
Browse files Browse the repository at this point in the history
BREAKING CHANGE: master branch name option has changed to
dontAppendBranchName. When set to true branch name won't be added to the
artifact name.

closes FXST-3547
  • Loading branch information
JTMCaplin committed Jun 11, 2019
1 parent 2000a2d commit 45696c2
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 45696c2

Please sign in to comment.