From e74c4d47130baa742397c7701fb27f5f6681d95d Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Thu, 5 Aug 2021 20:30:19 +0100 Subject: [PATCH] feat: allows ability to hide version separator. --- docs/config.md | 2 ++ src/Changelog.php | 7 ++++++- src/Configuration.php | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/config.md b/docs/config.md index 31c5e95..8b31725 100644 --- a/docs/config.md +++ b/docs/config.md @@ -41,6 +41,7 @@ dir or use the `--config` option to specify the location of your configuration f Gitlab, Bitbucket, etc) - **User Url Format:** A URL representing the a user's profile URL on GitHub, Gitlab, etc. This URL is used for substituting @abc with https://github.com/abc in commit messages +- **Hidden Version Separator:** Hide version separator - **Release Commit Message Format:** A string to be used to format the auto-generated release commit message - **Pre Run**: Run a callback or command before run the script - **Post Run**: Run a callback or command after run the script @@ -97,6 +98,7 @@ return [ 'issueUrlFormat' => '{{host}}/{{owner}}/{{repository}}/issues/{{id}}', 'userUrlFormat' => '{{host}}/{{user}}', 'releaseCommitMessageFormat' => 'chore(release): {{currentTag}}', + 'hiddenVersionSeparator' => false, 'preRun' => null, 'postRun' => null, ]; diff --git a/src/Changelog.php b/src/Changelog.php index 8576ec8..bd73bc8 100644 --- a/src/Changelog.php +++ b/src/Changelog.php @@ -534,7 +534,12 @@ protected function getMarkdownChanges(array $changes): string } } // Add version separator - $changelog .= "\n---\n\n"; + if (! $this->config->isHiddenVersionSeparator()) { + $changelog .= "\n---\n"; + } + + $changelog .= "\n"; + return $changelog; } diff --git a/src/Configuration.php b/src/Configuration.php index ef26d7a..ee07cb5 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -229,6 +229,13 @@ class Configuration */ protected $prettyScope = true; + /** + * Hide Version Separator. + * + * @var boolean + */ + protected $hiddenVersionSeparator = false; + /** * Sort by options and orientation. * @@ -312,6 +319,7 @@ public function fromArray(array $array) 'compareUrlFormat' => $this->getCompareUrlFormat(), 'issueUrlFormat' => $this->getIssueUrlFormat(), 'userUrlFormat' => $this->getUserUrlFormat(), + 'hiddenVersionSeparator' => $this->isHiddenVersionSeparator(), 'releaseCommitMessageFormat' => $this->getReleaseCommitMessageFormat(), 'preRun' => $this->getPreRun(), 'postRun' => $this->getPostRun(), @@ -369,6 +377,7 @@ public function fromArray(array $array) ->setHiddenHash($params['hiddenHash']) ->setHiddenMentions($params['hiddenMentions']) ->setHiddenReferences($params['hiddenReferences']) + ->setHiddenVersionSeparator($params['hiddenVersionSeparator']) // Formats ->setPrettyScope($params['prettyScope']) ->setUrlProtocol($params['urlProtocol']) @@ -871,6 +880,18 @@ public function setPackageLockCommit(bool $packageLockCommit): Configuration return $this; } + public function isHiddenVersionSeparator(): bool + { + return $this->hiddenVersionSeparator; + } + + public function setHiddenVersionSeparator($hiddenVersionSeparator): Configuration + { + $this->hiddenVersionSeparator = $hiddenVersionSeparator; + + return $this; + } + /** * Validate settings. *