diff --git a/build/start.js b/build/start.js index dbeb08c1..381eb1e1 100644 --- a/build/start.js +++ b/build/start.js @@ -1,4 +1,5 @@ const childProcess = require("child_process"); +const readline = require("readline"); const electron = require("electron"); const webpack = require("webpack"); const config = require("./webpack.app.config"); @@ -6,6 +7,15 @@ const config = require("./webpack.app.config"); const compiler = webpack(config({ development: true })); let electronStarted = false; +const clearTerminal = () => { + if (process.stdout.isTTY) { + const blankLines = "\n".repeat(process.stdout.rows); + console.log(blankLines); + readline.cursorTo(process.stdout, 0, 0); + readline.clearScreenDown(process.stdout); + } +}; + const watching = compiler.watch({}, (err, stats) => { if (err != null) { console.log(err); @@ -18,5 +28,8 @@ const watching = compiler.watch({}, (err, stats) => { }); } - console.log(stats.toString({ colors: true })); + if (stats != null) { + clearTerminal(); + console.log(stats.toString({ colors: true })); + } });