Skip to content

Commit

Permalink
chore: setup git-cliff
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Apr 15, 2022
1 parent f229b1b commit 741f1d3
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"skip": {
"changelog": true
},
"releaseCommitMessageFormat": "chore: release react-if@{{currentTag}}",
"scripts": {
"posttag": "pwsh -NoProfile ./scripts/post-tag.ps1"
}
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
All notable changes to this project will be documented in this file.

### [4.1.1](https://github.com/romac/react-if/compare/v4.1.0...v4.1.1) (2021-09-26)

Expand Down
61 changes: 61 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[changelog]
header = """
# Changelog
All notable changes to this project will be documented in this file.\n
"""
body = """
{% if version %}\
# [{{ version | trim_start_matches(pat="v") }}]\
{% if previous %}\
{% if previous.version %}\
(https://github.com/romac/react-if/compare/{{ previous.version }}...{{ version }})\
{% else %}
(https://github.com/romac/react-if/tree/{{ version }})\
{% endif %}\
{% endif %} \
- ({{ timestamp | date(format="%Y-%m-%d") }})
{% else %}\
# [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
## {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.breaking %}\
[**breaking**] \
{% endif %}\
{% if commit.scope %}\
**{{commit.scope}}:** \
{% endif %}\
{{ commit.message | upper_first }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/romac/react-if/commit/{{ commit.id }}))\
{% endfor %}
{% endfor %}\n
"""
trim = true
footer = ""

[git]
conventional_commits = true
filter_unconventional = true
commit_parsers = [
{ message = "^feat", group = "Features"},
{ message = "^fix", group = "Bug Fixes"},
{ message = "^docs", group = "Documentation"},
{ message = "^perf", group = "Performance"},
{ message = "^refactor", group = "Refactor"},
{ message = "^typings", group = "Typings"},
{ message = "^types", group = "Typings"},
{ message = ".*deprecated", body = ".*deprecated", group = "Deprecation"},
{ message = "^revert", skip = true},
{ message = "^style", group = "Styling"},
{ message = "^test", group = "Testing"},
{ message = "^chore", skip = true},
{ message = "^ci", skip = true},
{ message = "^build", skip = true},
{ body = ".*security", group = "Security"},
]
filter_commits = true
tag_pattern = "v[0-9]*"
ignore_tags = ""
topo_order = false
sort_commits = "newest"
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
"license": "MIT",
"main": "dist/index.js",
"module": "dist/react-if.esm.js",
"typings": "dist/index.d.ts",
"types": "dist/index.d.ts",
"exports": {
"import": "./dist/index.js",
"require": "./dist/react-if.esm.js",
"types": "./dist/index.d.ts"
},
"sideEffects": false,
"homepage": "https://github.com/romac/react-if",
"files": [
"dist"
Expand All @@ -26,7 +32,8 @@
"format": "prettier --write \"{src,tests}/**/*.{ts,tsx}\"",
"update": "yarn upgrade-interactive",
"docs": "typedoc",
"sversion": "standard-version",
"bump": "standard-version --no-verify",
"changelog": "git cliff --prepend ./CHANGELOG.md -l -c ./cliff.toml",
"prepublishOnly": "yarn build",
"prepare": "husky install .github/husky"
},
Expand Down
11 changes: 11 additions & 0 deletions scripts/post-tag.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$latestTag = $(git describe --tags $(git rev-list --tags --max-count=1))

yarn changelog

git add CHANGELOG.md
git commit --amend --no-edit --no-verify

$latestCommit = $(git rev-list HEAD | head -1)

git tag -d $latestTag
git tag "$latestTag" $latestCommit

0 comments on commit 741f1d3

Please sign in to comment.