Skip to content

Commit 90acdb6

Browse files
timoknappchristophwitzko
authored andcommitted
chore: rename changlog-config to 'emojis'
1 parent b76f53a commit 90acdb6

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The changelog generator will order the types of commits in the changelog in the
2323

2424
## Prettified changelogs
2525

26-
In order to use prettified changelogs including a prefixed emoji, you need to provide the following config when calling semantic-relase: `--changelog-generator-opt "prettified_output=true"`. Or add the config within your `.semrelrc` file.
26+
In order to use prettified changelogs including a prefixed emoji, you need to provide the following config when calling semantic-relase: `--changelog-generator-opt "emojis=true"`. Or add the config within your `.semrelrc` file.
2727

2828
[Example Change Log](./examples/GENERATED_CHANGELOG.md)
2929

β€Žexamples/GENERATED_CHANGELOG.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ changed ID int into UUID
2323

2424
* commit message (43218765)
2525

26-
#### πŸ” CI
26+
#### πŸ” CI
2727

2828
* commit message (87654321)
2929

β€Žpkg/generator/changelog_generator.goβ€Ž

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ func formatCommit(c *semrel.Commit) string {
2828
var CGVERSION = "dev"
2929

3030
type DefaultChangelogGenerator struct {
31-
prettifiedOutput bool
31+
emojis bool
3232
}
3333

3434
func (g *DefaultChangelogGenerator) Init(m map[string]string) error {
35-
prettifiedOutput := false
35+
emojis := false
3636

37-
prettifyConfig := m["prettified_output"]
37+
emojiConfig := m["emojis"]
3838

39-
if prettifyConfig == "true" {
40-
prettifiedOutput = true
39+
if emojiConfig == "true" {
40+
emojis = true
4141
}
4242

43-
g.prettifiedOutput = prettifiedOutput
43+
g.emojis = emojis
4444

4545
return nil
4646
}
@@ -74,11 +74,11 @@ func (g *DefaultChangelogGenerator) Generate(changelogConfig *generator.Changelo
7474
if ct.Content == "" {
7575
continue
7676
}
77-
prettifyPrefix := ""
78-
if g.prettifiedOutput {
79-
prettifyPrefix = ct.Emoji
77+
emojiPrefix := ""
78+
if g.emojis && ct.Emoji != "" {
79+
emojiPrefix = fmt.Sprintf("%s ", ct.Emoji)
8080
}
81-
ret += fmt.Sprintf("#### %s%s\n\n%s\n", prettifyPrefix, ct.Text, ct.Content)
81+
ret += fmt.Sprintf("#### %s%s\n\n%s\n", emojiPrefix, ct.Text, ct.Content)
8282
}
8383
return ret
8484
}

β€Žpkg/generator/changelog_generator_test.goβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestDefaultGenerator(t *testing.T) {
3636
}
3737
}
3838

39-
func TestPrettifiedGenerator(t *testing.T) {
39+
func TestEmojiGenerator(t *testing.T) {
4040
changelogConfig := &generator.ChangelogGeneratorConfig{}
4141
changelogConfig.Commits = []*semrel.Commit{
4242
{},
@@ -51,7 +51,7 @@ func TestPrettifiedGenerator(t *testing.T) {
5151
}
5252
changelogConfig.LatestRelease = &semrel.Release{SHA: "stop"}
5353
changelogConfig.NewVersion = "2.0.0"
54-
generator := &DefaultChangelogGenerator{prettifiedOutput: true}
54+
generator := &DefaultChangelogGenerator{emojis: true}
5555
changelog := generator.Generate(changelogConfig)
5656
if !strings.Contains(changelog, "* **app:** commit message (12345678)") ||
5757
!strings.Contains(changelog, "* commit message (abcd)") ||

β€Žpkg/generator/changelog_types.goβ€Ž

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,61 +33,61 @@ var defaultTypes = ChangelogTypes{
3333
{
3434
Type: "%%bc%%",
3535
Text: "Breaking Changes",
36-
Emoji: "πŸ“£ ",
36+
Emoji: "πŸ“£",
3737
},
3838
{
3939
Type: "feat",
4040
Text: "Feature",
41-
Emoji: "🎁 ",
41+
Emoji: "🎁",
4242
},
4343
{
4444
Type: "fix",
4545
Text: "Bug Fixes",
46-
Emoji: "🐞 ",
46+
Emoji: "🐞",
4747
},
4848
{
4949
Type: "revert",
5050
Text: "Reverts",
51-
Emoji: "πŸ”™ ",
51+
Emoji: "πŸ”™",
5252
},
5353
{
5454
Type: "perf",
5555
Text: "Performance Improvements",
56-
Emoji: "πŸ“ˆ ",
56+
Emoji: "πŸ“ˆ",
5757
},
5858
{
5959
Type: "docs",
6060
Text: "Documentation",
61-
Emoji: "πŸ“„ ",
61+
Emoji: "πŸ“„",
6262
},
6363
{
6464
Type: "test",
6565
Text: "Tests",
66-
Emoji: "πŸ”Ž ",
66+
Emoji: "πŸ”Ž",
6767
},
6868
{
6969
Type: "refactor",
7070
Text: "Code Refactoring",
71-
Emoji: "πŸ”€ ",
71+
Emoji: "πŸ”€",
7272
},
7373
{
7474
Type: "style",
7575
Text: "Styles",
76-
Emoji: "🎨 ",
76+
Emoji: "🎨",
7777
},
7878
{
7979
Type: "chore",
8080
Text: "Chores",
81-
Emoji: "🚧 ",
81+
Emoji: "🚧",
8282
},
8383
{
8484
Type: "build",
8585
Text: "Build",
86-
Emoji: "πŸ“¦ ",
86+
Emoji: "πŸ“¦",
8787
},
8888
{
8989
Type: "ci",
9090
Text: "CI",
91-
Emoji: "πŸ” ",
91+
Emoji: "πŸ”",
9292
},
9393
}

0 commit comments

Comments
Β (0)