A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ciphermask/Gruntfile.js

282 lines
6.4 KiB

9 years ago
// 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'
};
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'],
options: {
livereload: '<%= connect.options.livereload %>'
},
tasks: ['browserify:dev'],
9 years ago
},
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
9 years ago
connect: {
options: {
port: 9000,
livereload: 35729,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
dev: {
9 years ago
options: {
open: false,
base: [
'<%= config.dist %>'
9 years ago
]
}
},
test: {
options: {
open: false,
base: [
'test',
'<%= config.app %>'
]
}
}
},
// Empties folders to start fresh
clean: {
basic: {
9 years ago
files: [{
dot: true,
src: [
'<%= config.dist %>/*',
'!<%= config.dist %>/.git*'
]
}]
}
},
// Build js files
browserify: {
9 years ago
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'],
},
},
dev: {
9 years ago
options: {
watch: true,
9 years ago
},
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'],
},
},
9 years ago
},
// 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'
],
}
}
},
9 years ago
// Copies remaining files to places other tasks can use
copy: {
basic: {
9 years ago
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>',
dest: '<%= config.dist %>',
src: [
'*.{ico,png,txt}',
'images/{,*/}*.{webp,gif}',
'{,*/}*.html',
'styles/{,*/}*.css',
'styles/fonts/{,*/}*.*',
'_locales/{,*/}*.json',
'manifest.json',
9 years ago
]
}]
},
dev: {
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>',
dest: '<%= config.dist %>',
src: [
'images/{,*/}*.*',
'scripts/chromereload.js',
]
}]
},
9 years ago
},
// Auto buildnumber, exclude dev files. smart builds that event pages
9 years ago
chromeManifest: {
dist: {
options: {
buildnumber: true,
indentSize: 2,
background: {
target: 'scripts/background.js',
exclude: [
'scripts/chromereload.js'
]
}
},
src: '<%= config.dist %>',
9 years ago
dest: '<%= config.dist %>'
},
9 years ago
},
// 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'
}]
}
},
9 years ago
// 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',
],
},
9 years ago
});
grunt.registerTask('dev', function () {
9 years ago
grunt.task.run([
'clean',
'browserify:dev',
'copy',
'connect:dev',
'watch',
9 years ago
]);
});
grunt.registerTask('test', [
// 'jshint',
'browserify:dist',
9 years ago
'connect:test',
'copy',
'mocha',
9 years ago
]);
grunt.registerTask('build', [
'clean',
9 years ago
'concurrent:dist',
'uglify',
'copy:dist',
'chromeManifest:dist',
'compress',
9 years ago
]);
grunt.registerTask('default', [
'test',
'build',
9 years ago
]);
};