var rimraf = require('rimraf');
var fs = require('fs');

var dir = '../build';

rimraf(dir, function (err) {
	if (err) {
		throw err;
	}
	
	if (process.argv.indexOf("createdir") >= 0) {
		fs.mkdirSync(dir);
	}
});

var rimraf = require('rimraf');
var path = require('path');
var fs = require('fs');

var dir = path.resolve(__dirname,'../build');

rimraf(dir, function (err) {
	if (err) {
		throw err;
	}
	
	if (process.argv.indexOf("createdir") >= 0) {
		fs.mkdirSync(dir);
	}
});

Clean dir in a proper way.
Clean dir in a proper way.

make clean dir right