M-Zuber / npm-watch

run npm scripts when files change
MIT License
324 stars 38 forks source link

Dynamic script execution command #89

Open flyon opened 2 years ago

flyon commented 2 years ago

I maintain like 30 modules in repo/modules. I need the same thing for all of them: watch the src folder of each module and on a change I would like to specifically build that module.

So something like

test: 'modules/(*)/src'
exec: 'cd $0 && webpack'

Is this possible?

The readme says: "Also it is now possible to obtain a second parameter to define the script which should be run for watching and not watch all possible scripts at once."

It is unclear to me if that is related and what an example of this "second parameter" would be.