copay/Gruntfile.js

221 lines
5.9 KiB
JavaScript
Raw Normal View History

2014-04-07 11:31:13 -07:00
module.exports = function(grunt) {
//Load NPM tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-markdown');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-angular-gettext');
2014-09-08 11:42:55 -07:00
grunt.loadNpmTasks('grunt-jsdoc');
2014-09-19 13:22:05 -07:00
grunt.loadNpmTasks('grunt-release');
2014-04-07 11:31:13 -07:00
// Project Configuration
grunt.initConfig({
2014-09-19 13:22:05 -07:00
release: {
options: {
bump: true,
file: 'package.json',
add: true,
commit: true,
tag: true,
push: true,
pushTags: true,
npm: false,
npmtag: true,
tagName: 'v<%= version %>',
commitMessage: 'New release v<%= version %>',
tagMessage: 'Version <%= version %>',
2014-09-23 11:24:57 -07:00
github: {
2014-09-19 13:22:05 -07:00
repo: 'bitpay/copay',
usernameVar: 'GITHUB_USERNAME', //ENVIRONMENT VARIABLE that contains Github username
passwordVar: 'GITHUB_PASSWORD' //ENVIRONMENT VARIABLE that contains Github password
}
}
},
2014-04-07 11:31:13 -07:00
shell: {
prod: {
options: {
stdout: false,
2014-09-08 11:42:55 -07:00
stderr: false
},
command: 'node ./util/build.js'
},
dev: {
2014-04-07 11:31:13 -07:00
options: {
stdout: true,
stderr: true
},
command: 'node ./util/build.js -d'
2014-04-07 11:31:13 -07:00
}
},
watch: {
options: {
dateFormat: function(time) {
grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
grunt.log.writeln('Waiting for more changes...');
},
},
2014-04-07 11:31:13 -07:00
readme: {
files: ['README.md'],
tasks: ['markdown']
},
scripts: {
files: [
2014-09-02 21:25:08 -07:00
'js/models/*.js',
2014-09-01 11:40:31 -07:00
'plugins/*.js',
],
2014-08-21 12:49:04 -07:00
tasks: ['shell:dev']
2014-04-07 11:31:13 -07:00
},
css: {
files: ['css/src/*.css'],
2014-08-21 12:49:04 -07:00
tasks: ['cssmin:copay']
},
main: {
files: [
'js/init.js',
2014-09-08 11:42:55 -07:00
'js/app.js',
'js/directives.js',
'js/filters.js',
'js/routes.js',
'js/mobile.js',
2014-09-08 11:42:55 -07:00
'js/services/*.js',
2014-08-21 12:49:04 -07:00
'js/controllers/*.js'
],
tasks: ['concat:main']
},
config: {
files: ['config.js'],
tasks: ['shell:dev', 'concat:main']
}
2014-04-07 11:31:13 -07:00
},
mochaTest: {
options: {
reporter: 'spec',
},
src: ['test/*.js'],
},
markdown: {
all: {
files: [{
expand: true,
src: 'README.md',
dest: '.',
ext: '.html'
}]
}
},
concat: {
vendors: {
src: [
'lib/mousetrap/mousetrap.min.js',
'js/shell.js', // shell must be loaded before moment due to the way moment loads in a commonjs env
'lib/moment/min/moment.min.js',
'lib/qrcode-generator/js/qrcode.js',
2014-09-02 06:23:57 -07:00
'lib/underscore/underscore.js',
'lib/bitcore.js',
'lib/crypto-js/rollups/sha256.js',
'lib/crypto-js/rollups/pbkdf2.js',
'lib/crypto-js/rollups/aes.js',
'lib/file-saver/FileSaver.js',
'lib/socket.io-client/socket.io.js',
'lib/sjcl.js',
'lib/ios-imagefile-megapixel/megapix-image.js',
'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
'lib/zeroclipboard/ZeroClipboard.min.js'
],
dest: 'lib/vendors.js'
},
angular: {
src: [
'lib/angular/angular.min.js',
'lib/angular-route/angular-route.min.js',
'lib/angular-moment/angular-moment.js',
'lib/angular-qrcode/qrcode.js',
'lib/ng-idle/angular-idle.min.js',
'lib/angular-foundation/mm-foundation.min.js',
'lib/angular-foundation/mm-foundation-tpls.min.js',
2014-09-12 11:29:20 -07:00
'lib/angular-gettext/dist/angular-gettext.min.js',
'lib/angular-load/angular-load.min.js'
2014-09-17 09:03:12 -07:00
// If you add libs here, remember to add it too to karma.conf
],
dest: 'lib/angularjs-all.js'
},
main: {
src: [
2014-09-08 11:42:55 -07:00
'js/app.js',
'js/directives.js',
'js/filters.js',
'js/routes.js',
'js/services/*.js',
'js/controllers/*.js',
'js/translations.js',
'js/mobile.js', // PLACEHOLDER: CORDOVA SRIPT
2014-09-01 11:40:31 -07:00
'js/init.js',
],
dest: 'js/copayMain.js'
}
},
cssmin: {
2014-08-21 12:49:04 -07:00
copay: {
files: {
'css/copay.min.css': ['css/src/*.css'],
2014-08-21 12:49:04 -07:00
}
},
vendors: {
files: {
'css/vendors.min.css': ['css/foundation.min.css', 'css/foundation-icons.css', 'lib/angular/angular-csp.css']
}
}
},
uglify: {
options: {
mangle: false
},
prod: {
files: {
'js/copayMain.js': ['js/copayMain.js'],
'lib/angularjs-all.js': ['lib/angularjs-all.js'],
'lib/vendors.js': ['lib/vendors.js']
}
}
},
nggettext_extract: {
pot: {
files: {
'po/template.pot': ['index.html', 'views/*.html', 'views/**/*.html']
}
},
},
nggettext_compile: {
all: {
options: {
module: 'copayApp'
},
files: {
'js/translations.js': ['po/*.po']
}
},
2014-09-08 11:42:55 -07:00
},
jsdoc: {
2014-09-23 11:24:57 -07:00
dist: {
src: ['js/models/*.js', 'plugins/*.js'],
2014-09-08 11:42:55 -07:00
options: {
destination: 'doc',
configure: 'jsdoc.conf.json',
template: './node_modules/grunt-jsdoc/node_modules/ink-docstrap/template',
theme: 'flatly'
}
}
2014-04-07 11:31:13 -07:00
}
});
2014-09-08 11:42:55 -07:00
grunt.registerTask('default', ['shell:dev', 'nggettext_compile', 'concat', 'cssmin']);
grunt.registerTask('prod', ['shell:prod', 'nggettext_compile', 'concat', 'cssmin', 'uglify']);
grunt.registerTask('translate', ['nggettext_extract']);
2014-09-10 17:38:30 -07:00
grunt.registerTask('docs', ['jsdoc']);
2014-04-07 11:31:13 -07:00
};