Reputation: 89
I have a React app which is running on AWS S3. Here is my script for building & deploying;
"scripts": {
"predeploy": "npm run build-css && NODE_PATH=src react-scripts build",
"deploy": "aws s3 sync build/ s3://example.com",
}
However, this is very annoying that I should wait for the "predeploy" then "deploy". How do I achieve it with just one command line?
Can I just join all in one? So for example,
"deploy": "npm run build-css && NODE_PATH=src react-scripts build && aws s3 sync build/ s3://example.com"
Upvotes: 0
Views: 446
Reputation: 38
Yes you can!
If you want to only sync certain files (i.e. create a whitelist so you don't deploy .map files etc.) you can do something like:
"deploy": "npm run build-css && NODE_PATH=src react-scripts build && aws s3 sync build/ s3://example.com --ecluse '*' --include 'yourFileName.js' --include 'yourOtherFileName.css'"
Upvotes: 1