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
1 changed files with 6 additions and 0 deletions

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) {