Skip to content

Instantly share code, notes, and snippets.

@BlaayLock
Forked from stringparser/npm-boot.sh
Created October 19, 2019 07:43
Show Gist options
  • Save BlaayLock/4cd8c75916c0505957314ed78fdf7f8f to your computer and use it in GitHub Desktop.
Save BlaayLock/4cd8c75916c0505957314ed78fdf7f8f to your computer and use it in GitHub Desktop.
boostrap nested npm modules
# boostrap nested npm modules installation
npm-boot() {
local INIT_DIR=$PWD
# go through all packages and install their dependencies
for package in `ls ./**/package.json | grep -v node_modules`
do
cd $INIT_DIR
cd $(dirname $package)
echo "Installing modules for $PWD"
# hack to make npm install common deps into the INIT_DIR
npm install --global --prefix=$INIT_DIR
done
cd $INIT_DIR
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment