aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <somniac@me.com>2016-07-27 06:15:40 +0800
committerGitHub <noreply@github.com>2016-07-27 06:15:40 +0800
commit2368c2993d44375203e0b85158bac707489d1137 (patch)
tree5038c8dc02720a221e52d9bfaae78e334de24a16
parent04f755a132e80fc018e42e2104f6c6feffeb183f (diff)
downloadtangerine-wallet-browser-2368c2993d44375203e0b85158bac707489d1137.tar
tangerine-wallet-browser-2368c2993d44375203e0b85158bac707489d1137.tar.gz
tangerine-wallet-browser-2368c2993d44375203e0b85158bac707489d1137.tar.bz2
tangerine-wallet-browser-2368c2993d44375203e0b85158bac707489d1137.tar.lz
tangerine-wallet-browser-2368c2993d44375203e0b85158bac707489d1137.tar.xz
tangerine-wallet-browser-2368c2993d44375203e0b85158bac707489d1137.tar.zst
tangerine-wallet-browser-2368c2993d44375203e0b85158bac707489d1137.zip
Add platform specific builds and zip tasks (#486)
* Add platform specific folders to dist folder * Remove gulp hacks * Add platform specific bundling dev and dist tasks now build into platform-specific folders within the `dist` folder. Added tasks `gulp zip` and `gulp dist`. `zip` builds the platform-specific folders into platform-specific bundles within the `dist` folder. `dist` builds and then zips all at once. * Fix chrome bundle zipping * Fix broken reference in eth warning * Fix but where web3.eth.accounts are not available in firefox. * Bump changelog
-rw-r--r--.nvmrc2
-rw-r--r--CHANGELOG.md2
-rw-r--r--README.md16
-rw-r--r--app/manifest.json5
-rw-r--r--app/scripts/lib/remote-store.js2
-rw-r--r--gulpfile.js53
-rw-r--r--package.json2
-rw-r--r--ui/app/eth-store-warning.js4
8 files changed, 56 insertions, 30 deletions
diff --git a/.nvmrc b/.nvmrc
index 9773998bc..bb83eeea2 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-v6.0.0
+v6.3.1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0a4b8664..c853ae846 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@
- Add buy Button!
- MetaMask now throws descriptive errors when apps try to use synchronous web3 methods.
- Removed firefox-specific line in manifest.
+- Got most functionality working within Firefox.
+- Fixed bug where sometimes when opening the plugin, it would not fully open until closing and re-opening.
## 2.6.2 2016-07-20
diff --git a/README.md b/README.md
index 59d52b6f1..057c85346 100644
--- a/README.md
+++ b/README.md
@@ -4,9 +4,10 @@
- Install [Node.js](https://nodejs.org/en/) version 6 or later.
- Install local dependencies with `npm install`.
- - Install gulp globally with `npm install -g gulp`.
+ - Install gulp globally with `npm install -g gulp-cli`.
- Build the project to the `./dist/` folder with `gulp build`.
- Optionally, to rebuild on file changes, run `gulp dev`.
+ - To package .zip files for distribution, run `gulp zip`, or run the full build & zip with `gulp dist`.
## Architecture
@@ -18,19 +19,6 @@
npm install
```
-### Developing with Gulp
-
-We're using an experimental version of `gulp-cli`, so if you have the old version of gulp, you'll need to uninstall it, `npm uninstall -g gulp`, and install this one instead:
-
-```bash
-npm install gulpjs/gulp-cli#4.0 -g
-```
-
-After that, you can just:
-```bash
-gulp dev
-```
-
#### In Chrome
Open `Settings` > `Extensions`.
diff --git a/app/manifest.json b/app/manifest.json
index 2c5629f7a..7039caeb8 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -8,6 +8,11 @@
"16": "images/icon-16.png",
"128": "images/icon-128.png"
},
+ "applications": {
+ "gecko": {
+ "id": "webextension@metamask.io"
+ }
+ },
"default_locale": "en",
"background": {
"scripts": [
diff --git a/app/scripts/lib/remote-store.js b/app/scripts/lib/remote-store.js
index fbfab7bad..c81d5151c 100644
--- a/app/scripts/lib/remote-store.js
+++ b/app/scripts/lib/remote-store.js
@@ -52,7 +52,7 @@ HostStore.prototype.set = function (key, value) {
HostStore.prototype.createStream = function () {
var dnode = Dnode({
- // update: this._didUpdate.bind(this),
+ update: this._didUpdate.bind(this),
})
dnode.on('remote', this._didConnect.bind(this))
return dnode
diff --git a/gulpfile.js b/gulpfile.js
index e10a4eb7d..5dbdea04b 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -6,6 +6,8 @@ var buffer = require('vinyl-buffer')
var gutil = require('gulp-util')
var watch = require('gulp-watch')
var sourcemaps = require('gulp-sourcemaps')
+var jsoneditor = require('gulp-json-editor')
+var zip = require('gulp-zip')
var assign = require('lodash.assign')
var livereload = require('gulp-livereload')
var brfs = require('gulp-brfs')
@@ -19,7 +21,7 @@ var path = require('path')
gulp.task('dev:reload', function() {
livereload.listen({
port: 35729,
- // basePath: './dist/'
+ // basePath: './dist/firefox/'
})
})
@@ -28,27 +30,41 @@ gulp.task('dev:reload', function() {
gulp.task('copy:locales', copyTask({
source: './app/_locales/',
- destination: './dist/_locales',
+ destination: './dist/firefox/_locales',
}))
gulp.task('copy:images', copyTask({
source: './app/images/',
- destination: './dist/images',
+ destination: './dist/firefox/images',
}))
gulp.task('copy:fonts', copyTask({
source: './app/fonts/',
- destination: './dist/fonts',
+ destination: './dist/firefox/fonts',
}))
gulp.task('copy:reload', copyTask({
source: './app/scripts/',
- destination: './dist/scripts',
+ destination: './dist/firefox/scripts',
pattern: '/chromereload.js',
}))
gulp.task('copy:root', copyTask({
source: './app/',
- destination: './dist',
+ destination: './dist/firefox',
pattern: '/*',
}))
-gulp.task('copy', gulp.parallel('copy:locales','copy:images','copy:fonts','copy:reload','copy:root'))
+gulp.task('manifest:cleanup', function() {
+ return gulp.src('./dist/firefox/manifest.json')
+ .pipe(jsoneditor(function(json) {
+ delete json.applications
+ return json
+ }))
+ .pipe(gulp.dest('./dist/chrome', { overwrite: false }))
+})
+gulp.task('copy:chrome', gulp.series(
+copyTask({
+ source: './dist/firefox',
+ destination: './dist/chrome',
+ pattern: '**/[^manifest]*'
+}), 'manifest:cleanup'))
+gulp.task('copy', gulp.series(gulp.parallel('copy:locales','copy:images','copy:fonts','copy:reload','copy:root'), 'copy:chrome'))
gulp.task('copy:watch', function(){
gulp.watch(['./app/{_locales,images}/*', './app/scripts/chromereload.js', './app/*.{html,json}'], gulp.series('copy'))
})
@@ -56,8 +72,8 @@ gulp.task('copy:watch', function(){
// lint js
gulp.task('lint', function () {
- // Ignoring node_modules, dist, and docs folders:
- return gulp.src(['app/**/*.js', 'ui/**/*.js', '!node_modules/**', '!dist/**', '!docs/**', '!app/scripts/chromereload.js'])
+ // Ignoring node_modules, dist/firefox, and docs folders:
+ return gulp.src(['app/**/*.js', 'ui/**/*.js', '!node_modules/**', '!dist/firefox/**', '!docs/**', '!app/scripts/chromereload.js'])
.pipe(eslint(fs.readFileSync(path.join(__dirname, '.eslintrc'))))
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
@@ -87,18 +103,31 @@ gulp.task('build:js:background', bundleTask({ watch: false, filename: 'backgroun
gulp.task('build:js:popup', bundleTask({ watch: false, filename: 'popup.js' }))
gulp.task('build:js', gulp.parallel('build:js:inpage','build:js:contentscript','build:js:background','build:js:popup'))
-// clean dist
+// clean dist/firefox
gulp.task('clean', function clean() {
- return del(['./dist'])
+ return del(['./dist/*'])
})
+// zip tasks for distribution
+gulp.task('zip:chrome', () => {
+ return gulp.src('dist/chrome/**')
+ .pipe(zip('chrome.zip'))
+ .pipe(gulp.dest('dist'));
+});
+gulp.task('zip:firefox', () => {
+ return gulp.src('dist/firefox/**')
+ .pipe(zip('firefox.zip'))
+ .pipe(gulp.dest('dist'));
+});
+gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox'))
// high level tasks
gulp.task('dev', gulp.series('dev:js', 'copy', gulp.parallel('copy:watch', 'dev:reload')))
gulp.task('build', gulp.series('clean', gulp.parallel('build:js', 'copy')))
+gulp.task('dist', gulp.series('build', 'zip'))
// task generators
@@ -152,7 +181,7 @@ function bundleTask(opts) {
.pipe(sourcemaps.init({loadMaps: true})) // loads map from browserify file
// Add transformation tasks to the pipeline here.
.pipe(sourcemaps.write('./')) // writes .map file
- .pipe(gulp.dest('./dist/scripts'))
+ .pipe(gulp.dest('./dist/firefox/scripts'))
.pipe(livereload())
)
diff --git a/package.json b/package.json
index 2c264cfd0..ded561301 100644
--- a/package.json
+++ b/package.json
@@ -88,10 +88,12 @@
"del": "^2.2.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-brfs": "^0.1.0",
+ "gulp-json-editor": "^2.2.1",
"gulp-livereload": "^3.8.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.3.5",
+ "gulp-zip": "^3.2.0",
"jsdom": "^8.1.0",
"jsdom-global": "^1.7.0",
"jshint-stylish": "~0.1.5",
diff --git a/ui/app/eth-store-warning.js b/ui/app/eth-store-warning.js
index 4cc5da81c..d77cc0870 100644
--- a/ui/app/eth-store-warning.js
+++ b/ui/app/eth-store-warning.js
@@ -56,7 +56,7 @@ EthStoreWarning.prototype.render = function () {
}, [
h('input', {
type: 'checkbox',
- onChange: this.toggleShowWarning.bind(this, event),
+ onChange: this.toggleShowWarning.bind(this),
}),
h('.warning', {
style: {
@@ -80,7 +80,7 @@ EthStoreWarning.prototype.render = function () {
)
}
-EthStoreWarning.prototype.toggleShowWarning = function (event) {
+EthStoreWarning.prototype.toggleShowWarning = function () {
this.props.dispatch(actions.agreeToEthWarning())
}