Closed bstavroulakis closed 7 years ago
cp and rm -rf not function on windows ?
If you are using Windows PowerShell or Git Bash you can run commands such as cp and rm on Windows. But for some reason the mkdir command in an npm script doesn't work.
http://stackoverflow.com/questions/39727920/cant-use-mkdir-in-npm-script-from-windows
For the cp command I had to change the paths a bit.
I know it is a bit confusing. If you have a windows environment somewhere you can test the build process with and without the updates made to check it out.
@bstavroulakis thanks! I haven't had a chance to get to this. I'll check it out, verify on my mac and windows VM and merge ASAP. cheers!
@bstavroulakis i tried out on my windows VM, still no dice.
I'm thinking we should give https://www.npmjs.com/package/fs-extra a try for mkdir, cp, rm -rf (mkdirp, ncp, rimraf). This way its fully compatible on windows platform and we only consume one dep.
Thoughts?
Thanks Gufsky1, I included fs-extra and it is compiling on windows on my side. Can we please check if the changes make sense?
Polyfill copy method doesnt work on windows all other things work. Because Copy only one folder ex:pollyfil.min.js get error on windows unlink permitted i try fs-promise copy method now all work it.
@bstavroulakis @SerkanDayicik Hi guys
To make it work you just have to change
const polyfills = () => Promise.resolve(copyFolder(`src/app/utils/polyfills.min.js`, `build/public/`))
to
const polyfills = () => Promise.resolve(copyFolder(`src/app/utils/polyfills.min.js`, `build/public/polyfills.min.js`))
This is because fs-extra
does not support copying a file
to a directory
, you must specify directory/newFileName.txt
.
With this little change to the PR it works great on windows.
Love this project and only miss hot-loading in development ;)
Thanks for the great work.
Thanks @BerndWessels, changed the fs-extra copy to explicitly copy the polyfills.min.js file.
thanks guys, apologizes for taking so long to check out.
I tested out your changes on windows & mac, all checks out. I made a minor tweak (escaped quotes) in dev script to make it easier to grep whats going on.
cheers
Had to create a new pull request (sorry about this, you can delete the previous one).
Basically as I see it to make the build process work on windows.
1) You have to remove the ' character in the "dev": "nodemon -e js,scss -w src -x 'node build && node ./build/server.js'" "dev": "nodemon -e js,scss -w src -x node build && node ./build/server.js"
2) The mkdir doesn't work (even in the build.js file) so we need the mkdirp library unfortunately. 3) Making some folder paths more explicit. For example src/app/ => ./src/app/
I'm not sure that these are compatible with a Mac/ Linux environment. But they were required for the windows env.