mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-24 14:36:59 +02:00
perf: optimize getFileCommitDate, make it async (#9890)
This commit is contained in:
parent
0279c329ad
commit
f159bb2472
5 changed files with 54 additions and 34 deletions
|
@ -437,7 +437,7 @@ describe('blog plugin', () => {
|
|||
const noDateSource = path.posix.join('@site', PluginPath, 'no date.md');
|
||||
const noDateSourceFile = path.posix.join(siteDir, PluginPath, 'no date.md');
|
||||
// We know the file exists and we know we have git
|
||||
const result = getFileCommitDate(noDateSourceFile, {age: 'oldest'});
|
||||
const result = await getFileCommitDate(noDateSourceFile, {age: 'oldest'});
|
||||
const noDateSourceTime = result.date;
|
||||
|
||||
expect({
|
||||
|
|
|
@ -258,10 +258,11 @@ async function processBlogSourceFile(
|
|||
}
|
||||
|
||||
try {
|
||||
const result = getFileCommitDate(blogSourceAbsolute, {
|
||||
const result = await getFileCommitDate(blogSourceAbsolute, {
|
||||
age: 'oldest',
|
||||
includeAuthor: false,
|
||||
});
|
||||
|
||||
return result.date;
|
||||
} catch (err) {
|
||||
logger.warn(err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue