Skip to content

Commit

Permalink
feat: allows ability to hide version separator.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymeh authored and marcocesarato committed Aug 6, 2021
1 parent 6454ff1 commit e74c4d4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -97,6 +98,7 @@ return [
'issueUrlFormat' => '{{host}}/{{owner}}/{{repository}}/issues/{{id}}',
'userUrlFormat' => '{{host}}/{{user}}',
'releaseCommitMessageFormat' => 'chore(release): {{currentTag}}',
'hiddenVersionSeparator' => false,
'preRun' => null,
'postRun' => null,
];
Expand Down
7 changes: 6 additions & 1 deletion src/Changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
21 changes: 21 additions & 0 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ class Configuration
*/
protected $prettyScope = true;

/**
* Hide Version Separator.
*
* @var boolean
*/
protected $hiddenVersionSeparator = false;

/**
* Sort by options and orientation.
*
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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'])
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit e74c4d4

Please sign in to comment.