mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-28 19:27:41 +00:00
fix(ci): create posts dir before writing scaffold output (#914)
writeFileSync throws ENOENT when the parent directory does not exist in a freshly cloned website repo. Call mkdirSync with recursive:true on the posts dir before writing the file.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
// workflow commits it directly to website main. No PR is created or required.
|
// workflow commits it directly to website main. No PR is created or required.
|
||||||
|
|
||||||
import { execFileSync } from 'node:child_process'
|
import { execFileSync } from 'node:child_process'
|
||||||
import { readFileSync, writeFileSync, readdirSync, existsSync } from 'node:fs'
|
import { readFileSync, writeFileSync, readdirSync, existsSync, mkdirSync } from 'node:fs'
|
||||||
import { join, dirname } from 'node:path'
|
import { join, dirname } from 'node:path'
|
||||||
import { fileURLToPath } from 'node:url'
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
@@ -387,6 +387,7 @@ function main() {
|
|||||||
console.log(newMeta)
|
console.log(newMeta)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
mkdirSync(dirname(postPath), { recursive: true })
|
||||||
writeFileSync(postPath, post, 'utf8')
|
writeFileSync(postPath, post, 'utf8')
|
||||||
writeFileSync(indexPath, newIndex, 'utf8')
|
writeFileSync(indexPath, newIndex, 'utf8')
|
||||||
if (newMeta) writeFileSync(metaPath, newMeta, 'utf8')
|
if (newMeta) writeFileSync(metaPath, newMeta, 'utf8')
|
||||||
|
|||||||
Reference in New Issue
Block a user