Cleanup directories.
cleandir
just empty output directories.
.gitkeep
and .keep
is also remained.Inspired by https://stackoverflow.com/a/57866165
$ npm install --save-dev @mstssk/cleandir
You can install from GitHub Package.
See a package page and GitHub Package document.
In npm-run-script:
// package.json
{
"scripts": {
"prebuild": "cleandir dist/",
"build": "tsc"
}
}
In your code:
const { cleandir } = require("@mstssk/cleandir");
(async function () {
await cleandir(dirPaths);
})();
I recommend to use rimraf, if you want conditional deleting.