Executes an npm script through all the NPM modules in node_modules folder.
The provided script will be executed for every package.json file that has that script implemented inside node_modules folder.
It is supposed to fit well with complex projects having custom submodules as dependencies.
If those submodules have an updated version with new migrations or new tests, you can make it all run with a single command.
Every package.json file can have a scripts section like
"scripts": {
"test": "jest mytest --notify"
}
if you need to execute npm run test on all (or part) of our submodules, you could use execute-submodules test
npm explore is a very great tool, but it only calls one module at a time.
If you need to execute the same command on all your submodules, you should call npm explore for each one of them.
npm install @codever/execute-submodules --save-dev
execute-submodules [command] [--dir [directory]] [--ignore [regexp]] [--verbose]
where
--dirsets a specific subdirectory where the packages. Default value isnode_modules, but using local modules could need a different directory--ignoresets a regular expression pattern to exclude matches--verboseoutput every module where the npm script is executed
npx execute-submodules [command]
Run all the migration (npm run migrate) throught all the submodules
execute-submodules migrate
or
npx execute-submodules migrate