Spaces:
Sleeping
Sleeping
| import fs from "fs" | |
| import path from "path" | |
| export function writeWebsiteFile( | |
| filename:string, | |
| content:string | |
| ){ | |
| const base = | |
| path.join(process.cwd(),"generated") | |
| if(!fs.existsSync(base)){ | |
| fs.mkdirSync(base,{recursive:true}) | |
| } | |
| const file = | |
| path.join(base,filename) | |
| fs.mkdirSync( | |
| path.dirname(file), | |
| { | |
| recursive:true | |
| } | |
| ) | |
| fs.writeFileSync( | |
| file, | |
| content, | |
| "utf8" | |
| ) | |
| return file | |
| } | |