in lib/generator.js [397:412]
overwrite(ast, filepath) {
if (!ast.moduleBody.nodes || !ast.moduleBody.nodes.length) {
return;
}
const beginNotes = DSL.note.getNotes(this.notes, 0, ast.moduleBody.nodes[0].tokenRange[0]);
const overwirte = beginNotes.find(note => note.note.lexeme === '@overwrite');
if (path.resolve(filepath).startsWith(path.resolve(this.outputDir))) {
const baseDir = path.join(this.outputDir, path.sep);
filepath = filepath.replace(baseDir, '');
}
const targetPath = path.join(this.outputDir, filepath);
if (overwirte && overwirte.arg.value === false && fs.existsSync(targetPath)) {
return false;
}
return true;
}