My question might be a duplicate of Shake depending on on node_modules directory
I'm new to shake-build and got stumped with the very first thing that I wanted to do. Basically, I want to run yarn install
whenever the yarn.lock
OR package.json
file changes.
I tried the following first, but it ended up running always:
want ["foo"]
phony "foo" $ do
need ["yarn.lock", "package.json"]
cmd_ ["yarn", "install"]
Then I tried the following:
want ["yarn.lock"]
"yarn.lock" %> \out -> do
need ["package.json"]
cmd_ ["yarn", "install"]
And it seems to work, but not quite. It re-runs only when yarn.lock
or package.json
changes, but fails to run after an rm -rf node_modules
(sadly, a very common occurence, btw!)
Is Shake depending on on node_modules directory the correct way to set this up? Does one have to resort to these fake files for all such cases? Shouldn't this be automagically handled somehow by the shake database?
Edit: As an extension to this question, what's the right way to setup a common rule that can do a yarn install
in any given directory?