lib/export/export_utils.js
function writeConfigFile(config, yoRcPath = '.yo-rc.json') {
  let newYoRc = { ...config };
  if (FileUtils.doesFileExist(yoRcPath)) {
    const yoRc = JSON.parse(fs.readFileSync(yoRcPath, { encoding: 'utf-8' }));
    newYoRc = {
      ...yoRc,
      ...config,
      [GENERATOR_NAME]: {
        ...yoRc[GENERATOR_NAME],
        ...config[GENERATOR_NAME]
      }
    };
  }
  fs.writeFileSync(yoRcPath, JSON.stringify(newYoRc, null, 2));
}
function writeConfigFile(config, yoRcPath = '.yo-rc.json') {
  let newYoRc = { ...config };
  if (FileUtils.doesFileExist(yoRcPath)) {
    const yoRc = JSON.parse(fs.readFileSync(yoRcPath, { encoding: 'utf-8' }));
    newYoRc = {
      ...yoRc,
      ...config,
      [GENERATOR_NAME]: {
        ...yoRc[GENERATOR_NAME],
        ...config[GENERATOR_NAME]
      }
    };
  }
  fs.writeFileSync(yoRcPath, JSON.stringify(newYoRc, null, 2));
}
function writeConfigFile ( config , yoRcPath = '.yo-rc.json' ) { let newYoRc = { ... config } ; if ( FileUtils . doesFileExist ( yoRcPath ) ) { const yoRc = JSON . parse ( fs . readFileSync ( yoRcPath , { encoding : 'utf-8' } ) ) ; newYoRc = { ... yoRc , ... config , [ GENERATOR_NAME ] : { ... yoRc [ GENERATOR_NAME ] , ... config [ GENERATOR_NAME ] } } ; } fs . writeFileSync ( yoRcPath , JSON . stringify ( newYoRc , null , 2 ) ) ; }
This function writes a Yeoman config file in the current folder.
@param config the configuration.
@param yoRcPath the yeoman conf file path
This function writes a Yeoman config file in the current folder .