Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin-git): support changelog and improve performance #283

Merged
merged 10 commits into from
Nov 3, 2024

Conversation

pengzhanbo
Copy link
Member

@pengzhanbo pengzhanbo commented Nov 2, 2024

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Provide a description in this PR that addresses what the PR is solving. If this PR is going to solve an existing issue, please reference the issue (e.g. close #123).

What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Other

Description

The current plugin executes three commands separately to obtain createdTime, updatedTime, and contributors for a single page. This results in even more command executions when filepaths contains multiple files, which is the main reason for the slow collection of git information.

Additionally, the contributors information often leads to duplicate statistics because the username in the local git configuration may not be the same as the username on the git hosting service, resulting in the same user having multiple usernames.

This PR makes the following updates and modifications:

  • A single command is executed per file to collect all git information.

  • Adds a contributorConfig preset for contributors' information, supporting alias mapping.

  • Adds avatar and url information for contributors.

  • Adds a changelog field to collect the change logs for the current page.

  • Adds an filter field to control whether information is collected for pages globally.

  • Adds contributors and changelog in frontmatter to control whether relevant information is collected for the current page.

@coveralls
Copy link

coveralls commented Nov 2, 2024

Pull Request Test Coverage Report for Build 11649116096

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 58.438%

Totals Coverage Status
Change from base Build 11525110739: 0.0%
Covered Lines: 1207
Relevant Lines: 1853

💛 - Coveralls

@pengzhanbo pengzhanbo marked this pull request as ready for review November 2, 2024 16:32
docs/plugins/development/git.md Show resolved Hide resolved
docs/plugins/development/git.md Outdated Show resolved Hide resolved
plugins/development/plugin-git/src/node/types.ts Outdated Show resolved Hide resolved
plugins/development/plugin-git/src/node/types.ts Outdated Show resolved Hide resolved
plugins/development/plugin-git/src/node/types.ts Outdated Show resolved Hide resolved
plugins/development/plugin-git/src/node/types.ts Outdated Show resolved Hide resolved
plugins/development/plugin-git/src/node/gitPlugin.ts Outdated Show resolved Hide resolved
plugins/development/plugin-git/src/node/gitPlugin.ts Outdated Show resolved Hide resolved
plugins/development/plugin-git/src/node/gitPlugin.ts Outdated Show resolved Hide resolved
@Mister-Hope
Copy link
Member

Title should be something like

feat(plugin-git): support changelog and improve performance

@@ -11,3 +12,26 @@ export const checkGitRepo = (cwd: string): boolean => {
return false
}
}

export const checkGitRepoType = (cwd: string): GitType | null => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are creating a git repo with git init, so repo type is a bad name to me.

Also I am wondering if we should check the first remote if origin doesn't exist?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If do it this way, we will need to execute multiple command lines here: first, use git remote to list all of them, then get the first one, and finally execute git remote get-url xxx.

pengzhanbo and others added 2 commits November 3, 2024 11:45
@pengzhanbo pengzhanbo changed the title refactor: improve plugin-git , support changelog of the page feat(plugin-git): support changelog and improve performance Nov 3, 2024
@Mister-Hope
Copy link
Member

my bad, infer not refer 😂

@Mister-Hope Mister-Hope merged commit b526b8c into main Nov 3, 2024
34 checks passed
@Mister-Hope Mister-Hope deleted the plugin-git branch November 3, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants