mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
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
This commit is contained in:
parent
04f755a132
commit
2368c2993d
@ -7,6 +7,8 @@
|
|||||||
- Add buy Button!
|
- Add buy Button!
|
||||||
- MetaMask now throws descriptive errors when apps try to use synchronous web3 methods.
|
- MetaMask now throws descriptive errors when apps try to use synchronous web3 methods.
|
||||||
- Removed firefox-specific line in manifest.
|
- 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
|
## 2.6.2 2016-07-20
|
||||||
|
|
||||||
|
16
README.md
16
README.md
@ -4,9 +4,10 @@
|
|||||||
|
|
||||||
- Install [Node.js](https://nodejs.org/en/) version 6 or later.
|
- Install [Node.js](https://nodejs.org/en/) version 6 or later.
|
||||||
- Install local dependencies with `npm install`.
|
- 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`.
|
- Build the project to the `./dist/` folder with `gulp build`.
|
||||||
- Optionally, to rebuild on file changes, run `gulp dev`.
|
- 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
|
## Architecture
|
||||||
|
|
||||||
@ -18,19 +19,6 @@
|
|||||||
npm install
|
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
|
#### In Chrome
|
||||||
|
|
||||||
Open `Settings` > `Extensions`.
|
Open `Settings` > `Extensions`.
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
"16": "images/icon-16.png",
|
"16": "images/icon-16.png",
|
||||||
"128": "images/icon-128.png"
|
"128": "images/icon-128.png"
|
||||||
},
|
},
|
||||||
|
"applications": {
|
||||||
|
"gecko": {
|
||||||
|
"id": "webextension@metamask.io"
|
||||||
|
}
|
||||||
|
},
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"background": {
|
"background": {
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
@ -52,7 +52,7 @@ HostStore.prototype.set = function (key, value) {
|
|||||||
|
|
||||||
HostStore.prototype.createStream = function () {
|
HostStore.prototype.createStream = function () {
|
||||||
var dnode = Dnode({
|
var dnode = Dnode({
|
||||||
// update: this._didUpdate.bind(this),
|
update: this._didUpdate.bind(this),
|
||||||
})
|
})
|
||||||
dnode.on('remote', this._didConnect.bind(this))
|
dnode.on('remote', this._didConnect.bind(this))
|
||||||
return dnode
|
return dnode
|
||||||
|
53
gulpfile.js
53
gulpfile.js
@ -6,6 +6,8 @@ var buffer = require('vinyl-buffer')
|
|||||||
var gutil = require('gulp-util')
|
var gutil = require('gulp-util')
|
||||||
var watch = require('gulp-watch')
|
var watch = require('gulp-watch')
|
||||||
var sourcemaps = require('gulp-sourcemaps')
|
var sourcemaps = require('gulp-sourcemaps')
|
||||||
|
var jsoneditor = require('gulp-json-editor')
|
||||||
|
var zip = require('gulp-zip')
|
||||||
var assign = require('lodash.assign')
|
var assign = require('lodash.assign')
|
||||||
var livereload = require('gulp-livereload')
|
var livereload = require('gulp-livereload')
|
||||||
var brfs = require('gulp-brfs')
|
var brfs = require('gulp-brfs')
|
||||||
@ -19,7 +21,7 @@ var path = require('path')
|
|||||||
gulp.task('dev:reload', function() {
|
gulp.task('dev:reload', function() {
|
||||||
livereload.listen({
|
livereload.listen({
|
||||||
port: 35729,
|
port: 35729,
|
||||||
// basePath: './dist/'
|
// basePath: './dist/firefox/'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -28,27 +30,41 @@ gulp.task('dev:reload', function() {
|
|||||||
|
|
||||||
gulp.task('copy:locales', copyTask({
|
gulp.task('copy:locales', copyTask({
|
||||||
source: './app/_locales/',
|
source: './app/_locales/',
|
||||||
destination: './dist/_locales',
|
destination: './dist/firefox/_locales',
|
||||||
}))
|
}))
|
||||||
gulp.task('copy:images', copyTask({
|
gulp.task('copy:images', copyTask({
|
||||||
source: './app/images/',
|
source: './app/images/',
|
||||||
destination: './dist/images',
|
destination: './dist/firefox/images',
|
||||||
}))
|
}))
|
||||||
gulp.task('copy:fonts', copyTask({
|
gulp.task('copy:fonts', copyTask({
|
||||||
source: './app/fonts/',
|
source: './app/fonts/',
|
||||||
destination: './dist/fonts',
|
destination: './dist/firefox/fonts',
|
||||||
}))
|
}))
|
||||||
gulp.task('copy:reload', copyTask({
|
gulp.task('copy:reload', copyTask({
|
||||||
source: './app/scripts/',
|
source: './app/scripts/',
|
||||||
destination: './dist/scripts',
|
destination: './dist/firefox/scripts',
|
||||||
pattern: '/chromereload.js',
|
pattern: '/chromereload.js',
|
||||||
}))
|
}))
|
||||||
gulp.task('copy:root', copyTask({
|
gulp.task('copy:root', copyTask({
|
||||||
source: './app/',
|
source: './app/',
|
||||||
destination: './dist',
|
destination: './dist/firefox',
|
||||||
pattern: '/*',
|
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.task('copy:watch', function(){
|
||||||
gulp.watch(['./app/{_locales,images}/*', './app/scripts/chromereload.js', './app/*.{html,json}'], gulp.series('copy'))
|
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
|
// lint js
|
||||||
|
|
||||||
gulp.task('lint', function () {
|
gulp.task('lint', function () {
|
||||||
// Ignoring node_modules, dist, and docs folders:
|
// Ignoring node_modules, dist/firefox, and docs folders:
|
||||||
return gulp.src(['app/**/*.js', 'ui/**/*.js', '!node_modules/**', '!dist/**', '!docs/**', '!app/scripts/chromereload.js'])
|
return gulp.src(['app/**/*.js', 'ui/**/*.js', '!node_modules/**', '!dist/firefox/**', '!docs/**', '!app/scripts/chromereload.js'])
|
||||||
.pipe(eslint(fs.readFileSync(path.join(__dirname, '.eslintrc'))))
|
.pipe(eslint(fs.readFileSync(path.join(__dirname, '.eslintrc'))))
|
||||||
// eslint.format() outputs the lint results to the console.
|
// eslint.format() outputs the lint results to the console.
|
||||||
// Alternatively use eslint.formatEach() (see Docs).
|
// 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: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'))
|
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() {
|
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
|
// high level tasks
|
||||||
|
|
||||||
gulp.task('dev', gulp.series('dev:js', 'copy', gulp.parallel('copy:watch', 'dev:reload')))
|
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('build', gulp.series('clean', gulp.parallel('build:js', 'copy')))
|
||||||
|
gulp.task('dist', gulp.series('build', 'zip'))
|
||||||
|
|
||||||
// task generators
|
// task generators
|
||||||
|
|
||||||
@ -152,7 +181,7 @@ function bundleTask(opts) {
|
|||||||
.pipe(sourcemaps.init({loadMaps: true})) // loads map from browserify file
|
.pipe(sourcemaps.init({loadMaps: true})) // loads map from browserify file
|
||||||
// Add transformation tasks to the pipeline here.
|
// Add transformation tasks to the pipeline here.
|
||||||
.pipe(sourcemaps.write('./')) // writes .map file
|
.pipe(sourcemaps.write('./')) // writes .map file
|
||||||
.pipe(gulp.dest('./dist/scripts'))
|
.pipe(gulp.dest('./dist/firefox/scripts'))
|
||||||
.pipe(livereload())
|
.pipe(livereload())
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -88,10 +88,12 @@
|
|||||||
"del": "^2.2.0",
|
"del": "^2.2.0",
|
||||||
"gulp": "github:gulpjs/gulp#4.0",
|
"gulp": "github:gulpjs/gulp#4.0",
|
||||||
"gulp-brfs": "^0.1.0",
|
"gulp-brfs": "^0.1.0",
|
||||||
|
"gulp-json-editor": "^2.2.1",
|
||||||
"gulp-livereload": "^3.8.1",
|
"gulp-livereload": "^3.8.1",
|
||||||
"gulp-sourcemaps": "^1.6.0",
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
"gulp-util": "^3.0.7",
|
"gulp-util": "^3.0.7",
|
||||||
"gulp-watch": "^4.3.5",
|
"gulp-watch": "^4.3.5",
|
||||||
|
"gulp-zip": "^3.2.0",
|
||||||
"jsdom": "^8.1.0",
|
"jsdom": "^8.1.0",
|
||||||
"jsdom-global": "^1.7.0",
|
"jsdom-global": "^1.7.0",
|
||||||
"jshint-stylish": "~0.1.5",
|
"jshint-stylish": "~0.1.5",
|
||||||
|
@ -56,7 +56,7 @@ EthStoreWarning.prototype.render = function () {
|
|||||||
}, [
|
}, [
|
||||||
h('input', {
|
h('input', {
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
onChange: this.toggleShowWarning.bind(this, event),
|
onChange: this.toggleShowWarning.bind(this),
|
||||||
}),
|
}),
|
||||||
h('.warning', {
|
h('.warning', {
|
||||||
style: {
|
style: {
|
||||||
@ -80,7 +80,7 @@ EthStoreWarning.prototype.render = function () {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
EthStoreWarning.prototype.toggleShowWarning = function (event) {
|
EthStoreWarning.prototype.toggleShowWarning = function () {
|
||||||
this.props.dispatch(actions.agreeToEthWarning())
|
this.props.dispatch(actions.agreeToEthWarning())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user