/**
 * React Starter Kit (http://www.reactstarterkit.com/)
 *
 * Copyright © 2014-2015 Kriasoft, LLC. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */
 
import path from 'path'; 
import Promise from 'bluebird';  
import del from 'del';
import fs from './lib/fs';
/**
 * Copies static files such as robots.txt, favicon.ico to the
 * output (build) folder.
 async*/
async function copy() { 
  const ncp = Promise.promisify(require('ncp'));
    
  // await ncp(path.join(__dirname, '..','src','public'), path.join(__dirname, '..','build','public'));
  // await ncp(path.join(__dirname, '..','src','content'),path.join(__dirname, '..','build','content'));
  // await ncp(path.join(__dirname, '..','package.json'), path.join(__dirname, '..','build','package.json'));
  await del(['.tmp', 'build/*', '!build/.git','server/views/index.ejs'], { dot: true }); 
  await fs.makeDir('build/public');
  await Promise.all([
    ncp('./src/public', './build/public'),
    ncp('./src/content', './build/content'),
    ncp('./package.json', './build/package.json'),
    ncp('./temp_build/public', './build/public'),
    ncp('./temp_build/index.ejs', './server/views/index.ejs')
  ]);
 
}

export default copy;