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