captainhook
captainhook copied to clipboard
Allow a working directory to be specified
We are adding some additional (micro) services to our project, so now we have:
composer.json
composer.lock
services/
foo/
package.json
package-lock.json
I'd like to be able to check for changes to services/foo/package{-lock,}.json and execute npm install but within the services/foo directory.
Is there any way that I can tell CaptainHook to execute the action in a different directory? I'm looking for something like:
{
"action": "npm install",
"options": {
"in-directory": "services/foo"
},
"conditions": [ ]
}
You could do something like
"action": "cd services/foo && npm install && cd ../.."
That should work
That seems to work. I think it would still be really useful to have some kind of "working directory" option that would cause both the conditions and the action to operate somewhere other than the root directory.