mirror of https://github.com/seald/nedb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
52 lines
1.1 KiB
/**
|
|
* Build the browser version of nedb
|
|
*/
|
|
|
|
var fs = require('fs-extra')
|
|
, path = require('path')
|
|
, async = require('async')
|
|
, rimraf = require('rimraf')
|
|
, srcContents = fs.readdirSync(path.join(__dirname, 'src'))
|
|
, toCopy = ['lib', 'node_modules']
|
|
;
|
|
|
|
async.waterfall([
|
|
function (cb) {
|
|
console.log("Removing contents of the src directory");
|
|
|
|
srcContents.forEach(function (item) {
|
|
var fullPath = path.join(__dirname, 'src', item);
|
|
rimraf.sync(fullPath);
|
|
});
|
|
|
|
return cb();
|
|
}
|
|
, function (cb) {
|
|
console.log("Copying source files");
|
|
|
|
async.eachSeries(toCopy, function (item, _cb) {
|
|
fs.copy(path.join(__dirname, '..', item), path.join(__dirname, 'src', item), _cb);
|
|
}, cb);
|
|
}
|
|
, function (cb) {
|
|
console.log("Copying browser specific files");
|
|
|
|
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);
|
|
}, cb);
|
|
}
|
|
|
|
|
|
|
|
], function (err) {
|
|
if (err) {
|
|
console.log("Error during build");
|
|
console.log(err);
|
|
} else {
|
|
console.log("Build finished with success");
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
|