-
Notifications
You must be signed in to change notification settings - Fork 0
/
yarn.sh
executable file
·70 lines (55 loc) · 1.54 KB
/
yarn.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
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
NAME=$1
REPO=$2
gclonecd() {
git clone "$REPO" npm-local-dir && cd npm-local-dir
}
function install {
# clean cache
if [ "$1" = "cold" ]; then
yarn cache clean
fi
# remove node_modules
if [ "$2" = "empty" ]; then
rm -rf node_modules
fi
# remove node_modules
if [ "$3" = "no" ]; then
if [ -e "yarn.lock" ]; then
mv yarn.lock .yarn.lock
fi
if [ -e "npm-shrinkwrap.json" ]; then
mv npm-shrinkwrap.json .npm-shrinkwrap.json
fi
else
if [ -e ".yarn.lock" ]; then
mv .yarn.lock yarn.lock
fi
if [ -e ".npm-shrinkwrap.json" ]; then
mv .npm-shrinkwrap.json npm-shrinkwrap.json
fi
fi
SECONDS=0
time yarn install --no-progress
DURATION=`echo $SECONDS`
../gdocs.sh $NAME $REPO $INSTALLER $INSTALLER_VERSION $($INSTALLER --version) $1 $2 $3 $DURATION
echo "$DURATION s CACHE: $1, NODE_MODULES: $2, LOCKFILE: $3"
}
gclonecd $1
# CACHE: cold, NODE_MODULES: empty, LOCKFILE: no
install cold empty no
# CACHE: cold, NODE_MODULES: empty, LOCKFILE: yes
install cold empty yes
# CACHE: cold, NODE_MODULES: installed, LOCKFILE: no
install cold installed no
# CACHE: cold, NODE_MODULES: installed, LOCKFILE: yes
install cold installed yes
# CACHE: warm, NODE_MODULES: empty, LOCKFILE: no
install warm empty no
# CACHE: warm, NODE_MODULES: empty, LOCKFILE: yes
install warm empty yes
# CACHE: warm, NODE_MODULES: installed, LOCKFILE: no
install warm installed no
# CACHE: warm, NODE_MODULES: installed, LOCKFILE: yes
install warm installed yes
cd .. && rm -rf ./npm-local-dir