aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-09-04 05:25:12 +0800
committerGitHub <noreply@github.com>2016-09-04 05:25:12 +0800
commit9857702e69ae07137f927685f2f52c82334fdc7d (patch)
tree1b3f85cd823efc9e35156ea24d527268ef72c9fc
parent288d4a288567f75d04c46ef3f61154c0f7c7e2c9 (diff)
parentbe0c605556a21a824bb841f80da58220b8b32058 (diff)
downloadtangerine-wallet-browser-9857702e69ae07137f927685f2f52c82334fdc7d.tar.gz
tangerine-wallet-browser-9857702e69ae07137f927685f2f52c82334fdc7d.tar.zst
tangerine-wallet-browser-9857702e69ae07137f927685f2f52c82334fdc7d.zip
Merge pull request #609 from MetaMask/livereload
Add ability to disable livereload
-rw-r--r--CHANGELOG.md1
-rw-r--r--gulpfile.js49
-rw-r--r--package.json2
3 files changed, 45 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0affb2477..178879e8a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@
- Fix bug where provider menu did not allow switching to custom network from a custom network.
- Sending a transaction from within MetaMask no longer triggers a popup.
+- The ability to build without livereload features (such as for production) can be enabled with the gulp --disableLiveReload flag.
- Fix Ethereum JSON RPC Filters bug.
## 2.10.0 2016-08-29
diff --git a/gulpfile.js b/gulpfile.js
index dac6cce3e..9f1acbf67 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -16,6 +16,10 @@ 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')
+
+var disableLiveReload = gutil.env.disableLiveReload
// browser reload
@@ -72,8 +76,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 +85,33 @@ 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('manifest:production', function() {
+ return gulp.src([
+ './dist/firefox/manifest.json',
+ './dist/chrome/manifest.json',
+ './dist/edge/manifest.json',
+ ],{base: './dist/'})
+ .pipe(gulpif(disableLiveReload,jsoneditor(function(json) {
+ json.background.scripts = ["scripts/background.js"]
+ return json
+ })))
+ .pipe(gulp.dest('./dist/', { overwrite: true }))
+})
+
+const staticFiles = [
+ 'locales',
+ 'images',
+ 'fonts',
+ 'root'
+]
+
+var copyStrings = staticFiles.map(staticFile => `copy:${staticFile}`)
+
+if (!disableLiveReload) {
+ 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'))
})
@@ -115,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
@@ -152,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'))
@@ -170,7 +205,7 @@ function copyTask(opts){
destinations.forEach(function(destination) {
stream = stream.pipe(gulp.dest(destination))
})
- stream.pipe(livereload())
+ stream.pipe(gulpif(!disableLiveReload,livereload()))
return stream
}
@@ -211,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(!disableLiveReload,livereload()))
)
}
diff --git a/package.json b/package.json
index fdf6c822e..63754f417 100644
--- a/package.json
+++ b/package.json
@@ -94,8 +94,10 @@
"del": "^2.2.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-brfs": "^0.1.0",
+ "gulp-if": "^2.0.1",
"gulp-json-editor": "^2.2.1",
"gulp-livereload": "^3.8.1",
+ "gulp-replace": "^0.5.4",
"gulp-sourcemaps": "^1.6.0",
"gulp-util": "^3.0.7",
"gulp-watch": "^4.3.5",