core/postinstall.js
function copyIntoPlace(extractedPath, targetPath) {
  log.info('Removing', targetPath);
  return kew.nfcall(fs.remove, targetPath).then(function () {
    // Look for the extracted directory, so we can rename it.
    const files = fs.readdirSync(extractedPath);
    for (let i = 0; i < files.length; i++) {
      const file = path.join(extractedPath, files[i]);
      if (fs.statSync(file).isDirectory() && file.indexOf(helper.version) !== -1) {
        log.info('Copying extracted folder', file, '->', targetPath);
        return kew.nfcall(fs.move, file, targetPath);
      }
    }
    log.info('Could not find extracted file', files);
    throw new Error('Could not find extracted file');
  });
}
function copyIntoPlace(extractedPath, targetPath) {
  log.info('Removing', targetPath);
  return kew.nfcall(fs.remove, targetPath).then(function () {
    // Look for the extracted directory, so we can rename it.
    const files = fs.readdirSync(extractedPath);
    for (let i = 0; i < files.length; i++) {
      const file = path.join(extractedPath, files[i]);
      if (fs.statSync(file).isDirectory() && file.indexOf(helper.version) !== -1) {
        log.info('Copying extracted folder', file, '->', targetPath);
        return kew.nfcall(fs.move, file, targetPath);
      }
    }
    log.info('Could not find extracted file', files);
    throw new Error('Could not find extracted file');
  });
}
function copyIntoPlace ( extractedPath , targetPath ) { log . info ( 'Removing' , targetPath ) ; return kew . nfcall ( fs . remove , targetPath ) . then ( function ( ) { // Look for the extracted directory, so we can rename it. const files = fs . readdirSync ( extractedPath ) ; for ( let i = 0 ; i < files . length ; i ++ ) { const file = path . join ( extractedPath , files [ i ] ) ; if ( fs . statSync ( file ) . isDirectory ( ) && file . indexOf ( helper . version ) !== - 1 ) { log . info ( 'Copying extracted folder' , file , '->' , targetPath ) ; return kew . nfcall ( fs . move , file , targetPath ) ; } } log . info ( 'Could not find extracted file' , files ) ; throw new Error ( 'Could not find extracted file' ) ; } ) ; }
Helper function to move folder contents to target directory
@param {string} extractedPath - source directory path
@param {string} targetPath - target directory path
@returns {string} {!Promise.<RESULT>} promise for chaing
@function
Helper function to move folder contents to target directory