mirror of
https://github.com/xHyroM/dotfiles.git
synced 2024-11-24 15:41:05 +01:00
44 lines
628 B
Bash
Executable file
44 lines
628 B
Bash
Executable file
#!/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 $@
|