I wish there was a way to do this without additional modules for something so minuscule and common, but this is the best I could come up with.
Update: Should now work on Windows (tested Windows 10), and should also work on Linux/Unix/BSD/Mac systems.
const execSync = require("child_process").execSync, fs = require("fs"), os = require("os"); let removeDirCmd, theDir; removeDirCmd = os.platform() === 'win32' ? "rmdir /s /q " : "rm -rf "; theDir = __dirname + "/../web-ui/css/"; // WARNING: Do not specify a sinlesingle file as the windows rmdir command will error. if (fs.existsSync(theDir)) { console.log(' removing the ' + theDir + ' directory.'); execSync(removeDirCmd + '"' + theDir + '"', function (err) { console.log(err); }); }