Skip to content

Commit e9ceff4

Browse files
committed
docs: improve documents
1 parent f559726 commit e9ceff4

File tree

6 files changed

+57
-36
lines changed

6 files changed

+57
-36
lines changed

.chglog/CHANGELOG.tpl.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,27 @@
44

55
{{ if .Tag.Previous }}[Full Changes]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ end }}
66

7+
{{ if .NoteGroups -}}
8+
{{ range .NoteGroups -}}
9+
### {{ .Title }}
10+
11+
{{ range .Notes -}}
12+
{{ .Body }}
13+
{{ end }}
14+
{{ end }}
15+
{{- end -}}
16+
717
{{ range .CommitGroups -}}
818
### {{ .Title }}
919

1020
{{ range .Commits -}}
11-
- {{ if .Scope }}**{{ .Scope }}**: {{ end }}{{ .Subject }}
21+
- {{ if .Scope }}**{{ .Scope }}**: {{ end }}{{ .Subject }} [[{{.Hash.Short}}]({{$.Info.RepositoryURL}}/commit/{{.Hash.Long}})]
22+
{{- if not (empty .Refs) }} ({{ range .Refs }}#{{ .Ref }} {{ end }}) {{- end }}
23+
{{- if not (empty .Body) }}
24+
```
25+
{{ regexReplaceAll "\n" .Body "\n " | abbrev 960 }}
26+
```
27+
{{ end }}
1228
{{ end }}
1329
{{ end -}}
1430

@@ -27,14 +43,4 @@
2743
- {{ .Header }}
2844
{{ end }}
2945
{{ end -}}
30-
31-
{{- if .NoteGroups -}}
32-
{{ range .NoteGroups -}}
33-
### {{ .Title }}
34-
35-
{{ range .Notes }}
36-
{{ .Body }}
37-
{{ end }}
38-
{{ end -}}
39-
{{ end -}}
4046
{{ end -}}

CHANGELOG.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,9 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
The format is inspired by [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6-
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7-
8-
## Change Types
9-
10-
- Add: New features.
11-
- Fix: Bug fixes.
12-
- Change: Changes in existing functionality.
13-
- Breaking Change: Changes which incompatible with previous version in existing functionality
14-
- Deprecate: Features soon-to-be removed.
15-
- Remove: Features removed now.
16-
- Security: In case of vulnerabilities.
17-
- Doc: Documentation changes.
5+
The format is inspired by [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
6+
7+
The versions follow the rules of [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html).
188

199
## [Unreleased]
2010

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.PHONY: bump-major bump-minor bump-patch
2+
3+
bump-major:
4+
./tools/bump major
5+
6+
bump-minor:
7+
./tools/bump minor
8+
9+
bump-patch:
10+
./tools/bump patch

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ Lobash helps to reduce the mental burden on developers.
7070

7171
## Versions
7272

73-
Read [tags][].
74-
The versions follows the rules of [SemVer 2.0.0](http://semver.org/).
73+
Read [tags][] for verions.
74+
The versions follow the rules of [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html).
7575

7676
## [ChangeLog](./CHANGELOG.md)
7777

README.zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ Lobash 能减少开发者的心智负担。
6969

7070
## 版本
7171

72-
Read [tags][].
73-
The versions follows the rules of [SemVer 2.0.0](http://semver.org/).
72+
版本详见 [tags][]
73+
版本命名遵守 [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html)
7474

7575
## [变更日志 ChangeLog](./CHANGELOG.md)
7676

tools/bump

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,18 @@ SCRIPT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
1818
readonly SCRIPT_DIR
1919

2020
semver=$SCRIPT_DIR/../tmp/semver
21+
changelog=$SCRIPT_DIR/../CHANGELOG.md
2122

22-
# shellcheck source=../src/internals/is_gnu_sed.bas
23-
. $SCRIPT_DIR/../src/internals/is_gnu_sed.bash
23+
_lobash.is_gnu_sed() {
24+
sed --version 2>/dev/null | grep 'GNU sed' >/dev/null
25+
}
2426

2527
if _lobash.is_gnu_sed; then
2628
sedi() { sed -i "$@"; }
2729
else
2830
sedi() { sed -i '' "$@"; }
2931
fi
3032

31-
if [[ ! -f $semver ]]; then
32-
curl -Lo "$semver" https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
33-
chmod +x "$semver"
34-
fi
35-
3633
update_changelog() {
3734
local next_ver=$1
3835

@@ -41,10 +38,28 @@ update_changelog() {
4138
line_num=$(( line_num + 2 ))
4239

4340
git-chglog --next-tag "v$next_ver" | \
44-
sedi "$line_num r /dev/stdin" "$SCRIPT_DIR/../CHANGELOG.md"
41+
sedi "$line_num r /dev/stdin" "$changelog"
42+
43+
echo "Updated file: $changelog"
44+
}
45+
46+
ensure_semver() {
47+
if [[ ! -f $semver ]]; then
48+
echo "To download semver-tool"
49+
curl -Lo "$semver" https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
50+
chmod +x "$semver"
51+
fi
4552
}
4653

4754
main() {
55+
if [[ ! -f "$changelog" ]]; then
56+
git-chglog > "$changelog"
57+
echo "Created file: $changelog"
58+
return 0
59+
fi
60+
61+
ensure_semver
62+
4863
local version_file="$SCRIPT_DIR/../version"
4964
local cur_ver next_ver
5065
cur_ver=$(cat "$version_file")

0 commit comments

Comments
 (0)