-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·47 lines (41 loc) · 978 Bytes
/
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
#!/bin/bash
#
# Build Minicons
#
# Optimize and build icons:
# ./build.sh icons
#
# Optimize, build icons and create Minicons JS:
# ./build.sh
function DELETE_TEMP {
rm -rf dist
mkdir dist
}
function BUILD_ICONS {
rm -rf dist/icons/*
rm icons/i_Active.svg
svgo --quiet --config=./configs/svgo.yml -f ./icons -o ./dist/icons
npm run parse
echo -e "\e[35m Minicons optimized and built.\033[0m"
}
function BUILD_JS {
npm run package
if [ -d '../Minicons-homepage/libs/static/assets/js' ]; then
cp dist/minicons.js ../Minicons-homepage/libs/static/assets/js
echo -e "\e[35m Copied JS to Minicons homepage.\033[0m"
fi
echo -e "\e[35m Minicons JS files built.\033[0m"
}
function RUN_TESTS {
npm test
}
if [[ $1 == "icons" ]]; then
BUILD_ICONS
echo -e "\e[37m\e[42m Build completed.\033[0m"
elif [ $# -eq 0 ]; then
DELETE_TEMP
BUILD_ICONS
BUILD_JS
RUN_TESTS
echo -e "\e[37m\e[42m Build & test completed.\033[0m"
fi