tools/build/bundle.js
function write(dir, code) {
  return new Promise(function (resolve, reject) {
    fse.ensureFile(dir, (err) => {
      if (err) return reject(err)
      fs.writeFile(dir, code, 'utf-8', (err) => {
        if (err) {
          return reject(err)
        }
        console.info(chalk.red(dir) + ' ' + chalk.green(getSize(code)))
        resolve()
      })
    })
  })
}
function write(dir, code) {
  return new Promise(function (resolve, reject) {
    fse.ensureFile(dir, (err) => {
      if (err) return reject(err)
      fs.writeFile(dir, code, 'utf-8', (err) => {
        if (err) {
          return reject(err)
        }
        console.info(chalk.red(dir) + ' ' + chalk.green(getSize(code)))
        resolve()
      })
    })
  })
}
function write ( dir , code ) { return new Promise ( function ( resolve , reject ) { fse . ensureFile ( dir , ( err ) => { if ( err ) return reject ( err ) fs . writeFile ( dir , code , 'utf-8' , ( err ) => { if ( err ) { return reject ( err ) } console . info ( chalk . red ( dir ) + ' ' + chalk . green ( getSize ( code ) ) ) resolve ( ) } ) } ) } ) }
Write code in dir path

@param { String } dir file path dir
@param { String | Buffer } code code
Write code in dir path