mirror of
https://github.com/xHyroM/dotfiles.git
synced 2024-11-12 18:28:07 +01:00
feat: better npm-compatibility polyfill trick
This commit is contained in:
parent
4298ea7de2
commit
f17fd81900
2 changed files with 43 additions and 1 deletions
|
@ -1,2 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Trick version command
|
||||
if [[ $1 == "version" ]]; then
|
||||
echo "{\"npm\":\"9.8.1\"}"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Trick init command
|
||||
if [[ $1 == "init" ]]; then
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
--scope=*)
|
||||
SCOPE="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
pnpm init > /dev/null
|
||||
|
||||
if [ -n "$SCOPE" ]; then
|
||||
sed -i "s/\"name\": \"\(.*\)\"/\"name\": \"@$SCOPE\/\1\"/" package.json
|
||||
fi
|
||||
|
||||
cat package.json
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
# Trick install command
|
||||
if [[ $1 == "install" ]]; then
|
||||
if [ -n "$2" ]; then
|
||||
pnpm add $2
|
||||
else
|
||||
pnpm install
|
||||
fi
|
||||
|
||||
exit
|
||||
fi
|
||||
|
||||
pnpm $@
|
||||
|
|
2
.zshrc
2
.zshrc
|
@ -112,7 +112,7 @@ function pacman {
|
|||
}
|
||||
|
||||
# zigd
|
||||
export ZIGD_HOME="/home/hyro/.local/share/zigd"
|
||||
export ZIGD_HOME="/home/hyro/.zigd/bin"
|
||||
export PATH="$ZIGD_HOME:$PATH"
|
||||
# zigd end
|
||||
|
||||
|
|
Loading…
Reference in a new issue