import {join} from "path"; import {stat, writeFile} from "fs"; import {TemplateGenerator} from "./template_generator"; export function init(): void { const dir: string = process.cwd(); const filePath: string = join(dir, 'pops.config.js'); stat(filePath, (error) => { if (error === null) { throw new Error(`A pops.config.js already exists in ${dir}`); } else if (error.code === 'ENOENT') { writeFile(filePath, TemplateGenerator.config(), (error) => { if (error) throw error; }); } else { throw error; } }); }