forked from ngduc/dev-benchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·74 lines (62 loc) · 1.35 KB
/
run.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
71
72
73
74
#!/usr/bin/bash
f=README.md
setStartTime () {
start=$(node -e 'a=new Date(); console.log(`${+a/1000}`)')
}
logEnd () {
echo $(echo "$(node -e 'a=new Date(); console.log(`${+a/1000}`)') - $start" | bc) > temp && tail -n 3 temp | head -1 >> $f
}
logEnd2 () {
echo $(echo "$(node -e 'a=new Date(); console.log(`${+a/1000}`)') - $start" | bc) > temp && tail -n 3 temp | head -1 >> ../$f
}
clean () {
rm -rf benchmark1 > temp
rm -rf benchmark2 > temp
rm temp
}
clean
git stash save -u
npm install yarn -g
npm install ts-node -g
npm install create-react-app -g
npm install express-generator-typescript -g
echo >> $f
echo "### $1" >> $f
echo >> $f
# --------- create an CRA webapp for benchmarking.
echo "#### CRA" >> $f
echo >> $f
echo "- create" >> $f
setStartTime
npx create-react-app benchmark1 --template typescript
logEnd
cd benchmark1
echo "- build" >> ../$f
setStartTime
npm run build
logEnd2
echo "- run tests" >> ../$f
setStartTime
CI=true npm run test
logEnd2
cd ..
clean
# --------- create an Express NodeJS app for benchmarking.
echo >> $f
echo "#### express" >> $f
echo >> $f
echo "- create" >> $f
setStartTime
npx express-generator-typescript --with-auth benchmark2
logEnd
cd benchmark2
echo "- build" >> ../$f
setStartTime
npm run build
logEnd2
echo "- run tests" >> ../$f
setStartTime
npx ts-node -r tsconfig-paths/register ./spec
logEnd2
cd ..
clean