Skip to content

Commit 5c5f746

Browse files
authored
Fix install.sh, also try npm
Fix 1: `yarn --cwd ${LIBDIR}` Fails if there are spaces in the path. So that's quotes now. Also added a check if npm is installed, and if so, try using it. If neither are found, echoes a warning.
1 parent 3b88595 commit 5c5f746

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

lib/install.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,15 @@ set -e
44

55
LIBDIR=$(cd $(dirname $0); pwd)
66

7-
yarn --cwd ${LIBDIR}
8-
ln -s "${LIBDIR}/node_modules/.bin/lehre" "${LIBDIR}/lehre"
7+
if [ -x "$(command -v yarn)" ]; then
8+
yarn --cwd "${LIBDIR}"
9+
ln -fs "${LIBDIR}/node_modules/.bin/lehre" "${LIBDIR}/lehre"
10+
elif [ -x "$(command -v npm)" ]; then
11+
cd "$LIBDIR"
12+
npm install
13+
ln -fs "${LIBDIR}/node_modules/.bin/lehre" "${LIBDIR}/lehre"
14+
else
15+
echo 'Neither yarn nor npm was found on your path' >&2
16+
exit 1
17+
fi
18+

0 commit comments

Comments
 (0)