Currently, the install command offered by the build tools will recursively run npm install across all projects.
Similar to the build command, this isn't always preferable. For example you may have installed a plugin that was build using the build tools and is detected as a project, but has built assets already.
This has came up for me on a project that has transitioned into a multisite. Originally the build tools were running within the theme directory, but now that multiple themes might exist, it makes sense to run the build tools from the project root.
This project also contains a few plugins that the build tools sees as projects, so we're using list mode to ensure that only the themes are built. Without list support for the install command, we need to rely on navigating through directories to run npm install, and having each install command listed in the ci config.
Alternative approaches
We can hook into the preinstall npm script to run npm install on our themes, e.g:
This works well locally and should run in CI too, but if we support 'all projects' mode during install I think we should support 'list' mode too.
In fact, it probably makes sense that the project discovery logic and checks which are currently running within the build command should be extracted and shared to run across all commands.
The feature
Currently, the
install
command offered by the build tools will recursively runnpm install
across all projects.Similar to the
build
command, this isn't always preferable. For example you may have installed a plugin that was build using the build tools and is detected as a project, but has built assets already.This has came up for me on a project that has transitioned into a multisite. Originally the build tools were running within the
theme
directory, but now that multiple themes might exist, it makes sense to run the build tools from the project root.This project also contains a few plugins that the build tools sees as projects, so we're using list mode to ensure that only the themes are built. Without list support for the
install
command, we need to rely on navigating through directories to runnpm install
, and having each install command listed in the ci config.Alternative approaches
We can hook into the
preinstall
npm script to runnpm install
on our themes, e.g:This works well locally and should run in CI too, but if we support 'all projects' mode during
install
I think we should support 'list' mode too.In fact, it probably makes sense that the project discovery logic and checks which are currently running within the
build
command should be extracted and shared to run across all commands.