Last active
December 9, 2019 14:00
-
-
Save rsurjano/3aea3825efc0e9805f7feaf4e57d6b09 to your computer and use it in GitHub Desktop.
Verdaccio Script for caching npm packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registry=http://localhost:4873 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registry "http://localhost:4873" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (c) 2019 Roy Surjano. All rights reserved. | |
This work is licensed under the terms of the MIT license. | |
For a copy, see <https://opensource.org/licenses/MIT>. | |
npmInstallAll() { | |
PKG=$1 | |
PKGV="$PKG@" # echo $PKGV | |
npmpkg=$(npm view $1 versions /| | |
sed '/next/d' |\ | |
sed '/beta/d' |\ | |
sed '/-/d' |\ | |
sed '/--/d' |\ | |
sed '/rc/d' |\ | |
sed '/-a/d' |\ | |
sed '/-b/d' |\ | |
sed '/-c/d' |\ | |
sed '/-d/d' |\ | |
sed '/-e/d' |\ | |
sed '/]/d' | sed '/RC/d' |\ | |
sed '/\[/d' |\ | |
cut -c4-10 |\ | |
sed -r 's/[,]+//g' |\ | |
sed "s/'//g" |\ | |
awk -v p=$PKGV '$0=p$0' \ | |
) | |
for i in $npmpkg; do | |
npm i $i --no-save --dry-run | |
done | |
} | |
# Usage: | |
# | |
# npmInstallAll [package-name] | |
# npmInstallAll @angular/core |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment