From 2629d74bc27087be5450ef04a7c7f567417cbc46 Mon Sep 17 00:00:00 2001 From: Northword Date: Sun, 21 Jul 2024 00:54:23 +0800 Subject: [PATCH 1/9] refactor!: mv data processing to vite side --- docs/.vitepress/theme/index.ts | 22 -- docs/vite.config.ts | 22 ++ .../package.json | 2 +- .../src/client/components/Contributors.vue | 45 +-- .../src/client/composables/author.test.ts | 216 ----------- .../src/client/composables/author.ts | 168 ++------ .../src/client/composables/commits.ts | 4 +- .../src/client/types.ts | 74 +--- .../src/client/virtual.d.ts | 6 +- .../src/types/index.ts | 74 +++- .../src/vite/git.ts | 68 ++-- .../src/vite/helpers.test.ts | 363 +++++++++++++++++- .../src/vite/helpers.ts | 208 ++++++++-- .../src/vite/types.ts | 5 + pnpm-lock.yaml | 17 +- 15 files changed, 716 insertions(+), 578 deletions(-) diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 588a2983..3b1a5f28 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -54,28 +54,6 @@ export default defineThemeUnconfig({ gitChangelog: { enable: true, options: { - mapContributors: [ - { - name: 'Neko', - username: 'nekomeowww', - mapByNameAliases: ['Neko Ayaka', 'Ayaka Neko'], - mapByEmailAliases: ['neko@ayaka.moe'], - }, - { - name: 'Rizumu', - username: 'LittleSound', - mapByNameAliases: ['Rizumu Ayaka', 'Ayaka Rizumu'], - mapByEmailAliases: ['rizumu@ayaka.moe'], - }, - { - name: 'Nisekoi5', - username: 'Nisekoi5', - }, - { - name: 'Northword', - username: 'northword', - }, - ], commitsRelativeTime: true, }, }, diff --git a/docs/vite.config.ts b/docs/vite.config.ts index 6c90f4d0..3871fd18 100644 --- a/docs/vite.config.ts +++ b/docs/vite.config.ts @@ -62,6 +62,28 @@ export default defineConfig({ GitChangelog({ maxGitLogCount: 2000, repoURL: () => 'https://github.com/nolebase/integrations', + mapAuthors: [ + { + name: 'Neko', + username: 'nekomeowww', + mapByNameAliases: ['Neko Ayaka', 'Ayaka Neko'], + mapByEmailAliases: ['neko@ayaka.moe'], + }, + { + name: 'Rizumu', + username: 'LittleSound', + mapByNameAliases: ['Rizumu Ayaka', 'Ayaka Rizumu'], + mapByEmailAliases: ['rizumu@ayaka.moe'], + }, + { + name: 'Nisekoi5', + username: 'Nisekoi5', + }, + { + name: 'Northword', + username: 'northword', + }, + ], }), GitChangelogMarkdownSection({ excludes: [ diff --git a/packages/vitepress-plugin-git-changelog/package.json b/packages/vitepress-plugin-git-changelog/package.json index ee78b360..f8a40ba6 100644 --- a/packages/vitepress-plugin-git-changelog/package.json +++ b/packages/vitepress-plugin-git-changelog/package.json @@ -76,11 +76,11 @@ "colorette": "^2.0.20", "date-fns": "^3.6.0", "defu": "^6.1.4", + "es-toolkit": "^1.13.1", "execa": "^8.0.1", "globby": "^14.0.1", "gray-matter": "^4.0.3", "less": "^4.2.0", - "ora": "^8.0.1", "uncrypto": "^0.1.3", "vitepress": "^1.2.3" }, diff --git a/packages/vitepress-plugin-git-changelog/src/client/components/Contributors.vue b/packages/vitepress-plugin-git-changelog/src/client/components/Contributors.vue index 2668a0b7..879405ec 100644 --- a/packages/vitepress-plugin-git-changelog/src/client/components/Contributors.vue +++ b/packages/vitepress-plugin-git-changelog/src/client/components/Contributors.vue @@ -1,21 +1,19 @@