Skip to content

Commit

Permalink
chore: Update changelog generator
Browse files Browse the repository at this point in the history
  • Loading branch information
jocmp committed Feb 4, 2025
1 parent e43ad06 commit 7749794
Show file tree
Hide file tree
Showing 6 changed files with 873 additions and 1,572 deletions.
1,250 changes: 767 additions & 483 deletions CHANGELOG.md

Large diffs are not rendered by default.

22 changes: 7 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
SHELL :=/usr/bin/env bash

CHANGELOG=CHANGELOG.md
CHANGELOG_TMP=tmp/$(CHANGELOG)

.PHONY: build
build:
$(MAKE) -j2 build-node build-web build-generator
Expand All @@ -19,23 +16,18 @@ build-web:
build-generator:
yarn build:generator

run .PHONY: deps
.PHONY: deps
deps: ## Install bumpver
pip install bumpver==2024.1130

$(CHANGELOG_TMP):
mkdir -p tmp
echo -e "# Mercury Parser Changelog\n" > $(CHANGELOG_TMP)
echo $(now)
echo -e "### $(BUMPVER_NEW_VERSION) ($$(date '+%b %d, %Y'))\n" >> $(CHANGELOG_TMP)
yarn run --silent changelog-maker --format=markdown >> $(CHANGELOG_TMP)
cat $(CHANGELOG) | sed 1d >> $(CHANGELOG_TMP)
cp $(CHANGELOG_TMP) $(CHANGELOG)
.PHONY: local-deps
local-deps: deps
cargo install git-cliff

$(CHANGELOG): $(CHANGELOG_TMP)
$(CHANGELOG):

.PHONY: changelog
changelog: $(CHANGELOG)
changelog:
git cliff > CHANGELOG.md

.PHONY: preview
preview:
Expand Down
26 changes: 0 additions & 26 deletions RELEASE.md

This file was deleted.

81 changes: 81 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[remote.github]
owner = "jocmp"
repo = "mercury-parser"

[changelog]
# template for the changelog body
header = """
# Changelog\n
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Romantic Versioning](https://github.com/romversioning/romver).\n
"""

body = """
{%- if version %}## {{ version }}{%- else -%}## Unreleased{%- endif -%}
{% for commit in commits %}
{% if commit.remote.pr_title -%}
{%- set commit_message = commit.remote.pr_title -%}
{%- else -%}
{%- set commit_message = commit.message -%}
{%- endif -%}
* {{ commit_message | split(pat="\n") | first | trim }}\
{% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}
{% if commit.remote.pr_number %} in \
[#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \
{%- endif %}
{%- endfor -%}
{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
{% raw %}\n{% endraw -%}
## New Contributors
{%- endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
* @{{ contributor.username }} made their first contribution
{%- if contributor.pr_number %} in \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor -%}
{%- endif -%}
{% if version %}
{% if previous.version %}
**Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
{% endif %}
{% else -%}
{% raw %}\n{% endraw %}
{% endif %}
{%- macro remote_url() -%}
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
"""
# remove the leading and trailing whitespace from the template
trim = true
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# postprocessors
postprocessors = []

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = false
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# remove issue numbers from commits
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
]
# filter out the commits that are not matched by commit parsers
filter_commits = false
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "newest"
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"brfs": "^2.0.1",
"brfs-babel": "^2.0.0",
"browserify": "^16.2.3",
"changelog-maker": "^4.3.1",
"eslint": "^5.12.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^6.1.0",
Expand Down
Loading

0 comments on commit 7749794

Please sign in to comment.