diff --git a/.gitignore b/.gitignore
index b25ec853a..16ecd65e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,11 +41,10 @@ lib/*
js/copayBundle.js
-webapp/copay-webapp
-webapp/download
-chrome/copay-chrome-extension
-chrome/copay-chrome-extension.zip
-firefox/firefox-addon
+webapp
+browser-extensions/chrome/copay-chrome-extension
+browser-extensions/chrome/copay-chrome-extension.zip
+browser-extensions/firefox/firefox-addon
version.js
android/package
diff --git a/README.md b/README.md
index 63f088f0d..1ec1f5809 100644
--- a/README.md
+++ b/README.md
@@ -146,12 +146,17 @@ else {
## Google Chrome Extension
-When you need to compile a *Chrome Extension* of Copay, you only need to run:
+To build Copay's *Chrome Extension*, run:
```
-$ sh chrome/build.sh
+$ npm run-script chrome
```
-- The ZIP file is *chrome/copay-chrome-extension.zip*
+- On sucess, the chrome extension is located at:
+`
+ browser-extensions/chrome/copay-chrome-extension
+`
+
+To install it go to `chrome://extensions/` at your chrome browser, make sure you have 'developer mode' option checked at your Chrome settings. Click on "Load unpacked chrome extension" and choose the directory mentioned above.
## Firefox Add-on
@@ -163,7 +168,7 @@ System Requirements
Run
```
-$ sh firefox/build.sh
+$ npm run-script firefox
```
- Copy the content of *firefox/firefox-addon* (lib, data, package.json) to your development path.
diff --git a/chrome/README.md b/browser-extensions/chrome/README.md
similarity index 100%
rename from chrome/README.md
rename to browser-extensions/chrome/README.md
diff --git a/chrome/build.sh b/browser-extensions/chrome/build.sh
similarity index 73%
rename from chrome/build.sh
rename to browser-extensions/chrome/build.sh
index f56db58d0..ff2bae81b 100644
--- a/chrome/build.sh
+++ b/browser-extensions/chrome/build.sh
@@ -20,7 +20,7 @@ checkOK() {
BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APPDIR="$BUILDDIR/copay-chrome-extension"
ZIPFILE="copay-chrome-extension.zip"
-VERSION=`cut -d '"' -f2 $BUILDDIR/../version.js`
+VERSION=`cut -d '"' -f2 $BUILDDIR/../../version.js`
# Move to the build directory
cd $BUILDDIR
@@ -43,14 +43,21 @@ echo "${OpenColor}${Green}* Copying all chrome-extension files...${CloseColor}"
sed "s/APP_VERSION/$VERSION/g" manifest.json > $APPDIR/manifest.json
checkOK
-cd $BUILDDIR/..
-cp -af {css,font,img,js,lib,sound,config.js,version.js,index.html,./popup.html} $APPDIR
+
+INCLUDE=`cat ../include`
+cd $BUILDDIR/../..
+LIBS=`cat index.html |grep -o -E 'src="([^"#]+)"' | cut -d'"' -f2|grep lib`
+echo "LIBS: $LIBS"
+
+CMD="rsync -rLRv --exclude-from $BUILDDIR/../exclude $INCLUDE $LIBS $APPDIR"
+echo $CMD
+$CMD
checkOK
# Zipping chrome-extension
echo "${OpenColor}${Green}* Zipping all chrome-extension files...${CloseColor}"
cd $BUILDDIR
-zip -r $ZIPFILE "`basename $APPDIR`"
+zip -qr $ZIPFILE "`basename $APPDIR`"
checkOK
-echo "${OpenColor}${Yellow}\nAwesome! We have a brand new Chome Extension, enjoy it!${CloseColor}"
+echo "${OpenColor}${Yellow}\nThe Chrome Extension is ready at $BUILDDIR.${CloseColor}"
diff --git a/chrome/manifest.json b/browser-extensions/chrome/manifest.json
similarity index 100%
rename from chrome/manifest.json
rename to browser-extensions/chrome/manifest.json
diff --git a/browser-extensions/exclude b/browser-extensions/exclude
new file mode 100644
index 000000000..80d4b5483
--- /dev/null
+++ b/browser-extensions/exclude
@@ -0,0 +1,18 @@
+lib/socket.io
+lib/*/test
+lib/*/demo
+lib/sjcl/
+lib/angular/angular.js
+lib/moment/lang
+lib/moment/min/*lang*
+lib/moment/moment.js
+lib/angular/angular.min.js.gzip
+lib/bitcore/node_modules
+lib/bitcore/.git
+lib/bitcore/docs
+lib/bitcore/lib
+lib/bitcore/examples
+lib/bitcore/coverage
+lib/bitcore/build
+.git
+tests
diff --git a/firefox/README.md b/browser-extensions/firefox/README.md
similarity index 100%
rename from firefox/README.md
rename to browser-extensions/firefox/README.md
diff --git a/firefox/build.sh b/browser-extensions/firefox/build.sh
similarity index 65%
rename from firefox/build.sh
rename to browser-extensions/firefox/build.sh
index 933722421..1e56f4285 100644
--- a/firefox/build.sh
+++ b/browser-extensions/firefox/build.sh
@@ -20,7 +20,7 @@ checkOK() {
BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APPDIR="$BUILDDIR/firefox-addon"
ZIPFILE="copay-firefox-addon.zip"
-VERSION=`cut -d '"' -f2 $BUILDDIR/../version.js`
+VERSION=`cut -d '"' -f2 $BUILDDIR/../../version.js`
# Move to the build directory
cd $BUILDDIR
@@ -30,8 +30,7 @@ echo "${OpenColor}${Green}* Checking temp dir...${CloseColor}"
if [ -d $APPDIR ]; then
rm -rf $APPDIR
fi
-
-mkdir -p "$APPDIR/data"
+mkdir -p $APPDIR
# Re-compile copayBundle.js
echo "${OpenColor}${Green}* Generating copay bundle...${CloseColor}"
@@ -40,12 +39,19 @@ checkOK
# Copy all chrome-extension files
echo "${OpenColor}${Green}* Copying all firefox-addon files...${CloseColor}"
-sed "s/APP_VERSION/$VERSION/g" package.json > $APPDIR/package.json
+
+sed "s/APP_VERSION/$VERSION/g" "$BUILDDIR/../../package.json" > $APPDIR/package.json
checkOK
-cd $BUILDDIR/..
-cp -af {css,font,img,js,lib,sound,config.js,version.js,index.html,./popup.html} "$APPDIR/data"
-cp -af "$BUILDDIR/lib" $APPDIR
+INCLUDE=`cat ../include`
+echo $INCLUDE
+cd $BUILDDIR/../..
+LIBS=`cat index.html |grep -o -E 'src="([^"#]+)"' | cut -d'"' -f2|grep lib`
+echo "LIBS: $LIBS"
+
+CMD="rsync -rLRv --exclude-from $BUILDDIR/../exclude $INCLUDE $LIBS $APPDIR/data"
+echo $CMD
+$CMD
checkOK
-echo "${OpenColor}${Yellow}\nAwesome! We have a brand new Firefox Addon, enjoy it!${CloseColor}"
+echo "${OpenColor}${Yellow}\nThe Firefox add-on is ready at $BUILDDIR!${CloseColor}"
diff --git a/firefox/lib/main.js b/browser-extensions/firefox/lib/main.js
similarity index 100%
rename from firefox/lib/main.js
rename to browser-extensions/firefox/lib/main.js
diff --git a/firefox/package.json b/browser-extensions/firefox/package.json
similarity index 100%
rename from firefox/package.json
rename to browser-extensions/firefox/package.json
diff --git a/browser-extensions/include b/browser-extensions/include
new file mode 100644
index 000000000..fe440a152
--- /dev/null
+++ b/browser-extensions/include
@@ -0,0 +1,10 @@
+css
+font
+img
+js
+sound
+config.js
+version.js
+index.html
+popup.html
+lib/angular/angular-csp.css
diff --git a/index.html b/index.html
index aac32ede5..339e7e7ce 100644
--- a/index.html
+++ b/index.html
@@ -891,12 +891,9 @@ on supported browsers please check http://www.w
go back...
-
-
-
-
+
@@ -913,8 +910,10 @@ on supported browsers please check http://www.w
-
+
+
+
diff --git a/package.json b/package.json
index 7b824cbc0..3bbbc4c45 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,9 @@
"test": "node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter spec test",
"shell": "node shell/scripts/launch.js",
- "setup-shell": "node shell/scripts/download-atom-shell.js"
+ "setup-shell": "node shell/scripts/download-atom-shell.js",
+ "chrome": "source browser-extensions/chrome/build.sh",
+ "firefox": "source browser-extensions/firefox/build.sh"
},
"homepage": "https://github.com/bitpay/copay",
"devDependencies": {