mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
cleanup lastUpdateUtils from useless hardcoded things, in favor of new VCS system
This commit is contained in:
parent
2a9e227378
commit
87291b3db4
|
|
@ -16,7 +16,7 @@ async function getRouteLastUpdatedAt(
|
|||
vcs: Pick<VcsConfig, 'getFileLastUpdateInfo'>,
|
||||
): Promise<number | null | undefined> {
|
||||
// Important to bail-out early here
|
||||
// This can lead to duplicated getLastUpdate() calls and performance problems
|
||||
// This can lead to duplicated VCS calls and performance problems
|
||||
// See https://github.com/facebook/docusaurus/pull/11211
|
||||
if (route.metadata?.lastUpdatedAt === null) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ export {flattenRoutes} from './routeUtils';
|
|||
|
||||
export {
|
||||
getGitLastUpdate,
|
||||
getLastUpdate,
|
||||
readLastUpdateData,
|
||||
type LastUpdateData,
|
||||
type FrontMatterLastUpdate,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
getFileCommitDate,
|
||||
} from './vcs/gitUtils';
|
||||
import {getDefaultVcsConfig} from './vcs/vcs';
|
||||
|
||||
import type {PluginOptions, VcsConfig} from '@docusaurus/types';
|
||||
|
||||
export type LastUpdateData = {
|
||||
|
|
@ -72,12 +73,6 @@ export async function getGitLastUpdate(
|
|||
}
|
||||
}
|
||||
|
||||
export async function getLastUpdate(
|
||||
filePath: string,
|
||||
): Promise<LastUpdateData | null> {
|
||||
return getGitLastUpdate(filePath);
|
||||
}
|
||||
|
||||
type LastUpdateOptions = Pick<
|
||||
PluginOptions,
|
||||
'showLastUpdateAuthor' | 'showLastUpdateTime'
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
getFileCommitDate,
|
||||
GitNotFoundError,
|
||||
} from './gitUtils';
|
||||
import {getLastUpdate} from '../lastUpdateUtils';
|
||||
import {getGitLastUpdate} from '../lastUpdateUtils';
|
||||
import type {VcsConfig} from '@docusaurus/types';
|
||||
|
||||
/**
|
||||
|
|
@ -52,7 +52,7 @@ export const VcsGitAdHoc: VcsConfig = {
|
|||
// TODO non-ideal integration but good enough for now
|
||||
// This keeps this new VscConfig system retro-compatible with the existing
|
||||
// historical Docusaurus behavior based on Git
|
||||
const result = await getLastUpdate(filePath);
|
||||
const result = await getGitLastUpdate(filePath);
|
||||
if (result === null) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue