-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathng-bst.sh
40 lines (38 loc) · 955 Bytes
/
ng-bst.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
#!/bin/bash
if [ -d "dist" ]; then
echo "dist exists"
read -p "Create new one (y/n)?" answer
case "$answer" in
y|Y )
echo "#run ng build --prod command"
echo -n "Loading"
while true; do
echo -n .
sleep 1
done & trap "kill $!" EXIT
ng build --prod;
kill $! && trap " " EXIT;;
n|N ) echo "done";;
* ) echo "invalid";;
esac
else
echo "#directory /dist doesn't exist"
echo "#run ng build --prod command"
echo -n "Loading"
while true; do
echo -n "."
sleep 1
done & trap "kill $!" EXIT
ng build --prod;
kill $! && trap " " EXIT
fi
read -p "Load /dist to server (y/n)?" choice
case "$choice" in
y|Y )
#user_name - remote machine username;
#host_name - remote machine hostname (eg. ip address);
#target_path - path to target folder on your remote machine;
scp -r dist/* user_name@host_name:target_path || echo "connection failed";;
n|N ) echo "done";;
* ) echo "invalid";;
esac