-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·84 lines (61 loc) · 1.64 KB
/
install.sh
File metadata and controls
executable file
·84 lines (61 loc) · 1.64 KB
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
75
76
77
78
79
80
81
82
83
84
#!/bin/bash -e
cd $(dirname $0)
dirname="$PWD"
cd $OLDPWD
log="$dirname/build"
test=$1
mkdir -p $log
cd $1
rm -f $log/$test.deps.log $log/$test.lines.log
depMinA="100000"
depMinB="nobody"
codeMinA="100000"
codeMinB="nobody"
for i in $(echo $TOOLS | tr ' ' '\n'); do
if [ -x "$PWD/$i" ]; then
cd $i
# start with silent-ish install
npm i >/dev/null
# figure out dependency count
dep=$(npm ls | cat -n | tail -n 1 | tr -s ' ' | cut -d\ -f2)
# get rid of number for newline
dep=$[dep-1]
# add to log
echo " - $i: $dep total dependencies." >> $log/$test.deps.log
# update min
if [ "$dep" -le "$depMinA" ]; then
depMinA="$dep"
depMinB="$i"
fi
# find lines of code
length=0
for file in $(find . | grep '.js' | sed -E '/node_modules|dist|src|package/d'); do
if [ -f "$file" ]; then
n=$($dirname/node_modules/.bin/babili $file | wc -c)
n=$[n+0]
length=$[length+n]
fi
done
# add to log
echo " - $i: $length total chars of code." >> $log/$test.lines.log
# update min
if [ "$length" -le "$codeMinA" ]; then
codeMinA="$length"
codeMinB="$i"
fi
cd ..
fi
done
# log
cat > $log/$test.deps.log.tmp << _EOF
Dependency counts for $test:
$(cat $log/$test.deps.log)
The most 'lightweight' setup is via $depMinB (in terms of dependencies).
_EOF
cat > $log/$test.lines.log.tmp << _EOF
Code (characters) count for $test:
$(cat $log/$test.lines.log)
The most 'lightweight' setup is via $codeMinB (in terms of chars of code).
_EOF
mv $log/$test.deps.log.tmp $log/$test.deps.log
mv $log/$test.lines.log.tmp $log/$test.lines.log