From e71afdb1af790b80f3692dbfc584c43e3155340b Mon Sep 17 00:00:00 2001 From: Ricky Date: Tue, 27 Nov 2018 14:38:08 +0800 Subject: [PATCH] run npm publish recursively --- npmimport.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/npmimport.sh b/npmimport.sh index 1f896dc..28f6531 100755 --- a/npmimport.sh +++ b/npmimport.sh @@ -1,5 +1,7 @@ #!/bin/bash +#run shell where you run npm install + # Get command line params while getopts ":r:k:" opt; do case $opt in @@ -8,4 +10,17 @@ while getopts ":r:k:" opt; do esac done -find . -type f -not -path '*/\.*' -name '*.tgz' -exec npm publish {} --registry $REPO_URL \; +cd node_modules + +for m in $(ls -d */ | cut -f1 -d'/') +do + if [ ${m:0:1} == "@" ] + then + for s in $(ls -d $m/*) + do + npm publish "$s" --registry $REPO_URL + done + else + npm publish $m --registry $REPO_URL + fi +done