In my package.json (from npm), I have the following build command:
"build": "mkdir -p ./build && cp ./src/index.html ./build/ && webpack -p --config webpack.production.config.js"
This command runs just fine and creates a "build" folder with almost everything I need.
However, I also need to make the build command create a sub-directory (in the build folder) called "images" .
I tried a few things, such as the following:
"build": "mkdir build && mkdir -p ./build/images && cp src/index.html build/ && webpack -p --config webpack.production.config.js"
And it always returns this error
How can I change this build command to create a sub-directory inside the build folder?
This is because of the sub-POSIX-standard Windows mkdir
command. Writing portable shell commands this way is difficult and limiting.
One option would be to install and use the mkdirp
module. Then a pure and portable JavaScript mkdirp
command will be available to the npm scripts.
npm install --save-dev mkdirp
Command:
"build": "mkdirp ./build && mkdirp ./build/images && ..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With