Open dac09 opened 3 years ago
Ok, so the root cause is that running yarn install
installs the packages and "undoes" the files that are copied.
I assume a temporary fix would be that a user needs to run yarn rwfw project:copy
again? The part that we're missing is the ability to perform this action after a yarn install
?
@dac09 Is my understanding of the problem correct?
I guess we could add a postinstall
script to the <rootDir>/package.json
that runs yarn rwfw project:copy
@jtoar Does that sound like a reasonable approach to you?
Yep - that's right @peterp. This happens due to yarn overwriting the copied files in node_modules/@redwoodjs/*
It seems like a reasonable change to me. For the two-step one (i.e. the test project generator) - I'll add it in now.
Actually on second pass, something to note, if the setup command runs in web/api - like tailwind - the postinstall doesn't get picked up (if you put it on the root package.json).
@peterp as @dac09 said, that case won't cover setup commands like tailwind, but for things like dbAuth which just add boilerplate, that fix will do the trick.
Wondering, in the tailwind case, if there's a way to tell yarn to just leave certain packages alone on install? Instead of rebuilding everything
Note that this has been solved for the time being by adding an option to the tailwind setup command to not install packages
I think we need to extract the code that adds the post install script to the project:sync script too (see build test project script)
Steps to reproduce
./tasks/run-e2e
yarn rw setup tailwind
This also applies if you run
yarn rwfw project:sync
in an existing project. If you runyarn install
(or install a new module, lets say), the project becomes "unsynced"Ideal behaviour
Project should retain sync even after an install