How to execute command on changing any files in NodeJS environment?

The simplest way to execute a command on file change is:
nodemon -e ts,env --exec "echo hello"
The -e
flag is to configure the extensions - for ex. ts, js, env, etc.
and --exec
executes the command when file with
the configured extension changes.
For more information visit this npm nodemon package.
Edit Read On GitHub