We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
emptyFolder
1 parent 1ad971c commit c96ca5bCopy full SHA for c96ca5b
lib/utils.js
@@ -477,7 +477,11 @@ module.exports.isNotSet = function (obj) {
477
}
478
479
module.exports.emptyFolder = directoryPath => {
480
- require('child_process').execSync(`rm -rf ${directoryPath}/*`)
+ // Do not throw on non-existent directory, since it may be created later
481
+ if (!fs.existsSync(directoryPath)) return
482
+ for (const file of fs.readdirSync(directoryPath)) {
483
+ fs.rmSync(path.join(directoryPath, file), { recursive: true, force: true })
484
+ }
485
486
487
module.exports.printObjectProperties = obj => {
0 commit comments