@@ -3,12 +3,13 @@ import ViteYaml from "@modyfi/vite-plugin-yaml";
33import { pagefindPlugin } from "vitepress-plugin-pagefind" ;
44// Imports
55import { defineConfig , SiteConfig } from "vitepress" ;
6- import { writeFile , copyFile } from "fs/promises" ;
6+ import { writeFile , unlink } from "fs/promises" ;
77import { resolve } from "path" ;
88import { blacklistJSONstringify } from "../../data/blacklist" ;
99import { changelogJSONstringify } from "../../data/changelog" ;
1010import repositories from "../../../meta/repositories.json" ;
11- import { time } from "console" ;
11+ import sponsors from "../../../meta/sponsors.json" ;
12+ import { getAllContributorsRecursive } from "../../data/contributors.data" ;
1213
1314export const shared = defineConfig ( {
1415 vite : {
@@ -51,7 +52,10 @@ export const shared = defineConfig({
5152 } ,
5253 buildEnd : async ( config : SiteConfig ) => {
5354 const publicApi = resolve ( config . outDir , "api" ) ;
55+ const placeholder = resolve ( publicApi , "placeholder" ) ;
5456 const publicRepoList = resolve ( publicApi , "repositories.json" ) ;
57+ const publicSponList = resolve ( publicApi , "sponsors.json" ) ;
58+ const publicConList = resolve ( publicApi , "contributors.json" ) ;
5559 const publicBlackList = resolve ( publicApi , "blacklist.json" ) ;
5660 const publicChangelogList = resolve ( publicApi , "changelog.json" ) ;
5761
@@ -70,8 +74,29 @@ export const shared = defineConfig({
7074 } ;
7175 } ) ;
7276
77+ const newContributors = async ( ) => {
78+ const contributors = await getAllContributorsRecursive ( "MMRLApp/MMRL" ) ;
79+
80+ const excludedContributors = [ "DerGoogler" , "dependabot[bot]" ]
81+
82+ const contributorsExluded = contributors
83+ . filter ( ( con ) => ! excludedContributors . includes ( con . login ) )
84+
85+ return contributorsExluded . map ( ( contributor ) => {
86+ return {
87+ avatarUrl : contributor . avatar_url ,
88+ login : contributor . login ,
89+ url : contributor . html_url ,
90+ contributions : contributor . contributions ,
91+ } ;
92+ } ) ;
93+ } ;
94+
7395 await writeFile ( publicRepoList , JSON . stringify ( await Promise . all ( newRepositories ) , null , 4 ) ) ;
96+ await writeFile ( publicSponList , JSON . stringify ( await Promise . all ( sponsors ) , null , 4 ) ) ;
97+ await writeFile ( publicConList , JSON . stringify ( await newContributors ( ) , null , 4 ) ) ;
7498 await writeFile ( publicBlackList , blacklistJSONstringify ) ;
7599 await writeFile ( publicChangelogList , changelogJSONstringify ) ;
100+ await unlink ( placeholder ) ;
76101 } ,
77102} ) ;
0 commit comments