1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 09:13:19 +01:00

make sure projectsOutput exists

This commit is contained in:
Matthias Kretschmann 2024-02-05 23:23:46 +00:00
parent 0901a3659b
commit 8f8bb23789
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -24,6 +24,12 @@ export async function generateProjects(): Promise<void> {
if (project) projects.push(project)
}
const dirPath = path.dirname(projectsOutput)
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath, { recursive: true })
}
fs.writeFileSync(projectsOutput, JSON.stringify(projects, null, 2))
spinner.succeed(`Projects content written to ${projectsOutput}\n`)
} catch (error: unknown) {