|
|
@ -27,8 +27,8 @@ ensureDirExists('src'); |
|
|
|
|
|
|
|
|
|
|
|
// Installing build dependencies and require them
|
|
|
|
// Installing build dependencies and require them
|
|
|
|
console.log("Installing build dependencies"); |
|
|
|
console.log("Installing build dependencies"); |
|
|
|
//child_process.exec('npm install fs-extra async uglify-js browserify', function (err, stdout, stderr) {
|
|
|
|
child_process.exec('npm install fs-extra async uglify-js browserify', function (err, stdout, stderr) { |
|
|
|
//if (err) { console.log("Error reinstalling dependencies"); process.exit(1); }
|
|
|
|
if (err) { console.log("Error reinstalling dependencies"); process.exit(1); } |
|
|
|
|
|
|
|
|
|
|
|
fs = require('fs-extra'); |
|
|
|
fs = require('fs-extra'); |
|
|
|
async = require('async'); |
|
|
|
async = require('async'); |
|
|
@ -36,28 +36,28 @@ console.log("Installing build dependencies"); |
|
|
|
uglify = require('uglify-js'); |
|
|
|
uglify = require('uglify-js'); |
|
|
|
|
|
|
|
|
|
|
|
async.waterfall([ |
|
|
|
async.waterfall([ |
|
|
|
//function (cb) {
|
|
|
|
function (cb) { |
|
|
|
//console.log("Removing contents of the src directory");
|
|
|
|
console.log("Removing contents of the src directory"); |
|
|
|
|
|
|
|
|
|
|
|
//async.eachSeries(fs.readdirSync(path.join(__dirname, 'src')), function (item, _cb) {
|
|
|
|
async.eachSeries(fs.readdirSync(path.join(__dirname, 'src')), function (item, _cb) { |
|
|
|
//fs.remove(path.join(__dirname, 'src', item), _cb);
|
|
|
|
fs.remove(path.join(__dirname, 'src', item), _cb); |
|
|
|
//}, cb);
|
|
|
|
}, cb); |
|
|
|
//}
|
|
|
|
} |
|
|
|
//, function (cb) {
|
|
|
|
, function (cb) { |
|
|
|
//console.log("Copying source files");
|
|
|
|
console.log("Copying source files"); |
|
|
|
|
|
|
|
|
|
|
|
//async.eachSeries(toCopy, function (item, _cb) {
|
|
|
|
async.eachSeries(toCopy, function (item, _cb) { |
|
|
|
//fs.copy(path.join(__dirname, '..', item), path.join(__dirname, 'src', item), _cb);
|
|
|
|
fs.copy(path.join(__dirname, '..', item), path.join(__dirname, 'src', item), _cb); |
|
|
|
//}, cb);
|
|
|
|
}, cb); |
|
|
|
//}
|
|
|
|
} |
|
|
|
//, function (cb) {
|
|
|
|
, function (cb) { |
|
|
|
//console.log("Copying browser specific files to replace their server-specific counterparts");
|
|
|
|
console.log("Copying browser specific files to replace their server-specific counterparts"); |
|
|
|
|
|
|
|
|
|
|
|
//async.eachSeries(fs.readdirSync(path.join(__dirname, 'browser-specific')), function (item, _cb) {
|
|
|
|
async.eachSeries(fs.readdirSync(path.join(__dirname, 'browser-specific')), function (item, _cb) { |
|
|
|
//fs.copy(path.join(__dirname, 'browser-specific', item), path.join(__dirname, 'src', item), _cb);
|
|
|
|
fs.copy(path.join(__dirname, 'browser-specific', item), path.join(__dirname, 'src', item), _cb); |
|
|
|
//}, cb);
|
|
|
|
}, cb); |
|
|
|
//}
|
|
|
|
} |
|
|
|
function (cb) { |
|
|
|
, function (cb) { |
|
|
|
console.log("Browserifying the code"); |
|
|
|
console.log("Browserifying the code"); |
|
|
|
|
|
|
|
|
|
|
|
var b = browserify() |
|
|
|
var b = browserify() |
|
|
@ -89,7 +89,7 @@ console.log("Installing build dependencies"); |
|
|
|
console.log("Build finished with success"); |
|
|
|
console.log("Build finished with success"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
//});
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|