Im working on a big project and we have a few npm packages.
I want to install all packages in parallel, which means that I want all of them to start at the same time (to save time), and as soon as the last installation was completed, to continue working with my script.
Sample script:
#!/bin/zsh
NPM_FOLDERS=(
common.library/audit
common.library/cipher
common.library/logger
...
)
counter=${#NPM_FOLDERS[@]};
index=1;
for folder in $NPM_FOLDERS;
do
echo "\033[38;5;255m($index/$counter) Executing npm install in: \033[38;5;226m$folder";
cd $ROOT_FOLDER/$folder;
npm install ;
let index++;
done
echo
echo "\033[38;5;11mInstallation completed."
echo
I’m not going to accept the fastest answer, but the one who will do what I want to do and don’t have the right knowledge on how to do this so that you can tell about the time and give a complete answer.
Thank you in advance.
source
share