Skip to content

Commit

Permalink
fix(changelog): increase scope length and changelog error
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamontat Chantrachirathumrong committed Feb 6, 2019
1 parent 57e0744 commit 89a68d6
Show file tree
Hide file tree
Showing 6 changed files with 237 additions and 8 deletions.
49 changes: 49 additions & 0 deletions .gitgo/chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .MergeCommits -}}
### Pull Requests
{{ range .MergeCommits -}}
- {{ .Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
35 changes: 35 additions & 0 deletions .gitgo/chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/kamontat/gitgo
options:
commits:
filters:
Type:
- feat
- improve
- perf
- fix
- doc
- test
commit_groups:
title_maps:
feat: Feature
improve: Improving application
perf: Improving performance
fix: Fixes Bug
doc: Documentation
test: Testing
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
issues:
prefix:
- "#"
notes:
keywords:
- BREAKING CHANGE
144 changes: 144 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<a name="unreleased"></a>

## [Unreleased]

### Feature

- **changelog:** add --tag to custom tag name

<a name="v3.0.1"></a>

## [v3.0.1] - 2019-02-06

### Improving application

- **local:** add readme file in local configuration

### Testing

- **config:** refactor test due to model changes

<a name="v3.0.0"></a>

## [v3.0.0] - 2019-02-05

### Feature

- **ui-prompt:** add scope to commit message

### Improving performance

- **config:** start implement new format of commit message BREAKING CHANGE: change format of config file which no able to use with the old version

<a name="v2.4.0"></a>

## [v2.4.0] - 2018-11-06

<a name="v2.3.2"></a>

## [v2.3.2] - 2018-09-28

<a name="v2.3.1"></a>

## [v2.3.1] - 2018-09-13

<a name="v2.3.0"></a>

## [v2.3.0] - 2018-09-12

<a name="v2.2.1"></a>

## [v2.2.1] - 2018-09-12

<a name="v2.2.0"></a>

## [v2.2.0] - 2018-09-12

<a name="v2.1.0"></a>

## [v2.1.0] - 2018-09-12

<a name="3.0.0"></a>

## [3.0.0] - 2018-08-23

<a name="v2.0.2"></a>

## [v2.0.2] - 2018-08-21

<a name="v2.0.1"></a>

## [v2.0.1] - 2018-08-16

<a name="v2.0.0"></a>

## [v2.0.0] - 2018-08-16

<a name="v1.4.1"></a>

## [v1.4.1] - 2018-06-25

<a name="1.4.0-alpha.1"></a>

## [1.4.0-alpha.1] - 2018-05-05

<a name="1.3.0-beta.1"></a>

## [1.3.0-beta.1] - 2018-04-11

<a name="1.3.0-alpha.1"></a>

## [1.3.0-alpha.1] - 2018-04-11

<a name="1.1.6"></a>

## [1.1.6] - 2018-04-10

<a name="1.1.4"></a>

## [1.1.4] - 2018-04-10

<a name="1.1.3"></a>

## [1.1.3] - 2018-04-07

<a name="1.0.0-beta.2"></a>

## [1.0.0-beta.2] - 2018-04-04

<a name="0.0.1-alpha.6"></a>

## [0.0.1-alpha.6] - 2018-04-03

<a name="0.0.1-alpha.5"></a>

## [0.0.1-alpha.5] - 2018-04-03

<a name="0.0.1-alpha.3"></a>

## 0.0.1-alpha.3 - 2018-04-02

[unreleased]: https://github.com/kamontat/gitgo/compare/v3.0.1...HEAD
[v3.0.1]: https://github.com/kamontat/gitgo/compare/v3.0.0...v3.0.1
[v3.0.0]: https://github.com/kamontat/gitgo/compare/v2.4.0...v3.0.0
[v2.4.0]: https://github.com/kamontat/gitgo/compare/v2.3.2...v2.4.0
[v2.3.2]: https://github.com/kamontat/gitgo/compare/v2.3.1...v2.3.2
[v2.3.1]: https://github.com/kamontat/gitgo/compare/v2.3.0...v2.3.1
[v2.3.0]: https://github.com/kamontat/gitgo/compare/v2.2.1...v2.3.0
[v2.2.1]: https://github.com/kamontat/gitgo/compare/v2.2.0...v2.2.1
[v2.2.0]: https://github.com/kamontat/gitgo/compare/v2.1.0...v2.2.0
[v2.1.0]: https://github.com/kamontat/gitgo/compare/3.0.0...v2.1.0
[3.0.0]: https://github.com/kamontat/gitgo/compare/v2.0.2...3.0.0
[v2.0.2]: https://github.com/kamontat/gitgo/compare/v2.0.1...v2.0.2
[v2.0.1]: https://github.com/kamontat/gitgo/compare/v2.0.0...v2.0.1
[v2.0.0]: https://github.com/kamontat/gitgo/compare/v1.4.1...v2.0.0
[v1.4.1]: https://github.com/kamontat/gitgo/compare/1.4.0-alpha.1...v1.4.1
[1.4.0-alpha.1]: https://github.com/kamontat/gitgo/compare/1.3.0-beta.1...1.4.0-alpha.1
[1.3.0-beta.1]: https://github.com/kamontat/gitgo/compare/1.3.0-alpha.1...1.3.0-beta.1
[1.3.0-alpha.1]: https://github.com/kamontat/gitgo/compare/1.1.6...1.3.0-alpha.1
[1.1.6]: https://github.com/kamontat/gitgo/compare/1.1.4...1.1.6
[1.1.4]: https://github.com/kamontat/gitgo/compare/1.1.3...1.1.4
[1.1.3]: https://github.com/kamontat/gitgo/compare/1.0.0-beta.2...1.1.3
[1.0.0-beta.2]: https://github.com/kamontat/gitgo/compare/0.0.1-alpha.6...1.0.0-beta.2
[0.0.1-alpha.6]: https://github.com/kamontat/gitgo/compare/0.0.1-alpha.5...0.0.1-alpha.6
[0.0.1-alpha.5]: https://github.com/kamontat/gitgo/compare/0.0.1-alpha.3...0.0.1-alpha.5
12 changes: 6 additions & 6 deletions cmd/changelog.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ var changelogCmd = &cobra.Command{
if err != nil {
e.ShowAndExit(e.ErrorMessage(e.IsChangelog, "Config file not exist in .gitgo folder"))
}
args := []string{"--config", config, "--output", changelogName}

chgArgs := []string{"--config", config, "--output", changelogName}
if nextTag != "" {
args = append(args, "--next-tag")
args = append(args, nextTag)
chgArgs = append(chgArgs, "--next-tag")
chgArgs = append(chgArgs, nextTag)
}

c = exec.Command("git-chglog", args...)
c = exec.Command("git-chglog", chgArgs...)
c.Stdout = os.Stdout
c.Stderr = os.Stderr

Expand All @@ -81,6 +81,6 @@ func init() {
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
changelogCmd.Flags().StringVarP(&changelogName, "location", "l", "./CHANGELOG.md", "Output file location")

changelogCmd.Flags().StringVarP(&nextTag, "tag", "t", "", "custom tag instead of git-tag")
}
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var repo *model.Repo
var debug bool
var verbose bool

var version = "3.0.1"
var version = "3.1.0"

// rootCmd represents the base command when called without any subcommands.
var rootCmd = &cobra.Command{
Expand All @@ -59,6 +59,7 @@ And the problem I got is I forget which emoji is represent what.
And hard to generate changelog file.
So I think 'short key text' is the solution of situation.
3.1.0 -> Add --tag to changelog generator
3.0.1 -> Add README file to local config
3.0.0 -> Change commit format and refactor code
2.4.0 -> Add --empty to allow empty changes to commit code
Expand Down
2 changes: 1 addition & 1 deletion model/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (c *Commit) getQuestion() []*survey.Question {
Message: "Enter commit type scope",
Help: "Scope should represent the scope of commit type",
},
Validate: survey.MaxLength(8),
Validate: survey.MaxLength(12),
}, {
Name: "title",
Prompt: &survey.Input{
Expand Down

0 comments on commit 89a68d6

Please sign in to comment.