CommitChangelog
:commit-changelog to display GitHub commits for a component or file, grouped by release.CommitChangelog requests the GitHub commits of a file path and groups them by release: released commits go under their version, unreleased ones under Soon. When the site has a releases page, version tags link to it; otherwise they open the GitHub release.
The component does not depend on the componentDocs flag; it only needs the GitHub integration.
Prerequisites
- Repository:
github.owner,github.name,github.urlandgithub.branchare inferred from the local git remote. Set them inapp/app.config.tswhen inference fails, see the app.config reference - Access token: set
NUXT_GITHUB_TOKENin the environment
NUXT_GITHUB_TOKEN=<your-github-token>
github: false, the component shows No recent changes and the build does not fail.Usage
Inferred file path
:commit-changelog
The path is built as {commitPath}/{prefix}/{name}.{suffix}:
| Part | Source |
|---|---|
commitPath | The component's commitPath, then github.commitPath, defaults to src |
prefix | The component's prefix, empty by default |
name | The component's name, defaults to the last segment of the current route |
suffix | The component's suffix, then github.suffix, defaults to vue |
name is converted according to casing: the default auto uses PascalCase for .vue files and camelCase for others; kebab, camel and pascal force that style. On /docs/components/accordion, for example, the line above resolves to src/Accordion.vue.
A specific file
:commit-changelog{name="useUser" suffix="ts" commitPath="src/composables"}
If all files use kebab-case, set it once in app/app.config.ts instead of on every component:
export default defineAppConfig({
github: {
commitPath: 'src/composables',
suffix: 'ts',
casing: 'kebab'
}
})
Multiple files
Each entry in files overrides the top-level fields (commitPath, prefix, suffix, name, casing); missing fields fall back to the top-level values. Commits from all files are merged, deduplicated and sorted newest first:
::commit-changelog
---
commitPath: layer/app/composables
suffix: ts
files:
- name: useHeader
- name: useNavigation
---
::
Filter by author
Pass a GitHub username or commit email to author:
:commit-changelog{author="octocat"}
github.since, github.until and github.perPage: no date limit by default and at most 100 commits per file.AI and raw markdown
In /raw/**.md and the Markdown returned by MCP, the component is replaced with links to the GitHub commit history using the same path rules; without name, the page title is used.
API
Props
| Prop | Default | Type |
|---|---|---|
commitPath | 'src' | string仓库中的文件路径 |
prefix | string文件路径的前缀 | |
suffix | 'vue' | string文件扩展名 |
name | string要获取更新日志的组件或文件名 | |
author | string按作者筛选提交 | |
casing | 'auto' | "auto" | "kebab" | "camel" | "pascal"文件名的命名格式
|
files | CommitChangelogFile[]关联多个文件:每一项与顶层 props 合并后各自解析出一个文件路径, 对应的提交记录会合并去重并按时间倒序展示 |
Related
- PageLastCommit: shows the latest commit of the current page in the header