Description
Hello everyone, some time ago I carried out a major refactor of the git-changelog
plugin. The main motivation behind this refactor was to separate Git data at the page level, which resolves #480 and #279, and also incidentally fixes #462, #280, #278, and #207 (virtually all current issues related to git-changelog
! However, there are still some regressions—see point 3).
The refactor was mainly based on the example provided by brc-dd
in vitepress#3001
. It also heavily draws inspiration from vuepress-plugin-git
.
The refactored version is currently available at: https://github.com/northword/vitepress-plugin-git (Note: there is currently no npm package available).
Due to the large number of breaking changes introduced, I’m uncertain whether this version can be merged into the current repository. Compared to the existing implementation, it feels more like a separate project than a direct continuation. If the rest of the maintainers find these acceptable, I can send a pr.
1. Breaking Changes in Uasges
In the original approach, users had to configure both a Vite plugin and a Vue plugin. In the new approach, users must configure the vitepress/transformPageData
hook along with the Vue plugin (no Vite plugin is used anymore).
UPDATED: 经过一些重新设计,他们之后应该全部在 Node 侧(Vite 插件+VitePress pageDataTransformer)配置(client 侧的通过 Vite define 来传递)。
2. Breaking Changes in Configuration Options
Almost all configuration options have been rewritten. Please refer to src/node/options.ts
and src/client/options.ts
for the new options.
3. Some Old Options/Features Have Not Been Implemented
These include:
- Relative time - blocked by: feat(useTimeAgoIntl): add
useTimaAgoIntl
vueuse/vueuse#4821 - Commit sorting
- Hiding titles (feature request: new option to hide the git-changelog h2 header (use v-if to implement it) #256): It seems users can simply define custom CSS for this. Rendering two
h2
elements has negligible performance impact. - Hiding sort (feature requestion: new option to hide "sort by" button for git-changelog #257)
- i10n (internationalization) for contributor names
- Inline contributors (feature request: new optional component to display authors of commits right inside of commit line #258)
- 5-digit commit hashes (improve(git-changelog): use a 7-digit commit hash instead of a 5-digit #216)
- filter bot user ([Contributors] Automatically filtered bot #232)
- etc.
These features were not reimplemented due to time and bandwidth constraints, but they can certainly be brought back in the future.
4. Code Practices
UnoCSS is currently not used, because it appears to cause issues when using the package outside of a monorepo (I'm not sure if there is any way to fix this?).
Additionally, the unocss
or ui
package introduces too many root-level CSS variables.
(But if we decide to merge, we could consider continuing to rely on ui
and also move src/client/components/VPHeader.vue
into the UI library.)
5. Not a Breaking Change, Just a Personal Concern
The repository has grown somewhat large (though still small compared to large-scale projects), and it's been running rather slowly on my machine. Sometimes, when debugging, I need to rebuild the project just to see changes take effect, and the wait can be several minutes.
I would like to get some suggestions and ideas.