1import path from 'path'; 2 3import * as Log from '../log'; 4import { ensureDirectoryAsync, removeAsync } from '../utils/dir'; 5import { exportAppAsync } from './exportApp'; 6import { Options } from './resolveOptions'; 7 8export async function exportAsync(projectRoot: string, options: Options) { 9 // Ensure the output directory is created 10 const outputPath = path.resolve(projectRoot, options.outputDir); 11 // Delete the output directory if it exists 12 await removeAsync(outputPath); 13 // Create the output directory 14 await ensureDirectoryAsync(outputPath); 15 16 // Export the app 17 await exportAppAsync(projectRoot, options); 18 19 // Final notes 20 Log.log(`Export was successful. Your exported files can be found in ${options.outputDir}`); 21} 22