import path from 'path' ; import { fs } from '@modern-js/utils' ; import { SsgRoute } from '../types' ; export function writeHtmlFile ( htmlAry , ssgRoutes , baseDir ) { htmlAry . forEach ( ( html , index ) => { const ssgRoute = ssgRoutes [ index ] ; const filepath = path . join ( baseDir , ssgRoute . output ) ; if ( ! fs . existsSync ( path . dirname ( filepath ) ) ) { fs . ensureDirSync ( path . dirname ( filepath ) ) ; } fs . writeFileSync ( filepath , html ) ; } ) ; }