I have two repos for a web site: one for the backend, one for the frontend. I want to copy files from the frontend to the backend directory, so that everything can be served from one place.
When I run the build
command on the frontend, a folder named dist/
is created. I want to copy all these files to a folder with the relative path ../backend/public
. This public
folder may already contain some other files.
My current script uses hard-coded names for index.html
and and assets/
directory, but more files may be added over time, so I would like a generic solution that will copy everything that has not changed in dist/
to ../backend/public
.
#!/bin/bash
cd ../backend/public
rm -rf index.html assets
cp ../../frontend/dist/index.html ./
cp -r ../../frontend/dist/assets ./assets