mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-18 11:36:53 +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
|
@ -25,10 +25,11 @@ export async function getFileLastUpdate(
|
|||
// Wrap in try/catch in case the shell commands fail
|
||||
// (e.g. project doesn't use Git, etc).
|
||||
try {
|
||||
const result = getFileCommitDate(filePath, {
|
||||
const result = await getFileCommitDate(filePath, {
|
||||
age: 'newest',
|
||||
includeAuthor: true,
|
||||
});
|
||||
|
||||
return {timestamp: result.timestamp, author: result.author};
|
||||
} catch (err) {
|
||||
if (err instanceof GitNotFoundError) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue