wire VCS initialize()

This commit is contained in:
sebastien 2025-10-30 17:19:29 +01:00
parent 7dc89e0b98
commit bc9e135ab5
2 changed files with 15 additions and 4 deletions

View File

@ -101,6 +101,10 @@ export async function loadContext(
}),
});
// Not sure where is the best place to put this VCS initialization call?
// The sooner is probably the better
initialSiteConfig.future.experimental_vcs.initialize({siteDir});
const currentBundler = await getCurrentBundler({
siteConfig: initialSiteConfig,
});

View File

@ -160,10 +160,15 @@ function createCustomVcsConfig(): VcsConfig {
return {
initialize: ({siteDir}) => {
console.log('initializing custom site VCS config...');
getRepoInfoForFile(siteDir).catch((e) => {
console.error('Failed to read the Docusaurus Git repository info', e);
});
if (process.env.NODE_ENV === 'production') {
// Only pre-init for production builds
getRepoInfoForFile(siteDir).catch((error) => {
console.error(
'Failed to initialize the custom Docusaurus site Git VCS',
error,
);
});
}
},
getFileCreationInfo: async (filePath: string) => {
@ -171,6 +176,8 @@ function createCustomVcsConfig(): VcsConfig {
},
getFileLastUpdateInfo: async (filePath: string) => {
// TODO implement this too!
return getRepoInfoForFile(filePath);
},
};