Skip to content

[Discussion] A big refactor of git-changelog plugin #499

Open
0 of 5 issues completed
Open
Feature
0 of 5 issues completed
@northword

Description

@northword

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:

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.

Sub-issues

Metadata

Metadata

Assignees

Labels

pkg/git-changelogRelated to @nolebase/vitepress-plugin-git-changelog

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions