From 40d5b446cfbea436a012d1799d0d7710caca752c Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sun, 7 Aug 2016 13:36:02 -0700 Subject: Add Edge build to gulp config --- gulpfile.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index aeaf3e674..dac6cce3e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -34,6 +34,7 @@ gulp.task('copy:locales', copyTask({ destinations: [ './dist/firefox/_locales', './dist/chrome/_locales', + './dist/edge/_locales', ] })) gulp.task('copy:images', copyTask({ @@ -41,6 +42,7 @@ gulp.task('copy:images', copyTask({ destinations: [ './dist/firefox/images', './dist/chrome/images', + './dist/edge/images', ], })) gulp.task('copy:fonts', copyTask({ @@ -48,6 +50,7 @@ gulp.task('copy:fonts', copyTask({ destinations: [ './dist/firefox/fonts', './dist/chrome/fonts', + './dist/edge/fonts', ], })) gulp.task('copy:reload', copyTask({ @@ -55,6 +58,7 @@ gulp.task('copy:reload', copyTask({ destinations: [ './dist/firefox/scripts', './dist/chrome/scripts', + './dist/edge/scripts', ], pattern: '/chromereload.js', })) @@ -63,6 +67,7 @@ gulp.task('copy:root', copyTask({ destinations: [ './dist/firefox', './dist/chrome', + './dist/edge', ], pattern: '/*', })) @@ -131,13 +136,18 @@ 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')) +}) +gulp.task('zip:edge', () => { + return gulp.src('dist/edge/**') + .pipe(zip(`metamask-edge-${manifest.version}.zip`)) + .pipe(gulp.dest('builds')); +}) +gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox', 'zip:edge')) // high level tasks @@ -200,6 +210,7 @@ function bundleTask(opts) { .pipe(sourcemaps.write('./')) // writes .map file .pipe(gulp.dest('./dist/firefox/scripts')) .pipe(gulp.dest('./dist/chrome/scripts')) + .pipe(gulp.dest('./dist/edge/scripts')) .pipe(livereload()) ) -- cgit v1.2.3 From 168b4c5bc034367912f32bad6706cc91987d1085 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 1 Sep 2016 15:01:45 -0700 Subject: Install deps. Fix chrome/firefox typo. --- gulpfile.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index dac6cce3e..40ae6f203 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -16,6 +16,8 @@ var eslint = require('gulp-eslint') var fs = require('fs') var path = require('path') var manifest = require('./app/manifest.json') +var gulpif = require('gulp-if') +var replace = require('gulp-replace') // browser reload @@ -72,8 +74,8 @@ gulp.task('copy:root', copyTask({ pattern: '/*', })) -gulp.task('manifest:cleanup', function() { - return gulp.src('./dist/firefox/manifest.json') +gulp.task('manifest:chrome', function() { + return gulp.src('./dist/chrome/manifest.json') .pipe(jsoneditor(function(json) { delete json.applications return json @@ -81,7 +83,7 @@ gulp.task('manifest:cleanup', function() { .pipe(gulp.dest('./dist/chrome', { overwrite: true })) }) -gulp.task('copy', gulp.series(gulp.parallel('copy:locales','copy:images','copy:fonts','copy:reload','copy:root'), 'manifest:cleanup')) +gulp.task('copy', gulp.series(gulp.parallel('copy:locales','copy:images','copy:fonts','copy:reload','copy:root'), 'manifest:chrome')) gulp.task('copy:watch', function(){ gulp.watch(['./app/{_locales,images}/*', './app/scripts/chromereload.js', './app/*.{html,json}'], gulp.series('copy')) }) -- cgit v1.2.3 From c02be4fa66a037bd23fb5d51759b6d4a7486bf6e Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 1 Sep 2016 15:19:31 -0700 Subject: Add production flag. Conditionally copy reload based on production. --- gulpfile.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index 40ae6f203..2f2722a3b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -19,6 +19,8 @@ var manifest = require('./app/manifest.json') var gulpif = require('gulp-if') var replace = require('gulp-replace') +var production = false + // browser reload gulp.task('dev:reload', function() { @@ -83,7 +85,20 @@ gulp.task('manifest:chrome', function() { .pipe(gulp.dest('./dist/chrome', { overwrite: true })) }) -gulp.task('copy', gulp.series(gulp.parallel('copy:locales','copy:images','copy:fonts','copy:reload','copy:root'), 'manifest:chrome')) +gulp.task('manifest:production', function() { + return gulp.src([ + './dist/firefox/manifest.json', + './dist/chrome/manifest.json', + './dist/edge/manifest.json', + ],{base: './dist/'}) + .pipe(gulpif(production,jsoneditor(function(json) { + json.background.scripts = ["scripts/background.js"] + return json + }))) + .pipe(gulp.dest('./dist/', { overwrite: true })) +}) + +gulp.task('copy', gulp.series(gulp.parallel('copy:locales','copy:images','copy:fonts','copy:reload','copy:root'), 'manifest:production', 'manifest:chrome')) gulp.task('copy:watch', function(){ gulp.watch(['./app/{_locales,images}/*', './app/scripts/chromereload.js', './app/*.{html,json}'], gulp.series('copy')) }) -- cgit v1.2.3 From b4334a72b45d18c4985c1882f5da7ad4a1b907df Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 2 Sep 2016 14:00:36 -0700 Subject: Refactor for spreading. Add conditionals for livereload. --- gulpfile.js | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index 2f2722a3b..ad87586e5 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -19,7 +19,7 @@ var manifest = require('./app/manifest.json') var gulpif = require('gulp-if') var replace = require('gulp-replace') -var production = false +var production = gutil.env.production // browser reload @@ -98,7 +98,20 @@ gulp.task('manifest:production', function() { .pipe(gulp.dest('./dist/', { overwrite: true })) }) -gulp.task('copy', gulp.series(gulp.parallel('copy:locales','copy:images','copy:fonts','copy:reload','copy:root'), 'manifest:production', 'manifest:chrome')) +const staticFiles = [ + 'locales', + 'images', + 'fonts', + 'root' +] + +var copyStrings = staticFiles.map(staticFile => `copy:${staticFile}`) + +if (!production) { + copyStrings.push('copy:`reload`') +} + +gulp.task('copy', gulp.series(gulp.parallel(...copyStrings), 'manifest:production', 'manifest:chrome')) gulp.task('copy:watch', function(){ gulp.watch(['./app/{_locales,images}/*', './app/scripts/chromereload.js', './app/*.{html,json}'], gulp.series('copy')) }) @@ -132,14 +145,18 @@ const jsFiles = [ 'popup', ] +var jsDevStrings = jsFiles.map(jsFile => `dev:js:${jsFile}`) +var jsBuildStrings = jsFiles.map(jsFile => `build:js:${jsFile}`) + jsFiles.forEach((jsFile) => { gulp.task(`dev:js:${jsFile}`, bundleTask({ watch: true, filename: `${jsFile}.js` })) gulp.task(`build:js:${jsFile}`, bundleTask({ watch: false, filename: `${jsFile}.js` })) }) -gulp.task('dev:js', gulp.parallel('dev:js:inpage','dev:js:contentscript','dev:js:background','dev:js:popup')) +gulp.task('dev:js', gulp.parallel(...jsDevStrings)) + +gulp.task('build:js', gulp.parallel(...jsBuildStrings)) -gulp.task('build:js', gulp.parallel('build:js:inpage','build:js:contentscript','build:js:background','build:js:popup')) // clean dist @@ -169,6 +186,7 @@ gulp.task('zip', gulp.parallel('zip:chrome', 'zip:firefox', 'zip:edge')) // 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')) @@ -187,7 +205,7 @@ function copyTask(opts){ destinations.forEach(function(destination) { stream = stream.pipe(gulp.dest(destination)) }) - stream.pipe(livereload()) + stream.pipe(gulpif(production,livereload())) return stream } @@ -228,7 +246,7 @@ function bundleTask(opts) { .pipe(gulp.dest('./dist/firefox/scripts')) .pipe(gulp.dest('./dist/chrome/scripts')) .pipe(gulp.dest('./dist/edge/scripts')) - .pipe(livereload()) + .pipe(gulpif(!production,livereload())) ) } -- cgit v1.2.3 From 2d0077d5c67e5861628e865c1477878f3277d10d Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 2 Sep 2016 14:15:00 -0700 Subject: Changelog add and rename vars. --- gulpfile.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index ad87586e5..3d28e7198 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -19,7 +19,7 @@ var manifest = require('./app/manifest.json') var gulpif = require('gulp-if') var replace = require('gulp-replace') -var production = gutil.env.production +var disableLiveReload = gutil.env.disableLiveReload // browser reload @@ -91,7 +91,7 @@ gulp.task('manifest:production', function() { './dist/chrome/manifest.json', './dist/edge/manifest.json', ],{base: './dist/'}) - .pipe(gulpif(production,jsoneditor(function(json) { + .pipe(gulpif(disableLiveReload,jsoneditor(function(json) { json.background.scripts = ["scripts/background.js"] return json }))) @@ -107,8 +107,8 @@ const staticFiles = [ var copyStrings = staticFiles.map(staticFile => `copy:${staticFile}`) -if (!production) { - copyStrings.push('copy:`reload`') +if (!disableLiveReload) { + copyStrings.push('copy:reload') } gulp.task('copy', gulp.series(gulp.parallel(...copyStrings), 'manifest:production', 'manifest:chrome')) @@ -205,7 +205,7 @@ function copyTask(opts){ destinations.forEach(function(destination) { stream = stream.pipe(gulp.dest(destination)) }) - stream.pipe(gulpif(production,livereload())) + stream.pipe(gulpif(disableLiveReload,livereload())) return stream } @@ -246,7 +246,7 @@ function bundleTask(opts) { .pipe(gulp.dest('./dist/firefox/scripts')) .pipe(gulp.dest('./dist/chrome/scripts')) .pipe(gulp.dest('./dist/edge/scripts')) - .pipe(gulpif(!production,livereload())) + .pipe(gulpif(!disableLiveReload,livereload())) ) } -- cgit v1.2.3 From be0c605556a21a824bb841f80da58220b8b32058 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 2 Sep 2016 14:42:20 -0700 Subject: Fix boolean. --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index 3d28e7198..9f1acbf67 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -205,7 +205,7 @@ function copyTask(opts){ destinations.forEach(function(destination) { stream = stream.pipe(gulp.dest(destination)) }) - stream.pipe(gulpif(disableLiveReload,livereload())) + stream.pipe(gulpif(!disableLiveReload,livereload())) return stream } -- cgit v1.2.3