Updated Node package install script to use NPM
Yarn has fallen out of favor in the community so have switched to native NPM support instead.
This commit is contained in:
@@ -101,15 +101,15 @@ get_install_root() {
|
||||
}
|
||||
export -f get_install_root
|
||||
|
||||
# Checks Yarn has been installed and exits if otherwise.
|
||||
# Checks NPM has been installed and exits if otherwise.
|
||||
# Parameters: None.
|
||||
check_yarn_install() {
|
||||
if ! command -v yarn > /dev/null; then
|
||||
printf "%s\n" "ERROR: Yarn can't be found. Please ensure Homebrew and Yarn have been installed."
|
||||
check_npm_install() {
|
||||
if ! command -v npm > /dev/null; then
|
||||
printf "%s\n" "ERROR: NPM can't be found. Please ensure Homebrew and NPM have been installed."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
export -f check_yarn_install
|
||||
export -f check_npm_install
|
||||
|
||||
# Checks Mac App Store (mas) CLI has been installed and exits if otherwise.
|
||||
# Parameters: None.
|
||||
|
||||
@@ -129,13 +129,13 @@ export -f verify_path
|
||||
|
||||
# Checks for missing Node packages.
|
||||
verify_node_packages() {
|
||||
local packages=$(yarn global list --json | grep '"type":"info"')
|
||||
|
||||
printf "\nChecking Node packages...\n"
|
||||
|
||||
while read line; do
|
||||
if [[ "$line" == "yarn global add"* ]]; then
|
||||
if [[ "$line" == "npm "* ]]; then
|
||||
local package=$(printf "$line" | awk '{print $4}')
|
||||
local packages=($(npm list --global --depth=0 | grep "$package"))
|
||||
|
||||
verify_listed_application "$package" "${packages[*]}"
|
||||
fi
|
||||
done < "$MAC_OS_CONFIG_PATH/bin/install_node_packages"
|
||||
|
||||
Reference in New Issue
Block a user