aboutsummaryrefslogtreecommitdiff
path: root/installer/npm_install.sh
blob: 1726bef73c970d5df05a613f4e616a5d6980e00f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env bash

# Usage
# $ npm_install [EXECUTABLE_NAME] [NPM_NAME]

set -e

# 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" .