diff --git a/Dockerfile b/Dockerfile index 076469b..1c55c04 100644 --- a/Dockerfile +++ b/Dockerfile @@ -192,8 +192,7 @@ COPY env/docker-entrypoint.sh \ /usr/local/bin/ COPY --chown=embark:embark \ env/.bash_env \ - env/.bash_env_denac \ - env/.bash_env_nvm_load \ + env/.bash_env_unset_npm_config \ env/.bashrc \ env/.npmrc \ /home/embark/ diff --git a/env/.bash_env b/env/.bash_env index 61bef7e..7079811 100644 --- a/env/.bash_env +++ b/env/.bash_env @@ -22,7 +22,7 @@ nac () { __denac return 1 fi - __versions_export + __versions alias denac='deactivate_node' alias deactivate_node='__denac' case $- in @@ -46,9 +46,8 @@ __denac () { if type deactivate_node &> /dev/null; then deactivate_node fi - . ${HOME}/.bash_env_denac - unset NODE_VERSION - unset NPM_VERSION + . "${HOME}/.bash_env_unset_npm_config" + __versions } export -f __denac @@ -64,7 +63,7 @@ nvm_load () { __nvm_mask () { case "$*" in unload*) __nvm_unload ;; - *) unalias nvm; nvm "$@"; alias nvm='__nvm_mask'; __versions_export ;; + *) unalias nvm; nvm "$@"; alias nvm='__nvm_mask'; __versions ;; esac } export -f __nvm_mask @@ -72,16 +71,14 @@ nvm_load () { export -f nvm_load __nvm_load () { - __nvm_unload __denac - . ${HOME}/.bash_env_nvm_load . ${HOME}/.nvm/nvm.sh &> /dev/null case $- in *i*) bash-it enable completion nvm &> /dev/null; \ . ${BASH_IT}/completion/available/nvm.completion.bash ;; esac if [[ $(which node) = "${HOME}/.nvm/versions/"* ]]; then - __versions_export + __versions case $- in *i*) __npm_completion ;; esac @@ -96,8 +93,7 @@ __nvm_unload () { if type nvm &> /dev/null; then nvm unload fi - unset NODE_VERSION - unset NPM_VERSION + __versions } export -f __nvm_unload @@ -114,7 +110,7 @@ simple_nodeenv () { } export -f simple_nodeenv -__versions_export () { +__versions () { if type node &> /dev/null; then local node_version=$(node --version) export NODE_VERSION=${node_version##v} @@ -124,7 +120,7 @@ __versions_export () { unset NPM_VERSION fi } -export -f __versions_export +export -f __versions if [[ ! -v NODE_VIRTUAL_ENV ]]; then nac default diff --git a/env/.bash_env_nvm_load b/env/.bash_env_nvm_load deleted file mode 100644 index b7d09cf..0000000 --- a/env/.bash_env_nvm_load +++ /dev/null @@ -1,2 +0,0 @@ -unset npm_config_prefix -unset NPM_CONFIG_PREFIX diff --git a/env/.bash_env_denac b/env/.bash_env_unset_npm_config similarity index 100% rename from env/.bash_env_denac rename to env/.bash_env_unset_npm_config