3122f7355f
Changes: 1. npm electron start is run with local node / npm: /<airshipui_root>/tools/node-v12.16.3/bin 2. The Makefile now will install node by default 3. The Makefile will now add the node modules on command 4. Seperated out the go linter and the js linter installers Change-Id: I03904218082e73ef757e06073b548b9c3f499784
48 lines
1.9 KiB
Bash
Executable File
48 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
set -x
|
|
|
|
tools_bin_dir="${BASH_SOURCE%/*}"
|
|
node_version=v12.16.3
|
|
|
|
if [[ ! -d $tools_bin_dir/node-$node_version ]]; then
|
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
# Linux
|
|
if ! curl -sfL "https://nodejs.org/dist/$node_version/node-$node_version-linux-x64.tar.gz" | tar zxf - --directory "$tools_bin_dir"; then
|
|
printf "Something went wrong while installing linux-gnu nodejs\n" 1>&2
|
|
exit 1
|
|
else
|
|
mv $tools_bin_dir/node-$node_version-linux-x64 $tools_bin_dir/node-$node_version
|
|
fi
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
# Mac OSX
|
|
if ! curl -sfL "https://nodejs.org/dist/$node_version/node-$node_version-darwin-x64.tar.gz" | tar zxf - --directory "$tools_bin_dir"; then
|
|
printf "Something went wrong while installing Mac OSX nodejs\n" 1>&2
|
|
exit 1
|
|
else
|
|
mv $tools_bin_dir/node-$node_version-darwin-x64 $tools_bin_dir/node-$node_version
|
|
fi
|
|
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
|
# Windows
|
|
if ! wget -qO- https://nodejs.org/dist/$node_version/node-$node_version-win-x64.zip | bsdtar -xf- -C tools; then
|
|
printf "Something went wrong while installing Windows nodejs\n" 1>&2
|
|
exit 1
|
|
else
|
|
mv $tools_bin_dir/node-$node_version-win-x64 $tools_bin_dir/node-$node_version
|
|
# the windows install doesn't conform to the same directory structure so making it conform
|
|
mkdir $tools_bin_dir/node-$node_version/bin
|
|
mv $tools_bin_dir/node-$node_version/n* $tools_bin_dir/node-$node_version/bin
|
|
chmod -R a+x $tools_bin_dir/node-$node_version/bin
|
|
fi
|
|
fi
|
|
|
|
# npm requires node to also be on the path
|
|
export PATH=$(realpath $tools_bin_dir)/node-$node_version/bin:$PATH
|
|
|
|
# npm will write to a node_modules even with the --directory flag it's better to be in the root of where you want this to live
|
|
cd web
|
|
if ! npm install eslint-plugin-html@latest --save-dev; then
|
|
printf "Something went wrong while installing eslint-plugin-html\n" 1>&2
|
|
exit 1
|
|
fi
|
|
cd ..
|
|
fi |