pip.sh node.sh
pip.sh: minor bugfix node.sh: update node
This commit is contained in:
@@ -244,7 +244,50 @@ echo ""
|
|||||||
|
|
||||||
if [ "$doctor" = true ]; then
|
if [ "$doctor" = true ]; then
|
||||||
echo -e "${underline}🌿 The Doc is checking that everything is ok.${reset}\n"
|
echo -e "${underline}🌿 The Doc is checking that everything is ok.${reset}\n"
|
||||||
npm doctor
|
#npm doctor
|
||||||
|
doc=$(npm doctor)
|
||||||
|
|
||||||
|
echo -e "$doc\n"
|
||||||
|
|
||||||
|
npm_v=$(echo "$doc" | grep 'npm -v')
|
||||||
|
node_v=$(echo "$doc" | grep 'node -v')
|
||||||
|
|
||||||
|
: <<'END_COMMENT'
|
||||||
|
if [[ " $npm_v " =~ " not ok " ]]; then
|
||||||
|
|
||||||
|
# npm -v ok current: v7.5.3, latest: v7.5.3
|
||||||
|
np=$(grep -o -E "v([0-9]{1,2}\.){2}[0-9]{1,2}" <<< "$npm_v")
|
||||||
|
new_npm=$(echo "${np:1}" | sed -n '1p')
|
||||||
|
old_npm=$(echo "${np:1}" | sed -n '$p')
|
||||||
|
|
||||||
|
a=$(echo -e "\nCurrent npm: $old_npm. Update ${bold}npm${reset} to ${bold}$new_npm${reset} [y/n] ? ")
|
||||||
|
read -e -p "$a" rep1
|
||||||
|
if [ "$rep1" == "y" ] || [ "$rep1" == "Y" ]; then
|
||||||
|
echo "Updating npm..."
|
||||||
|
npm -g install npm
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
|
if [[ " $node_v " =~ " not ok " ]]; then
|
||||||
|
no=$(grep -o -E "v([0-9]{1,2}\.){2}[0-9]{1,2}" <<< "$node_v")
|
||||||
|
new_node=$(echo "${no:1}" | sed -n '1p')
|
||||||
|
old_node=$(echo "${no:1}" | sed -n '$p')
|
||||||
|
|
||||||
|
if [ "$new_node" != "$old_node" ]; then
|
||||||
|
b=$(echo -e "\nCurrent node: $old_node. Update ${bold}node${reset} to ${bold}$new_node${reset} [y/n] ? ")
|
||||||
|
read -e -p "$b" rep2
|
||||||
|
if [ "$rep2" == "y" ] || [ "$rep2" == "Y" ]; then
|
||||||
|
echo -e "Updating node to v$new_node..."
|
||||||
|
nvm update $new_node
|
||||||
|
echo -e "Updating npm..."
|
||||||
|
npm -g install npm
|
||||||
|
echo -e "Reinstall packages from v$old_node..."
|
||||||
|
nvm reinstall-packages $old_node
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo -e "🔍 Verifying npm cache\n"
|
echo -e "🔍 Verifying npm cache\n"
|
||||||
|
|||||||
@@ -122,11 +122,9 @@ if [ -n "$upd" ]; then
|
|||||||
x=$(echo "$z" | sed 's/.$//' | sed 's/ /,/g')
|
x=$(echo "$z" | sed 's/.$//' | sed 's/ /,/g')
|
||||||
# on filtre les lignes (y = asgiref|setuptools|lunr)
|
# on filtre les lignes (y = asgiref|setuptools|lunr)
|
||||||
y=$(echo "$z" | sed 's/.$//' | sed 's/ /|/g')
|
y=$(echo "$z" | sed 's/.$//' | sed 's/ /|/g')
|
||||||
#echo "x: $x == y: $y"
|
|
||||||
|
|
||||||
dependencies=$(echo "$x" | xargs pipdeptree -r -p | grep -E $y)
|
dependencies=$(echo "$x" | xargs pipdeptree -r -p | grep -E $y)
|
||||||
echo -e "dependencies:\n $dependencies"
|
echo -e ""
|
||||||
# if [[ $line =~ $y ]]; then
|
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
z=$(echo "${line}" | grep -i ^[a-z])
|
z=$(echo "${line}" | grep -i ^[a-z])
|
||||||
@@ -141,7 +139,7 @@ if [ -n "$upd" ]; then
|
|||||||
echo -e "\n${redbold}${line}${reset}"
|
echo -e "\n${redbold}${line}${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [[ "${line}" = *"<"* ]]; then
|
elif [[ "${line}" = *"<"* ]] || [[ "${line}" = *"=="* ]]; then
|
||||||
echo -e "${red}${line}${reset}"
|
echo -e "${red}${line}${reset}"
|
||||||
elif [[ "${line}" = *"~="* ]]; then
|
elif [[ "${line}" = *"~="* ]]; then
|
||||||
echo -e "${yellow}${line}${reset}"
|
echo -e "${yellow}${line}${reset}"
|
||||||
|
|||||||
Reference in New Issue
Block a user