mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-21 10:37:51 +02:00
fix(v2): read last update from inner git repositories (#5048)
This commit is contained in:
parent
aa79387e12
commit
f47826297c
2 changed files with 13 additions and 8 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
import shell from 'shelljs';
|
||||
import execa from 'execa';
|
||||
import path from 'path';
|
||||
|
||||
type FileLastUpdateData = {timestamp?: number; author?: string};
|
||||
|
||||
|
@ -43,12 +44,15 @@ export async function getFileLastUpdate(
|
|||
return null;
|
||||
}
|
||||
|
||||
const {stdout} = await execa('git', [
|
||||
'log',
|
||||
'-1',
|
||||
'--format=%ct, %an',
|
||||
filePath,
|
||||
]);
|
||||
const fileBasename = path.basename(filePath);
|
||||
const fileDirname = path.dirname(filePath);
|
||||
const {stdout} = await execa(
|
||||
'git',
|
||||
['log', '-1', '--format=%ct, %an', fileBasename],
|
||||
{
|
||||
cwd: fileDirname,
|
||||
},
|
||||
);
|
||||
return getTimestampAndAuthor(stdout);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue