Merge pull request #345 from UnclePi979/feat/script-enhancement
feat: add directory creation for post folder
This commit is contained in:
commit
66ef2ac7ca
1 changed files with 6 additions and 0 deletions
|
|
@ -36,6 +36,12 @@ if (fs.existsSync(fullPath)) {
|
|||
process.exit(1)
|
||||
}
|
||||
|
||||
// recursive mode creates multi-level directories
|
||||
const dirPath = path.dirname(fullPath)
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
fs.mkdirSync(dirPath, { recursive: true })
|
||||
}
|
||||
|
||||
const content = `---
|
||||
title: ${args[0]}
|
||||
published: ${getDate()}
|
||||
|
|
|
|||
Loading…
Reference in a new issue