I have a project with root folder and client folder, both having package.json files.
On the root folder I don't want to install any packages, ever. Instead, I want that running $ yarn add some-package will automatically add it in the client folder, as if I would do $ yarn add some-package --cwd ./client
I tried doing cd client and yarn --cwd ./client in scripts.preinstall, but it didn't work, which I think it's because preinstall and install are different processes.
I also tried running a cusotm bash script on preinstall but didn't find a way to pass the args from the command line to it, so they get "swollen" by yarn.
Any ideas how to accomplish this?
I'm fairly new with bash, but I can research the solution with some guidance.
Thanks in advance, make it a great day!
PS. I can hack it by hijacking the yarn command on my shell, and check if I'm ot the aforementioned project folder and if the command was yarn add, but I prefer to have a solution for all our developers, and not to pollute my shell.