forked from bitpay/wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathghpages.sh
executable file
·51 lines (41 loc) · 1.42 KB
/
ghpages.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
#! /bin/bash
#Description: A simple script to compile and copy only the needed files for the web app.
# Configs
APPDIR="webapp"
LIBDIR="$APPDIR/lib"
DOWNLOADDIR="$APPDIR/download"
ZIPFILE="copay_webapp_.zip"
OpenColor="\033["
Red="1;31m"
Yellow="1;33m"
Green="1;32m"
CloseColor="\033[0m"
# Create/Clean temp dir
echo -e "${OpenColor}${Green}* Checking temp dir...${CloseColor}"
if [ -d $APPDIR ]; then
rm -rf $APPDIR
fi
mkdir -p $APPDIR
# Generate and copy bitcore bundle
if [ ! -d node_modules/bitcore ]; then
echo -e "${OpenColor}${Red}X The node_modules/bitcore dir does not exist. \nRun npm install and try again.${CloseColor}"
exit 1
else
echo -e "${OpenColor}${Green}* Generating bitcore bundle...${CloseColor}"
cd node_modules/bitcore
grunt --target=dev shell
cd ../..
fi
# Re-compile copayBundle.js
echo -e "${OpenColor}${Green}* Generating copay bundle...${CloseColor}"
grunt --target=dev shell
# Copy all app files
echo -e "${OpenColor}${Green}* Copying all app files...${CloseColor}"
cp -af {css,font,img,js,lib,config.js,index.html} $APPDIR
cp -af node_modules/bitcore/browser/bundle.js $LIBDIR/
mv $LIBDIR/bundle.js $LIBDIR/bitcore.js
echo -e "${OpenColor}${Green}* Zipping all app files...${CloseColor}"
zip -r $ZIPFILE $APPDIR
mkdir -p $DOWNLOADDIR
mv $ZIPFILE $DOWNLOADDIR
echo -e "${OpenColor}${Yellow}\nAwesome! You just need to copy and paste the ./webapp content to your local repository and push it.${CloseColor}"