aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
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 /gulpfile.js
parent04f755a132e80fc018e42e2104f6c6feffeb183f (diff)
downloadtangerine-wallet-browser-2368c2993d44375203e0b85158bac707489d1137.tar.gz
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
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js53
1 files changed, 41 insertions, 12 deletions
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())
)