Merge pull request #71 from Teng/UnexpectedFile

Remove Unexpected File
This commit is contained in:
Timothy 2021-06-18 18:28:42 +08:00 committed by GitHub
commit 464ab08c69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,6 +98,10 @@ export async function getAllFilesFrontMatter(folder) {
files.forEach((file) => {
// Replace is needed to work on Windows
const fileName = file.slice(prefixPaths.length + 1).replace(/\\/g, '/')
// Remove Unexpected File
if (path.extname(fileName) !== '.md' && path.extname(fileName) !== '.mdx') {
return
}
const source = fs.readFileSync(file, 'utf8')
const { data } = matter(source)
if (data.draft !== true) {