diff --git a/cliff.toml b/cliff.toml new file mode 100644 index 00000000..4cf9ea68 --- /dev/null +++ b/cliff.toml @@ -0,0 +1,44 @@ +[changelog] + +header = """ +# Changelog\n +All notable changes to this project will be documented in this file.\n +""" + +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ 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 %}{{ commit.message | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" + +# Trim leading and trailing whitespace from changelog +trim = true + +[git] + +# Parse commits based on the conventional commits specification +conventional_commits = true + +# Filter out commits that do not follow the conventional commits specification +filter_unconventional = true + +# Filter out the commits that are not matched by commit parsers +filter_commits = true + +# Commit parsers to use for parsing commits +commit_parsers = [ + { message = "^feat", group = "Features" }, + { message = "^fix", group = "Bug Fixes" }, + { message = "^doc", group = "Documentation"}, +] + +# Regex for matching git tags +tag_pattern = "v[0-9].*" \ No newline at end of file diff --git a/package.json b/package.json index 4a52f13a..98b18d56 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,8 @@ "check:apply": "biome check . --apply-unsafe", "pack:dev": "pnpm run compile && pnpm run package && pnpm run install-extension", "tsc": "tsc", - "prepare": "lefthook install" + "prepare": "lefthook install", + "changelog": "git-cliff --unreleased 0544a0e103df4308c92b302ac3b22a1e3c26a64d.." }, "devDependencies": { "@biomejs/biome": "^1.3.3", @@ -125,6 +126,7 @@ "@types/vscode": "^1.80.0", "@vscode/vsce": "^2.22.0", "esbuild": "^0.19.2", + "git-cliff": "^1.4.0", "lefthook": "^1.5.2", "typescript": "^5.1.6" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01c6d7a2..670028a1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,6 +40,9 @@ devDependencies: esbuild: specifier: ^0.19.2 version: 0.19.2 + git-cliff: + specifier: ^1.4.0 + version: 1.4.0 lefthook: specifier: ^1.5.2 version: 1.5.2 @@ -649,6 +652,66 @@ packages: has-symbols: 1.0.3 dev: true + /git-cliff-darwin-arm64@1.4.0: + resolution: {integrity: sha512-QCCvi+gIP+2KXWBzCccIDF2GCNbpm9RND7HbDmU79uKP9Qp070ZSYxlqifph6bUxFFw7dRwlVHiKxyUADwnxSQ==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /git-cliff-darwin-x64@1.4.0: + resolution: {integrity: sha512-9b+y3vC4J4G3X9ndNj0s8YiKV1IBux7yU5mDMZhcUA7g9gveoPo+eZZLyPl6+KHxoOE7GCgfHFIhhC+zwh/oWQ==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /git-cliff-linux-arm64@1.4.0: + resolution: {integrity: sha512-caUW7eIkAXZKjzFgQKMlFia+9zkgjPPtnzXeZwkXjtDaSACbzqss+AvaxZUEVy+xfj14+RHOFTn6WCpQJ1NbGw==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /git-cliff-linux-x64@1.4.0: + resolution: {integrity: sha512-9HNuziC2ZsM1z1xrq+pRfFiH3LSdEwK1QyW/vngJP/f4GlO5Zm3tBX4n7Y+8yLUcyYMezKsR+rPF9MRmIswpgQ==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /git-cliff-windows-arm64@1.4.0: + resolution: {integrity: sha512-J0E/74+xowQfuLHHIB3KP6eFp+V39nhPVuAgNLnrLY28Yvqn8AGKCidQStisfjMS2Ot/a7yKFv1JwW/bR0lQjA==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /git-cliff-windows-x64@1.4.0: + resolution: {integrity: sha512-w/mOm00QEuu4VPkmJsyaSlaJtjo6kgvb9v7n81eZSj3SnpTRQzNXTjB1JzKavgqnJ6JnAQiypRmPwC1FsCyiFA==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /git-cliff@1.4.0: + resolution: {integrity: sha512-BLHYp/BD5jfOoPA3B6Ht1s1rJxtPcpmgyjQFZSFP53AdjVyfI2kwk7aVmxEfd1RQsBHRBVfPyJ+PNVghsfo3Yg==} + hasBin: true + optionalDependencies: + git-cliff-darwin-arm64: 1.4.0 + git-cliff-darwin-x64: 1.4.0 + git-cliff-linux-arm64: 1.4.0 + git-cliff-linux-x64: 1.4.0 + git-cliff-windows-arm64: 1.4.0 + git-cliff-windows-x64: 1.4.0 + dev: true + /github-from-package@0.0.0: resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} requiresBuild: true