When running nx in pnpm managed repo, I get the following warning (which sometimes even results in not working command)
> NX Running global Nx CLI with PNPM may have issues.
Prefer to use "pnpm" (https://pnpm.io/cli/exec) to execute commands in this workspace.
TIP create a shortcut such as: alias pnx="pnpm nx --"
Using the alias from the TIP would break this autocompletion, so would be really great if the plugin could work with PNPM natively and run pnpm nx whenever nx is used.
Here is what I came up with as a solution for me:
In .zrhrc
function pnpm-nx() {
local cmd=$BUFFER
if [[ "$cmd" =~ ^nx ]]; then
local new_cmd=$(echo $cmd | sed -E 's/^nx /pnpm nx /g')
BUFFER="$new_cmd"
fi
zle accept-line
}
zle -N pnpm-nx
bindkey "^M" pnpm-nx
So, now whenever I type nx {command} it gets replaced by pnpm nx {command} automatically on Enter. This also doesn't break this autocompletion plugin
When running
nxinpnpmmanaged repo, I get the following warning (which sometimes even results in not working command)Using the alias from the TIP would break this autocompletion, so would be really great if the plugin could work with PNPM natively and run
pnpm nxwhenevernxis used.Here is what I came up with as a solution for me:
In
.zrhrcSo, now whenever I type
nx {command}it gets replaced bypnpm nx {command}automatically onEnter. This also doesn't break this autocompletion plugin