0

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"
1

1 Answer 1

1

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'" 

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.