mirror of
https://github.com/ivabus/pantry
synced 2024-11-23 00:45:07 +03:00
Fix npx failing without ~/.local/lib
Fixes https://github.com/teaxyz/cli/issues/532
This commit is contained in:
parent
6f5ba66dd2
commit
baf044ad07
2 changed files with 25 additions and 6 deletions
10
projects/npmjs.com/npm-shim
Executable file
10
projects/npmjs.com/npm-shim
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/sh
|
||||
|
||||
# or npx fails ※
|
||||
# FIXME a patch to npm here then upstream would be preferable
|
||||
mkdir -p ~/.local/lib
|
||||
|
||||
d="$(cd "$(dirname $0)"/.. && pwd)"
|
||||
"$d"/tbin/npx "$@"
|
||||
|
||||
# ※ https://github.com/teaxyz/cli/issues/532
|
|
@ -15,14 +15,23 @@ dependencies:
|
|||
build:
|
||||
dependencies:
|
||||
crates.io/semverator: '*'
|
||||
script: |
|
||||
if semverator satisfies '^8,>=9.4.2' {{ version }}; then
|
||||
ARGS="--install-links"
|
||||
fi
|
||||
script:
|
||||
- |
|
||||
if semverator satisfies '^8,>=9.4.2' {{ version }}; then
|
||||
ARGS="--install-links"
|
||||
fi
|
||||
|
||||
node . install --global --prefix={{prefix}} $ARGS
|
||||
- node . install --global --prefix={{prefix}} $ARGS
|
||||
|
||||
mv props/npmrc {{prefix}}/lib/node_modules/npm
|
||||
# configures npm to install to ~/.local
|
||||
- mv props/npmrc {{prefix}}/lib/node_modules/npm
|
||||
|
||||
# our shim fixes a bug where npm doesn’t work if ~/.local/lib doesn’t exist
|
||||
- run: |
|
||||
mv ../bin/npm .
|
||||
mv $SRCROOT/props/npm-shim ../bin/npm
|
||||
working-directory:
|
||||
${{prefix}}/tbin
|
||||
|
||||
test: |
|
||||
npm install --global cowsay
|
||||
|
|
Loading…
Reference in a new issue