aboutsummaryrefslogtreecommitdiff
path: root/installer
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-05 00:39:23 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-05 00:39:23 +0900
commit3e2882279c24b3f8ef9b6a139580315025473156 (patch)
treee02143c2ef9b199bf73af0481c15a70af7d0d81e /installer
parentc0483f85f464f246e996d50e2a421972221271c0 (diff)
parent92ad5168f987b2c2d2197ebbb490ebcc31c37053 (diff)
downloadvim-lsp-settings-3e2882279c24b3f8ef9b6a139580315025473156.tar.gz
vim-lsp-settings-3e2882279c24b3f8ef9b6a139580315025473156.tar.bz2
vim-lsp-settings-3e2882279c24b3f8ef9b6a139580315025473156.zip
Merge branch 'master' of git://github.com/mattn/vim-lsp-settings
Diffstat (limited to 'installer')
-rw-r--r--installer/npm_install.cmd7
-rwxr-xr-xinstaller/npm_install.sh15
2 files changed, 13 insertions, 9 deletions
diff --git a/installer/npm_install.cmd b/installer/npm_install.cmd
index 5f1d9bb..8521869 100644
--- a/installer/npm_install.cmd
+++ b/installer/npm_install.cmd
@@ -3,9 +3,12 @@
if "x%1" equ "x" goto :EOF
if "x%2" equ "x" goto :EOF
-call npm init -y
+if not exist package.json (
+ call npm init -y
+
+ echo {"name":""}>package.json
+)
-echo {"name":""}>package.json
call npm install "%2"
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 <<EOF >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" .