Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-rojas committed Jul 18, 2023
1 parent b58c22f commit 258f6c6
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/prettier/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,30 @@ $nanolayer_location \

PRETTIER_PLUGINS=${PLUGINS:-""}

setup_npm() {
export NVM_DIR=/usr/local/share/nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
}

install_prettier_plugin() {
echo "Installing prettier plugin - $1"
if ! npm list $1 >/dev/null; then
npm install --save-dev prettier $1
fi
}

# Prettier plugins are expected to be installed locally, not globally
# In particular, VSCode + extensions tend to have issues with this
if [ -n "${PRETTIER_PLUGINS}" ]; then
if ! type npm >/dev/null 2>&1; then
setup_npm
fi

OIFS=$IFS
IFS=','

for plugin in $PRETTIER_PLUGINS; do
echo "Installing ${plugin}"
echo "DEBUG: whoami - $(whoami)"
echo "DEBUG: npm - $(ls /usr/local/share/nvm)"
if ! npm list ${plugin} > /dev/null; then
npm install --save-dev prettier ${plugin}
fi
install_prettier_plugin $plugin
done

IFS=$OIFS
fi

Expand Down

0 comments on commit 258f6c6

Please sign in to comment.