import fs from 'fs';
import { doesFileExist } from '../utils/file-utils.js';
import { mergeYoRcContent } from './config.js';
export const GENERATOR_NAME = 'generator-begcode';
export function writeConfigFile(config, yoRcPath = '.yo-rc.json') {
    let newYoRc = { ...config };
    if (doesFileExist(yoRcPath)) {
        const yoRc = JSON.parse(fs.readFileSync(yoRcPath, { encoding: 'utf-8' }));
        newYoRc = mergeYoRcContent(yoRc, config);
    }
    fs.writeFileSync(yoRcPath, JSON.stringify(newYoRc, null, 2).concat('\n'));
}
