aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-07-27 14:32:12 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-07-27 14:32:12 +0800
commitcf14eb4043865e26e13009f813b71f80203bf847 (patch)
treedb1a4511ff4dab29c82940965223002202336bc6 /gulpfile.js
parent3a4744dec179d0845cd9a3c306a6318dd609f4bd (diff)
parent7a8d0497324f6f05274e7ffeef828134cbf9c481 (diff)
downloadtangerine-wallet-browser-cf14eb4043865e26e13009f813b71f80203bf847.tar.gz
tangerine-wallet-browser-cf14eb4043865e26e13009f813b71f80203bf847.tar.zst
tangerine-wallet-browser-cf14eb4043865e26e13009f813b71f80203bf847.zip
Merge branch 'master' into droppo-fix
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js53
1 files changed, 42 insertions, 11 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 941155ff4..c71ccb652 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -6,19 +6,23 @@ 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')
var del = require('del')
var eslint = require('gulp-eslint')
var fs = require('fs')
var path = require('path')
+var manifest = require('./app/manifest.json')
// browser reload
gulp.task('dev:reload', function() {
livereload.listen({
port: 35729,
- // basePath: './dist/'
+ // basePath: './dist/firefox/'
})
})
@@ -27,27 +31,40 @@ 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: true }))
+})
+gulp.task('copy:chrome', gulp.series(
+copyTask({
+ source: './dist/firefox',
+ destination: './dist/chrome',
+}), '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'))
})
@@ -55,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).
@@ -90,14 +107,27 @@ gulp.task('build:js', gulp.parallel('build:js:inpage','build:js:contentscript',
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(`metamask-chrome-${manifest.version}.zip`))
+ .pipe(gulp.dest('builds'));
+});
+gulp.task('zip:firefox', () => {
+ return gulp.src('dist/firefox/**')
+ .pipe(zip(`metamask-firefox-${manifest.version}.zip`))
+ .pipe(gulp.dest('builds'));
+});
+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
@@ -144,13 +174,14 @@ function bundleTask(opts) {
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source(opts.filename))
+ .pipe(brfs())
// optional, remove if you don't need to buffer file contents
.pipe(buffer())
// optional, remove if you dont want sourcemaps
.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())
)