Skip to content

Commit

Permalink
feat(symlinks,tools): add npmrc tool and config to change npmrc confi…
Browse files Browse the repository at this point in the history
…g base on env variable
  • Loading branch information
trystan2k committed Mar 19, 2023
1 parent 956b3a2 commit dd22111
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
6 changes: 0 additions & 6 deletions symlinks/.npmrc
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
registry=${NPM_REGISTRY_URL}
always-auth=${NPM_ALWAYS_AUTH}
email=${NPM_EMAIL}
scripts-prepend-node-path=${NPM_SCRIPTS_PREPEND_NODE_PATH}
_auth=${NPM_AUTH}
audit=${NPM_AUDIT}
18 changes: 18 additions & 0 deletions symlinks/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,24 @@ eval "$(mcfly init zsh)"

source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"

# Handle nppmrc config according to ENV variable
autoload -U add-zsh-hook

set-npmrc-config-hook() {

if ! type npmrc > /dev/null; then
return
fi

if [ -z ${NPMRC_NAME+x} ]; then
npmrc default > /dev/null;
else
npmrc $NPMRC_NAME > /dev/null;
fi
}

add-zsh-hook chpwd set-npmrc-config-hook

# Maybe this shoudl be necessary if it does not auto load in IDEs, for example
#asdf exec direnv reload

Expand Down
6 changes: 3 additions & 3 deletions tools/npm-global-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ install() {

success "'fkill' installed."

info "Installing npm tool 'emoj'"
info "Installing npm tool 'npmrc'"

# Install
npm install --global emoj
npm install --global npmrc

success "'emoj' installed."
success "'npmrc' installed."

info "Installing npm tool 'qnm'"

Expand Down

0 comments on commit dd22111

Please sign in to comment.