Merge pull request #354 from edwincoronado/master

fix: Create `data/blog` directory if missing
This commit is contained in:
Timothy 2022-01-25 23:10:38 +08:00 committed by GitHub
commit 11923a0a6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,6 +101,7 @@ inquirer
.replace(/ /g, '-')
.replace(/-+/g, '-')
const frontMatter = genFrontMatter(answers)
if (!fs.existsSync('data/blog')) fs.mkdirSync('data/blog', { recursive: true })
const filePath = `data/blog/${fileName ? fileName : 'untitled'}.${
answers.extension ? answers.extension : 'md'
}`