-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-script.sh
More file actions
executable file
·49 lines (39 loc) · 1.02 KB
/
run-script.sh
File metadata and controls
executable file
·49 lines (39 loc) · 1.02 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
#!/bin/bash
# Get the action to run
ACTION=$1;
SCRIPTS_FOLDER="./client";
DIST_FOLDER="./public";
CACHE_FOLDER="./cache"
function start-watchify() {
watchify -v -d -t [ babelify --presets [ es2015 ] --compact false ] $SCRIPTS_FOLDER/$1 -o $DIST_FOLDER/$2
}
function watch-client() {
NODE_PATH=$NODE_PATH:$SCRIPTS_FOLDER start-watchify index.js client.min.js
}
function start-build() {
NODE_ENV=production browserify -t [ babelify --presets [ es2015 ] --compact false ] $SCRIPTS_FOLDER/$1 | uglifyjs > $DIST_FOLDER/$2
}
function build-client() {
NODE_PATH=$NODE_PATH:$SCRIPTS_FOLDER start-build index.js client.min.js
}
function cache-clear() {
find $CACHE_FOLDER -ctime +30 -exec rm {} \;
}
function cache-clear-all() {
find $CACHE_FOLDER -type f -exec rm {} \;
}
echo "Running: ${ACTION}"
case ${ACTION} in
"watch")
watch-client
;;
"build")
build-client
;;
"cache-clear")
cache-clear
;;
"cache-clear-all")
cache-clear-all
;;
esac