node.js – How to deploy dist folder without erasing server-generated files

I am currently building a web app from src folder to my local dist folder. The dist folder then gets deployed/uploaded to the production server. I currently do this using file transfer (SSH).

What I cannot understand or overcome is:

  1. Why does the entire dist folder have to be uploaded to production for each minor change e.g. an update to a CSS file? I know that file names get hashed to invalidate caches, but isn’t there a better way to deploy minor changes than uploading the whole app over and over again?
  2. With each deployment of the dist folder, any server-generated content like Google sitemaps are getting destroyed (a clean dist folder each time is considered good practice). Everytime a change is deployed, all the server-generated content has to be remade again. Is there a way to deploy the dist folder but keep server-generated files safe?

Does CI/CD help with the above issues?

Source link