I am trying to deploy a web project but before build
it, I need to clear/delete the dist
folder.
I could add a script that would run rm -rf dist/*
but that would not work on Windows system.
Is there some npm package u other solution that allows deleting a folder with a command that works in every OS?
You can use rimraf
: https://github.com/isaacs/rimraf.
Note that if you are using globs containing the globstar (**
), you must double-quote them. Unix systems don't all support the globstar by default, but rimraf
will expand them for you. Windows doesn't support single-quotes, so those can't be used. Remember that double-quotes must be escaped in JSON with a \
.