Assuming you are on Linux / OSX, you could try something like this:
find ./apps/* -maxdepth 1 -name package.json -execdir npm install \;
Arguments:
./apps/* - the path to the search. I would advise being very specific here to avoid it collecting package.json files in other node_modules directories (see Maxdepth below).
-maxdepth 1 - move only at depth 1 (that is, the current directory - do not go to subdirectories) in the search path
-name package.json - file name to search in
-execdir npm install \; - for each search result, run npm install in the directory in which the file is stored (in this case package.json). Note that a backslash that resets a semicolon must be escaped in a JSON file.
Put this in the hook postinstall in your root.json and it will run every time you install npm:
"scripts": { "postinstall": "find ./apps/* -name package.json -maxdepth 1 -execdir npm install \\;" }
Rory donohue
source share