From 6c15c16a88c24a8f2c8e04bd23e34ea367f35608 Mon Sep 17 00:00:00 2001 From: Mitsuo Heijo Date: Fri, 3 Jan 2020 13:49:23 +0900 Subject: fix: support multiple npm packages for one language server --- installer/npm_install.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/installer/npm_install.sh b/installer/npm_install.sh index 198666c..84073da 100755 --- a/installer/npm_install.sh +++ b/installer/npm_install.sh @@ -5,13 +5,14 @@ set -e -npm init -y - -# Avoid the problem of not being able to install the same package as name in package.json. -# Create an empty package.json. -cat <package.json -{"name": ""} -EOF +# Supporting multiple npm packages(e.g. typescript-language-server uses typescript-language-server and tsserver). +# If package.json exists, skip calling npm init. +if [ ! -f package.json ]; then + # Avoid the problem of not being able to install the same package as name in package.json. + # Create an empty package.json. + npm init -y + echo '{"name": ""}' >package.json +fi npm install "$2" ln -s "./node_modules/.bin/$1" . -- cgit v1.2.3-54-g00ecf