mirror of
https://github.com/tldr-pages/tldr.git
synced 2024-10-30 02:17:56 +01:00
build-index: add error check, fix regexp typo
This commit is contained in:
parent
e5d84c429b
commit
2fedf6ce96
1 changed files with 7 additions and 1 deletions
|
@ -12,7 +12,7 @@ function parsePagename(pagefile) {
|
|||
|
||||
function parseLanguage(pagefile) {
|
||||
let pagesFolder = pagefile.split(/\//)[0];
|
||||
return pagesFolder == 'pages' ? 'en' : pagesFolder.replace(/^pages./, '');
|
||||
return pagesFolder == 'pages' ? 'en' : pagesFolder.replace(/^pages\./, '');
|
||||
}
|
||||
|
||||
function buildPagesIndex(files) {
|
||||
|
@ -58,6 +58,12 @@ function saveIndex(index) {
|
|||
}
|
||||
|
||||
glob('pages*/**/*.md', function (er, files) {
|
||||
if (er !== null) {
|
||||
console.error('ERROR finding pages!');
|
||||
console.error(er);
|
||||
return;
|
||||
}
|
||||
|
||||
let index = buildPagesIndex(files);
|
||||
saveIndex(index);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue