/**
*
* Copyright © 2014-2016 killanaca 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 ncp from 'ncp';
import del from 'del';
import path from 'path';

async function postinstall() {
	// this is the path of the package: ..../node_modules/deployment-tools
	const packagePath = process.cwd();
	const src = path.join(packagePath, 'dist');
	const projectPath = path.join(packagePath, '../../');
	const destPath = path.join(projectPath, 'tools');
	console.log('src', src, 'projectPath', projectPath, 'destPath', destPath);
	// first delete folder
	await del(destPath, { dot: true, dryRun: true, force: true });
	// then copy dist into projects tools folder
	ncp(src, destPath, (err) => {
		if (err) {
			return console.error(err);
		}
		return console.log('done!');
	});
}

export default postinstall;

@@ -265,39 +265,147 @@
 h';%0A
-%0Aasync function postinstall() %7B
+import logger from './libs/logger';%0Aimport %7B promisify %7D from 'bluebird';%0A%0Aasync function postinstall() %7B%0A%09const ncpAsync = promisify(ncp);
 %0A%09//
@@ -665,61 +665,70 @@
 );%0A%09
-console.log('src', src, 'projectPath', projectPath, '
+logger.log('postinstall try to copy files from src', src, 'to 
 dest
@@ -884,118 +884,116 @@
 er%0A%09
-ncp(src, destPath, (err) =%3E %7B%0A%09%09if (err) %7B%0A%09%09%09return console.error(err);%0A%09%09%7D%0A%09%09return console.log('done!');%0A%09%7D
+await ncpAsync(src, destPath);%0A%09logger.log('postinstall copied files from src', src, 'to destPath', destPath
 );%0A%7D

use the async version of ncp