From 45696c2a56cefec212321874ed4f7586bcfa9c79 Mon Sep 17 00:00:00 2001 From: Jacob Middleton Date: Mon, 3 Jun 2019 09:27:47 +0100 Subject: [PATCH] feat: Add toggle whether artifact includes branch 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 --- caplin-versioning/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/caplin-versioning/index.js b/caplin-versioning/index.js index 6826854..99890bd 100644 --- a/caplin-versioning/index.js +++ b/caplin-versioning/index.js @@ -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 @@ -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);