Scripting react website deployment on Windows Server
One of my customers has an internally hosted website on their Windows Server. They store all their business data in MS SQL Server that runs on Windows Server. It’s a bit of old school but it has been working for them.
A friend of mine and I built an website with react. It pulls data from the SQL server, create some reports and show them on the web page. As it is not hosted on the cloud, we didn’t have CI/CD. So I wrote a simple powershell script that deploys the website and learned a few things on the way.
xcopy: windows command to copy file. Use
/Yswitch to suppress interrupting question.
If you want to remove file using node.js,
fs.unlinkis the answer.
Powershell command to copy file is
gh repo clone deepeyesuk/aurora-web pushd aurora-web yarn yarn build-iis Copy-Item -Path ".\build\*" -Destination "..\..\aurora-web" -Recurse -Force popd Remove-Item -Recurse -Force aurora-web