-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d5b39f
commit 5a921b4
Showing
3 changed files
with
156 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
export const readDir = (dir, pages = []) => { | ||
const docs = fs.readdirSync(dir); | ||
for (const doc of docs) { | ||
const stat = fs.statSync(path.join(dir, doc)); | ||
if (stat.isDirectory()) { | ||
readDir(path.join(dir, doc), pages); | ||
} else if (stat.isFile()) { | ||
if (doc.includes("redirect")) { | ||
continue; | ||
} | ||
const docs = fs.readdirSync(dir); | ||
for (const doc of docs) { | ||
const stat = fs.statSync(path.join(dir, doc)); | ||
if (stat.isDirectory()) { | ||
readDir(path.join(dir, doc), pages); | ||
} else if (stat.isFile()) { | ||
if (doc.includes('redirect')) { | ||
continue; | ||
} | ||
|
||
pages.push(path.join(dir, doc)); | ||
} | ||
} | ||
pages.push(path.join(dir, doc)); | ||
} | ||
} | ||
|
||
return pages; | ||
return pages.sort((a, b) => a.localeCompare(b)); | ||
}; |
Oops, something went wrong.