Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce reshims in global installs #197

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions bin/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@
# shellcheck source=../lib/utils.sh
source "$(dirname "$0")/../lib/utils.sh"

if [ "$ASDF_SKIP_RESHIM" == "1" ]; then
echo "Run 'asdf reshim $(plugin_name) ${ASDF_INSTALL_VERSION:-$npm_config_node_version}' after installing the packages to reshim"
else
asdf reshim "$(plugin_name)" "${ASDF_INSTALL_VERSION:-$npm_config_node_version}"
# If the command contains this package it should be the last
# Or one of multiples packages being installed/removed
# There's no problem executing it more than once
if grep -qFw "\"$npm_package_name\"" <<< "$npm_config_argv"; then
plgn_name="$(plugin_name)"
current_version="${ASDF_INSTALL_VERSION:-$(asdf current "$plgn_name" | awk '{ print $2 }')}"

if [ "$ASDF_SKIP_RESHIM" == "1" ]; then
echo "Run 'asdf reshim $plgn_name $current_version' after installing the packages to reshim"
else
echo "Reshiming npm packages..."
asdf reshim "$plgn_name" "$current_version"
fi
fi
5 changes: 5 additions & 0 deletions npm-hooks/postuninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

asdf_nodejs_installs_path=$(dirname $(dirname $(dirname $NODE)))
asdf_nodejs_plugin_path=${asdf_nodejs_installs_path/installs/plugins}
bash ${asdf_nodejs_plugin_path}/bin/postinstall