-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
executable file
·60 lines (50 loc) · 1.26 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
nodeVersion=8.2.1
downloadDir=`pwd`/download
mkdir -p $downloadDir
if [ `getconf LONG_BIT` == "64" ]; then
arch=x64
else
arch=x86
fi
uname=`uname -s`
if [[ $uname =~ ^Darwin* ]]; then
nodeName=node-v$nodeVersion-darwin-$arch
elif [[ $uname =~ ^Linux* ]]; then
nodeName=node-v$nodeVersion-linux-$arch
else
echo Unknown os: $uname
exit
fi
nodeGz=$nodeName.tar.gz
nodeUrl=http://nodejs.org/dist/v$nodeVersion/$nodeGz
nodeDl=$downloadDir/$nodeGz
if [ ! -f $nodeDl ]; then
echo Downloading $nodeUrl to $nodeDl
curl -o $nodeDl $nodeUrl
fi
nodeDir=$downloadDir/$nodeName
export PATH=$nodeDir/bin:$PATH
nodeCmd=$nodeDir/bin/node
npmCmd=$nodeDir/bin/npm
if [ ! -f $npmCmd ]; then
echo Extracting node gz
tar xzf $nodeDl -C $downloadDir
fi
yarnUrl=https://yarnpkg.com/latest.tar.gz
yarnDl=$downloadDir/yarn.tar.gz
if [ ! -f $yarnDl ]; then
echo Downloading $yarnUrl to $yarnDl
curl -L -o $yarnDl $yarnUrl
fi
yarnDir=$downloadDir/yarn
mkdir -p $yarnDir
export PATH=$yarnDir/dist/bin:$PATH
yarnJs=$yarnDir/dist/bin/yarn.js
if [ ! -f $yarnJs ]; then
echo Extracting yarn gz
tar xzf $yarnDl -C $yarnDir/
fi
cp package.templ.json package.json
$nodeCmd $yarnJs install --scripts-prepend-node-path=true
exec $nodeCmd $yarnJs run --scripts-prepend-node-path=true grunt -- "$@"