removeExceptGitDir

dev_partners
hjm 6 years ago
parent d067d4dbed
commit c1b3dfadd2

@ -44,16 +44,16 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
} }
function removeExceptGitDir(dir) { function removeExceptGitDir(dir) {
fs2.readdir(dir, function(err, list) { // readdirSync
if (err) return done(err); const list = fs2.readdirSync(dir)
var pending = list.length; // if (err) return done(err);
if (!pending) return done(null, results); var pending = list.length;
list.forEach(function(file) { // if (!pending) return done(null, results);
if (file.indexOf('.git') == -1) { list.forEach(function(file) {
file = path.resolve(dir, file); if (file.indexOf('.git') == -1) {
fs.remove(file) file = path.resolve(dir, file);
} fs.removeSync(file)
}); }
}); });
} }
@ -202,6 +202,14 @@ function generateNewIndexJsp() {
fs2.writeFile(outputPath, result, 'utf8', function (err) { fs2.writeFile(outputPath, result, 'utf8', function (err) {
if (err) return console.log(err); if (err) return console.log(err);
commitAndPush();
}); });
}); });
}
function commitAndPush() {
var exec = require('child_process').exec;
function puts(error, stdout, stderr) { console.log(stdout) }
var options = {cwd:"./build"};
exec("git status && git commit -am 'b' && git push", options, puts);
} }
Loading…
Cancel
Save