diff --git a/scripts/new-post.js b/scripts/new-post.js index 41a0569..2531390 100644 --- a/scripts/new-post.js +++ b/scripts/new-post.js @@ -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()}