“rm -rf build && cd …/xyz-core && yarn build && cd …/client && cross-env CLIENT_ENV=development craco build”
I do this as I need to build a core library every time I deploy before I build the client (as its a dependency in the client code). This works fine on my local but when I run it in render I get an error saying “can’t find client directory” which means the cd command don’t seem to be working like they do in bash. I’m a newbie on the production deploy side so maybe i’m missing something. Render seems to remove the && and replace them with & like this:
“rm -rf build & cd …/xyz-core & yarn build & cd …/client & cross-env CLIENT_ENV=development craco build”
Maybe that affects it as well (and i’m not sure why it does that as && and & are different things). Any ideas here including how to solve the original problem of building a core library before I build the client?
& and && do very different things. One of them runs a command in the background, the other is a control flow that only executes if the previous command exited successfully.
cd ... will fail because you are not likely to have a directory named .... In Linux:
. means current directory
.. means the parent directory (if you’re in /foo/bar, then .. is /foo)
Any other number of dots is a literal directory name like build or client or xyz-core
Understood. An issue I hit was Render was turning my && into & for some reason (the deploy logs showed this). I took everything from my package.json and put it into a shell script to run and that stopped that happening for whatever reason.
Yup sorry that was a typo on my part (it should have been …). The problem I ran into is that when you link libraries using yarn link it creates symbolic links which don’t seem to work for Render services deployments (e.g. my node deploy environment). I ended up yarn pack-ing my library and adding it to my package.json as a file reference instead inline in my shell script and that got around it.
I finally got everything up and running this morning. I’m new to dev ops so a lot of this stuff may just be obvious after i’ve been doing it for years.