|
|
@ -43,13 +43,29 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
|
|
|
|
process.exit(1);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function removeExceptGitDir(dir) {
|
|
|
|
|
|
|
|
fs2.readdir(dir, function(err, list) {
|
|
|
|
|
|
|
|
if (err) return done(err);
|
|
|
|
|
|
|
|
var pending = list.length;
|
|
|
|
|
|
|
|
if (!pending) return done(null, results);
|
|
|
|
|
|
|
|
list.forEach(function(file) {
|
|
|
|
|
|
|
|
if (file.indexOf('.git') == -1) {
|
|
|
|
|
|
|
|
file = path.resolve(dir, file);
|
|
|
|
|
|
|
|
fs.remove(file)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// First, read the current file sizes in build directory.
|
|
|
|
// First, read the current file sizes in build directory.
|
|
|
|
// This lets us display how much they changed later.
|
|
|
|
// This lets us display how much they changed later.
|
|
|
|
measureFileSizesBeforeBuild(paths.appBuild)
|
|
|
|
measureFileSizesBeforeBuild(paths.appBuild)
|
|
|
|
.then(previousFileSizes => {
|
|
|
|
.then(previousFileSizes => {
|
|
|
|
// Remove all content but keep the directory so that
|
|
|
|
// Remove all content but keep the directory so that
|
|
|
|
// if you're in it, you don't end up in Trash
|
|
|
|
// if you're in it, you don't end up in Trash
|
|
|
|
fs.emptyDirSync(paths.appBuild);
|
|
|
|
// fs.emptyDirSync(paths.appBuild);
|
|
|
|
|
|
|
|
removeExceptGitDir(paths.appBuild)
|
|
|
|
|
|
|
|
|
|
|
|
// Merge with the public folder
|
|
|
|
// Merge with the public folder
|
|
|
|
copyPublicFolder();
|
|
|
|
copyPublicFolder();
|
|
|
|
// Start the webpack build
|
|
|
|
// Start the webpack build
|
|
|
|