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
mkdir -p ~/.local/lib
d="$(cd "$(dirname $0)"/.. && pwd)"
"$d"/tbin/npx "$@"
d="$(cd "$(dirname $0)" && pwd)"
"$d"/npm exec "$@"
# ※ https://github.com/teaxyz/cli/issues/532

View file

@ -26,15 +26,19 @@ build:
# configures npm to install to ~/.local
- 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: |
mv ../bin/npm .
mv $SRCROOT/props/npm-shim ../bin/npm
rm npx
mv $SRCROOT/props/npx-shim npx
working-directory:
${{prefix}}/tbin
${{prefix}}/bin
test: |
npm install --global cowsay
$HOME/.local/bin/cowsay xyz.tea.hi
test:
# doing first to test our shim works as expected
- 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