proper npx fix

This commit is contained in:
Max Howell 2023-04-22 10:13:45 -04:00
parent baf044ad07
commit d5cf4aef4c
2 changed files with 14 additions and 10 deletions

View file

@ -4,7 +4,7 @@
# FIXME a patch to npm here then upstream would be preferable # FIXME a patch to npm here then upstream would be preferable
mkdir -p ~/.local/lib mkdir -p ~/.local/lib
d="$(cd "$(dirname $0)"/.. && pwd)" d="$(cd "$(dirname $0)" && pwd)"
"$d"/tbin/npx "$@" "$d"/npm exec "$@"
# ※ https://github.com/teaxyz/cli/issues/532 # ※ https://github.com/teaxyz/cli/issues/532

View file

@ -26,15 +26,19 @@ build:
# configures npm to install to ~/.local # configures npm to install to ~/.local
- mv props/npmrc {{prefix}}/lib/node_modules/npm - mv props/npmrc {{prefix}}/lib/node_modules/npm
# our shim fixes a bug where npm doesnt work if ~/.local/lib doesnt exist # our shim fixes a bug where npx doesnt work if ~/.local/lib doesnt exist
- run: | - run: |
mv ../bin/npm . rm npx
mv $SRCROOT/props/npm-shim ../bin/npm mv $SRCROOT/props/npx-shim npx
working-directory: working-directory:
${{prefix}}/tbin ${{prefix}}/bin
test: | test:
npm install --global cowsay # doing first to test our shim works as expected
$HOME/.local/bin/cowsay xyz.tea.hi - npx -qy tldr ls
- npm install --global cowsay
# verify install location is as we configure it
- $HOME/.local/bin/cowsay xyz.tea.hi
npx -qy tldr ls