Skip to content

Instantly share code, notes, and snippets.

@danielbayley
Last active October 26, 2025 11:01
Show Gist options
  • Save danielbayley/62a3076902f664391b1cfbcd09d78918 to your computer and use it in GitHub Desktop.
Save danielbayley/62a3076902f664391b1cfbcd09d78918 to your computer and use it in GitHub Desktop.

Revisions

  1. danielbayley revised this gist May 16, 2020. No changes.
  2. danielbayley revised this gist Apr 29, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.command
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,4 @@ npm () {
    }
    source <(npx --shell-auto-fallback --no-install zsh)

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
    [ $ZSH_EVAL_CONTEXT = toplevel ] && $0:t:r $@
  3. danielbayley revised this gist Apr 29, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.command
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #! /bin/zsh --no_rcs --err-exit
    #! /bin/zsh --no-rcs --err-exit
    export PATH=node_modules/.bin:$PATH

    alias -g i=install
  4. danielbayley revised this gist Apr 29, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.command
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #! /bin/zsh -f
    #! /bin/zsh --no_rcs --err-exit
    export PATH=node_modules/.bin:$PATH

    alias -g i=install
  5. danielbayley revised this gist Apr 28, 2020. 1 changed file with 14 additions and 16 deletions.
    30 changes: 14 additions & 16 deletions pnpm.command
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,21 @@
    #! /bin/zsh -f
    disable which # builtin
    alias -g i=install

    pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }
    export PATH=node_modules/.bin:$PATH

    if (which -s pnpm) npm () {
    NODE_BIN=`brew --prefix node`/bin
    export PATH=$PATH:$NODE_BIN
    alias -g i=install

    case $@ in
    -g*) npm $2 -g ${@[3,#]};;
    install*)
    pnpm $@ &
    if (which -s npm-install-peers) npm-install-peers;;
    (rm|un)*-g*)
    pnpm $@
    rm $NODE_BIN/$@[#];;
    *) pnpm $@;;
    if (($+commands[pnpm])) then
    local p=p
    alias pnpm=npm npx=pnpx
    # FIXME https://github.com/pnpm/pnpm/issues/1360
    npm config get -g global-dir | read
    path+=$REPLY/bin
    fi
    npm () {
    case $1 in
    env) command npx --call env;;
    *) command ${p}npm ${@/uninstall/remove}
    esac
    }
    source <(npx --shell-auto-fallback --no-install zsh)

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  6. danielbayley renamed this gist Jul 6, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. danielbayley revised this gist Jun 19, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    #! /bin/zsh -f

    disable which # builtin
    alias -g i=install

  8. danielbayley revised this gist Apr 4, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,6 @@ alias -g i=install
    pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }

    if (which -s pnpm) npm () {

    NODE_BIN=`brew --prefix node`/bin
    export PATH=$PATH:$NODE_BIN

  9. danielbayley revised this gist Apr 4, 2017. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -3,12 +3,13 @@
    disable which # builtin
    alias -g i=install

    NODE_BIN=`brew --prefix node`/bin
    export PATH=$PATH:$NODE_BIN

    pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }

    if (which -s pnpm) npm () {

    NODE_BIN=`brew --prefix node`/bin
    export PATH=$PATH:$NODE_BIN

    case $@ in
    -g*) npm $2 -g ${@[3,#]};;
    install*)
  10. danielbayley revised this gist Apr 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -21,4 +21,4 @@ if (which -s pnpm) npm () {
    esac
    }

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  11. danielbayley revised this gist Apr 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -21,4 +21,4 @@ if (which -s pnpm) npm () {
    esac
    }

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  12. danielbayley revised this gist Apr 4, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -20,4 +20,5 @@ if (which -s pnpm) npm () {
    *) pnpm $@;;
    esac
    }

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  13. danielbayley revised this gist Apr 4, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@ disable which # builtin
    alias -g i=install

    NODE_BIN=`brew --prefix node`/bin
    export PATH=$PATH:$NODE_BIN

    pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }

    if (which -s pnpm) npm () {
    @@ -18,6 +20,4 @@ if (which -s pnpm) npm () {
    *) pnpm $@;;
    esac
    }
    export PATH=$PATH:$NODE_BIN

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  14. danielbayley revised this gist Apr 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,6 @@ if (which -s pnpm) npm () {
    *) pnpm $@;;
    esac
    }
    export PATH=$PATH:
    export PATH=$PATH:$NODE_BIN

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  15. danielbayley revised this gist Apr 4, 2017. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,7 @@
    disable which # builtin
    alias -g i=install

    NODE_BIN=`brew --prefix node`/bin
    pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }

    if (which -s pnpm) npm () {
    @@ -13,10 +14,10 @@ if (which -s pnpm) npm () {
    if (which -s npm-install-peers) npm-install-peers;;
    (rm|un)*-g*)
    pnpm $@
    rm `brew --prefix node`/bin/$@[#];;
    rm $NODE_BIN/$@[#];;
    *) pnpm $@;;
    esac
    }
    export PATH=$PATH:`brew --prefix node`/bin
    export PATH=$PATH:

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  16. danielbayley revised this gist Apr 4, 2017. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -7,11 +7,11 @@ pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }

    if (which -s pnpm) npm () {
    case $@ in
    -g) npm $2 -g ${@[3,#]};;
    install)
    pnpm install &
    -g*) npm $2 -g ${@[3,#]};;
    install*)
    pnpm $@ &
    if (which -s npm-install-peers) npm-install-peers;;
    (rm|un)*-g)
    (rm|un)*-g*)
    pnpm $@
    rm `brew --prefix node`/bin/$@[#];;
    *) pnpm $@;;
  17. danielbayley revised this gist Apr 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ if (which -s pnpm) npm () {
    case $@ in
    -g) npm $2 -g ${@[3,#]};;
    install)
    npm install &
    pnpm install &
    if (which -s npm-install-peers) npm-install-peers;;
    (rm|un)*-g)
    pnpm $@
  18. danielbayley revised this gist Apr 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ if (which -s pnpm) npm () {
    install)
    npm install &
    if (which -s npm-install-peers) npm-install-peers;;
    (rm|un)* -g)
    (rm|un)*-g)
    pnpm $@
    rm `brew --prefix node`/bin/$@[#];;
    *) pnpm $@;;
  19. danielbayley revised this gist Apr 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ if (which -s pnpm) npm () {
    install)
    npm install &
    if (which -s npm-install-peers) npm-install-peers;;
    (rm|un)*-g*)
    (rm|un)* -g)
    pnpm $@
    rm `brew --prefix node`/bin/$@[#];;
    *) pnpm $@;;
  20. danielbayley revised this gist Apr 4, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -17,4 +17,6 @@ if (which -s pnpm) npm () {
    *) pnpm $@;;
    esac
    }
    export PATH=$PATH:`brew --prefix node`/bin

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  21. danielbayley revised this gist Apr 4, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -17,5 +17,4 @@ if (which -s pnpm) npm () {
    *) pnpm $@;;
    esac
    }

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  22. danielbayley revised this gist Apr 4, 2017. No changes.
  23. danielbayley revised this gist Apr 4, 2017. No changes.
  24. danielbayley revised this gist Apr 4, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,10 @@ pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }

    if (which -s pnpm) npm () {
    case $@ in
    i*\ -?(-)[Pp]?(eer*))
    -g) npm $2 -g ${@[3,#]};;
    install)
    npm install &
    if (which -s npm-install-peers) npm-install-peers;;
    -g*) npm $2 -g ${@[3,#]};;
    (rm|un)*-g*)
    pnpm $@
    rm `brew --prefix node`/bin/$@[#];;
  25. danielbayley revised this gist Apr 4, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -8,8 +8,10 @@ pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }
    if (which -s pnpm) npm () {
    case $@ in
    i*\ -?(-)[Pp]?(eer*))
    npm i & if (which -s npm-install-peers) npm-install-peers;;
    (rm*|un*)*-g*)
    npm install &
    if (which -s npm-install-peers) npm-install-peers;;
    -g*) npm $2 -g ${@[3,#]};;
    (rm|un)*-g*)
    pnpm $@
    rm `brew --prefix node`/bin/$@[#];;
    *) pnpm $@;;
  26. danielbayley revised this gist Apr 4, 2017. 1 changed file with 13 additions and 2 deletions.
    15 changes: 13 additions & 2 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,19 @@
    #! /bin/zsh -f
    if (command which -s pnpm) npm () {

    disable which # builtin
    alias -g i=install

    pnpm () { command pnpm $@ --config ${NPM_CONFIG_USERCONFIG:-~/.npmrc} }

    if (which -s pnpm) npm () {
    case $@ in
    *-g*) command npm $@;;
    i*\ -?(-)[Pp]?(eer*))
    npm i & if (which -s npm-install-peers) npm-install-peers;;
    (rm*|un*)*-g*)
    pnpm $@
    rm `brew --prefix node`/bin/$@[#];;
    *) pnpm $@;;
    esac
    }

    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  27. danielbayley revised this gist Mar 16, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,5 @@ if (command which -s pnpm) npm () {
    *-g*) command npm $@;;
    *) pnpm $@;;
    esac
    }
    }
    [ $ZSH_EVAL_CONTEXT = toplevel ] && npm $@
  28. danielbayley revised this gist Mar 14, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    #! /bin/zsh -f
    if (command which -s pnpm) npm () {
    case $@ in
    *-g*) command npm $@;;
  29. danielbayley revised this gist Mar 14, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    alias -g i=install
    if (command which -s pnpm) npm () {
    case $@ in
    *-g*) command npm $@;;
  30. danielbayley revised this gist Mar 9, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pnpm.zsh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    alias -g i=install
    if (command which -s pnpm) npm () {
    case $@ in
    *-g*|init*) command npm $@;;
    *-g*) command npm $@;;
    *) pnpm $@;;
    esac
    }