mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-02 19:57:25 +02:00
handle case where there is no github repo
This commit is contained in:
parent
c0cc79f995
commit
a76a887901
1 changed files with 20 additions and 17 deletions
|
@ -68,24 +68,27 @@ module.exports = async function processMetadata(
|
||||||
| grep -I "^author " | sort | uniq -c | sort -nr; \
|
| grep -I "^author " | sort | uniq -c | sort -nr; \
|
||||||
`
|
`
|
||||||
).toString().split('\n');
|
).toString().split('\n');
|
||||||
let authorData;
|
/* handle case where it's not github repo */
|
||||||
const authors = [];
|
if (results.length && results[0].length) {
|
||||||
let totalLineCount = 0;
|
let authorData;
|
||||||
results.forEach(result => {
|
const authors = [];
|
||||||
if ((authorData = authorRegex.exec(result)) !== null) {
|
let totalLineCount = 0;
|
||||||
const lineCount = parseInt(authorData[1]);
|
results.forEach(result => {
|
||||||
const name = authorData[2];
|
if ((authorData = authorRegex.exec(result)) !== null) {
|
||||||
authors.push({
|
const lineCount = parseInt(authorData[1]);
|
||||||
lineCount,
|
const name = authorData[2];
|
||||||
name,
|
authors.push({
|
||||||
});
|
lineCount,
|
||||||
totalLineCount += lineCount;
|
name,
|
||||||
}
|
});
|
||||||
authorRegex.lastIndex = 0;
|
totalLineCount += lineCount;
|
||||||
});
|
}
|
||||||
|
authorRegex.lastIndex = 0;
|
||||||
|
});
|
||||||
|
|
||||||
metadata.authors = authors;
|
metadata.authors = authors;
|
||||||
metadata.totalLineCount = totalLineCount;
|
metadata.totalLineCount = totalLineCount;
|
||||||
|
}
|
||||||
|
|
||||||
/* language */
|
/* language */
|
||||||
const language = getLanguage(filepath, refDir, env);
|
const language = getLanguage(filepath, refDir, env);
|
||||||
|
|
Loading…
Add table
Reference in a new issue