const fs = require('fs') const path = require('path') class Generator { constructor(filePath) { const dist = path.resolve(__dirname, filePath) this.dist = dist this.content = fs.readFileSync(dist, { encoding: 'utf-8' }) } render(name, newContent) { if (!name) return const reg = new RegExp(`([\\s\\S]*?)`, 'mg') this.content = this.content.replace(reg, newContent) } update() { fs.writeFileSync(this.dist, this.content, { encoding: 'utf-8' }) } } module.exports = { Generator }