Skip to content

Instantly share code, notes, and snippets.

@stringparser
Last active October 19, 2019 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stringparser/de61e5dfa6b38c9e3b6af48db887ab9e to your computer and use it in GitHub Desktop.
Save stringparser/de61e5dfa6b38c9e3b6af48db887ab9e 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