diff options
build - use gulp, remove grunt
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Gruntfile.js | 299 | ||||
-rw-r--r-- | gulpfile.js | 14 | ||||
-rw-r--r-- | package.json | 21 |
4 files changed, 8 insertions, 327 deletions
diff --git a/.gitignore b/.gitignore index 5d2072a6d..0ef0ceb2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ dist -gulp-dist node_modules temp diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 7ffdf9e58..000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,299 +0,0 @@ -// Generated on 2015-07-31 using generator-chrome-extension 0.3.1 -'use strict'; - -// # Globbing -// for performance reasons we're only matching one level down: -// 'test/spec/{,*/}*.js' -// use this if you want to recursively match all subfolders: -// 'test/spec/**/*.js' - -module.exports = function (grunt) { - - // Load grunt tasks automatically - require('load-grunt-tasks')(grunt); - - // Time how long tasks take. Can help when optimizing build times - require('time-grunt')(grunt); - - // Configurable paths - var config = { - app: 'app', - dist: 'dist', - modules: 'node_modules', - ui: 'node_modules/metamask-ui' - }; - - grunt.initConfig({ - - // Project settings - config: config, - - // Watches files for changes and runs tasks based on the changed files - watch: { - js: { - files: [ - '<%= config.app %>/scripts/{,*/}*.js', - '<%= config.ui %>/{,*/}*.js', - '<%= config.modules %>/web3-provider-engine/{,*/}*.js', - ], - options: { - livereload: '<%= connect.options.livereload %>' - }, - tasks: ['browserify:dev'], - }, - html: { - files: ['<%= config.app %>/{,*/}*.html'], - options: { - livereload: '<%= connect.options.livereload %>' - }, - tasks: ['copy'], - }, - manifest: { - files: '<%= config.app %>/manifest.json', - tasks: ['copy'], - }, - gruntfile: { - files: ['Gruntfile.js'] - }, - livereload: { - options: { - livereload: '<%= connect.options.livereload %>' - }, - files: [ - '<%= config.app %>/*.html', - '<%= config.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', - '<%= config.app %>/manifest.json', - '<%= config.app %>/_locales/{,*/}*.json' - ] - } - }, - - // Grunt server and dev server setting - connect: { - options: { - port: 9000, - livereload: 35729, - // change this to '0.0.0.0' to access the server from outside - hostname: 'localhost' - }, - dev: { - options: { - open: false, - base: [ - '<%= config.dist %>' - ] - } - }, - test: { - options: { - open: false, - base: [ - 'test', - '<%= config.app %>' - ] - } - } - }, - - // Empties folders to start fresh - clean: { - basic: { - files: [{ - dot: true, - src: [ - '<%= config.dist %>/*', - '!<%= config.dist %>/.git*' - ] - }] - } - }, - - // Build js files - browserify: { - dist: { - files: { - '<%= config.dist %>/scripts/background.js': ['<%= config.app %>/scripts/background.js'], - '<%= config.dist %>/scripts/contentscript.js': ['<%= config.app %>/scripts/contentscript.js'], - '<%= config.dist %>/scripts/inpage.js': ['<%= config.app %>/scripts/inpage.js'], - '<%= config.dist %>/scripts/popup.js': ['<%= config.app %>/scripts/popup.js'], - }, - }, - dev: { - options: { - watch: true, - }, - files: { - '<%= config.dist %>/scripts/background.js': ['<%= config.app %>/scripts/background.js'], - '<%= config.dist %>/scripts/contentscript.js': ['<%= config.app %>/scripts/contentscript.js'], - '<%= config.dist %>/scripts/inpage.js': ['<%= config.app %>/scripts/inpage.js'], - '<%= config.dist %>/scripts/popup.js': ['<%= config.app %>/scripts/popup.js'], - }, - }, - }, - - // minify js - uglify: { - dist: { - files: { - '<%= config.dist %>/scripts/background.js': [ - '<%= config.dist %>/scripts/background.js' - ], - '<%= config.dist %>/scripts/contentscript.js': [ - '<%= config.dist %>/scripts/contentscript.js' - ], - '<%= config.dist %>/scripts/inpage.js': [ - '<%= config.dist %>/scripts/inpage.js' - ], - } - } - }, - - // Copies remaining files to places other tasks can use - copy: { - basic: { - files: [{ - expand: true, - dot: true, - cwd: '<%= config.app %>', - dest: '<%= config.dist %>', - src: [ - '*.{ico,png,txt}', - 'images/{,*/}*.*', - '{,*/}*.html', - 'styles/{,*/}*.css', - 'styles/fonts/{,*/}*.*', - '_locales/{,*/}*.json', - 'manifest.json', - ] - }] - }, - dev: { - files: [{ - expand: true, - dot: true, - cwd: '<%= config.app %>', - dest: '<%= config.dist %>', - src: [ - 'scripts/chromereload.js', - ] - }] - }, - }, - - // Auto buildnumber, exclude dev files. smart builds that event pages - chromeManifest: { - dist: { - options: { - buildnumber: true, - indentSize: 2, - background: { - target: 'scripts/background.js', - exclude: [ - 'scripts/chromereload.js' - ] - } - }, - src: '<%= config.dist %>', - dest: '<%= config.dist %>' - }, - }, - - // Make sure code styles are up to par and there are no obvious mistakes - jshint: { - options: { - jshintrc: '.jshintrc', - reporter: require('jshint-stylish') - }, - all: [ - 'Gruntfile.js', - '<%= config.app %>/scripts/{,*/}*.js', - '!<%= config.app %>/scripts/vendor/*', - 'test/spec/{,*/}*.js' - ] - }, - - // Testing - mocha: { - all: { - options: { - run: true, - urls: ['http://localhost:<%= connect.options.port %>/index.html'] - } - } - }, - - // The following *-min tasks produce minifies files in the dist folder - imagemin: { - dist: { - files: [{ - expand: true, - cwd: '<%= config.app %>/images', - src: '{,*/}*.{gif,jpeg,jpg,png}', - dest: '<%= config.dist %>/images' - }] - } - }, - - // Compres dist files to package - compress: { - dist: { - options: { - archive: function() { - var manifest = grunt.file.readJSON('app/manifest.json'); - return 'package/metamask-' + manifest.version + '.zip'; - } - }, - files: [{ - expand: true, - cwd: 'dist/', - src: ['**'], - dest: '' - }] - } - }, - - // Run some tasks in parallel to speed up build process - concurrent: { - dist: [ - 'imagemin', - 'browserify:dist', - ], - }, - - - }); - - grunt.registerTask('dev', function () { - grunt.task.run([ - 'clean', - 'browserify:dev', - 'copy', - 'connect:dev', - - 'watch', - ]); - }); - - grunt.registerTask('test', [ - // 'jshint', - 'browserify:dist', - 'connect:test', - 'copy', - - 'mocha', - ]); - - grunt.registerTask('build', [ - 'clean', - 'concurrent:dist', - 'uglify', - 'copy:basic', - 'chromeManifest:dist', - 'compress', - ]); - - grunt.registerTask('default', [ - 'test', - 'build', - ]); -}; diff --git a/gulpfile.js b/gulpfile.js index d420f4b53..0d72c3d41 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,7 +15,7 @@ var del = require('del') gulp.task('dev:reload', function() { livereload.listen({ port: 35729, - // basePath: './gulp-dist/' + // basePath: './dist/' }) }) @@ -24,20 +24,20 @@ gulp.task('dev:reload', function() { gulp.task('copy:locales', copyTask({ source: './app/_locales/', - destination: './gulp-dist/_locales', + destination: './dist/_locales', })) gulp.task('copy:images', copyTask({ source: './app/images/', - destination: './gulp-dist/images', + destination: './dist/images', })) gulp.task('copy:reload', copyTask({ source: './app/scripts/', - destination: './gulp-dist/scripts', + destination: './dist/scripts', pattern: '/chromereload.js', })) gulp.task('copy:root', copyTask({ source: './app/', - destination: './gulp-dist', + destination: './dist', pattern: '/*', })) gulp.task('copy', gulp.parallel('copy:locales','copy:images','copy:reload','copy:root')) @@ -64,7 +64,7 @@ gulp.task('build:js', gulp.parallel('build:js:inpage','build:js:contentscript', gulp.task('clean', function clean() { - return del(['./gulp-dist']) + return del(['./dist']) }) @@ -123,7 +123,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('./gulp-dist/scripts')) + .pipe(gulp.dest('./dist/scripts')) .pipe(livereload()) ) diff --git a/package.json b/package.json index 9b8c5c1d9..66897523e 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,7 @@ "public": false, "private": true, "scripts": { - "start": "grunt dev", - "build": "grunt build" + "start": "gulp dev" }, "dependencies": { "async": "^1.5.2", @@ -28,33 +27,15 @@ "xtend": "^4.0.1" }, "devDependencies": { - "browser-sync": "^2.11.1", "browserify": "^13.0.0", "del": "^2.2.0", - "grunt": "~0.4.1", - "grunt-browserify": "^4.0.0", - "grunt-chrome-manifest": "~0.2.0", - "grunt-concurrent": "~0.5.0", - "grunt-contrib-clean": "~0.5.0", - "grunt-contrib-compress": "~0.9.1", - "grunt-contrib-connect": "~0.7.1", - "grunt-contrib-copy": "~0.5.0", - "grunt-contrib-imagemin": "~0.7.1", - "grunt-contrib-jshint": "~0.9.2", - "grunt-contrib-uglify": "~0.4.0", - "grunt-contrib-watch": "~0.6.1", - "grunt-mocha": "~0.4.10", - "grunt-svgmin": "~0.4.0", - "grunt-usemin": "~2.1.0", "gulp": "github:gulpjs/gulp#4.0", "gulp-livereload": "^3.8.1", "gulp-sourcemaps": "^1.6.0", "gulp-util": "^3.0.7", "gulp-watch": "^4.3.5", "jshint-stylish": "~0.1.5", - "load-grunt-tasks": "~0.4.0", "lodash.assign": "^4.0.6", - "time-grunt": "~0.3.1", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0", "watchify": "^3.7.0" |