#npm post hook not firing

1 messages · Page 1 of 1 (latest)

ornate whale
#

I've added a pre script which executes docker compose up to start required containers. Then as post script is docker compose down, which should stop all the running containers.

Whenever I start my start:dev script, the prestart:dev gets called and containers are started but on exiting or stopping the server, poststart:dev doesn't get called.

Any idea as to how this can be fixed?

mellow night
#

If you stop the script with ctrl+c, it aborts the post-scripts, too. The post-scripts only work for scripts that end on their own

ornate whale
mellow night
#

I guess you could achieve what you want with
nest start --watch || docker compose down

ornate whale
#

nest start --watch || docker compose down
didn't do the trick either sadly.

mellow night
#
#

I guess you could try this, but I fear it would also get cancelles with ctrl+c

tawdry pond
#

concurrently is another alternative to npm-run-all
https://www.npmjs.com/package/concurrently