lib/helpers/indexes.js
function writeExtensionFile(options) {
  return new Promise((resolve, reject) => {
    try {
      const {
        file,
        input,
        defaultContent,
        logNotFound,
        logEnd,
      } = options;
      const filePath = path.resolve(getExtensionsPath(), file);

      if (!input) {
        logger.warn(logNotFound);
        fs.writeFileSync(filePath, defaultContent, { flag: 'w+' });
        return resolve();
      }

      fs.writeFileSync(filePath, input, { flag: 'w+' });
      logger.log(logEnd);

      return resolve();
    } catch (e) {
      return reject(e);
    }
  });
}
function writeExtensionFile(options) {
  return new Promise((resolve, reject) => {
    try {
      const {
        file,
        input,
        defaultContent,
        logNotFound,
        logEnd,
      } = options;
      const filePath = path.resolve(getExtensionsPath(), file);

      if (!input) {
        logger.warn(logNotFound);
        fs.writeFileSync(filePath, defaultContent, { flag: 'w+' });
        return resolve();
      }

      fs.writeFileSync(filePath, input, { flag: 'w+' });
      logger.log(logEnd);

      return resolve();
    } catch (e) {
      return reject(e);
    }
  });
}
function writeExtensionFile ( options ) { return new Promise ( ( resolve , reject ) => { try { const { file , input , defaultContent , logNotFound , logEnd , } = options ; const filePath = path . resolve ( getExtensionsPath ( ) , file ) ; if ( ! input ) { logger . warn ( logNotFound ) ; fs . writeFileSync ( filePath , defaultContent , { flag : 'w+' } ) ; return resolve ( ) ; } fs . writeFileSync ( filePath , input , { flag : 'w+' } ) ; logger . log ( logEnd ) ; return resolve ( ) ; } catch ( e ) { return reject ( e ) ; } } ) ; }
Writes to extension file.
@param {Object} options The action object.
@return {Promise}
Writes to extension file .