phaser/Gruntfile.js

112 lines
3.4 KiB
JavaScript
Raw Normal View History

/// <binding />
2013-10-23 12:15:56 +00:00
module.exports = function (grunt) {
var loadConfig = require('load-grunt-config');
2013-10-23 12:15:56 +00:00
loadConfig(grunt, {
configPath: __dirname + '/tasks/options',
config: {
release_dir: 'build',
compile_dir: 'dist',
2015-02-19 05:01:50 +00:00
modules_dir: 'dist/modules',
2014-11-25 00:22:57 +00:00
docs_dir: 'docs',
banner: require('fs').readFileSync(__dirname + '/tasks/banner.txt', 'utf8')
2014-03-23 06:23:45 +00:00
}
});
grunt.loadTasks('tasks');
grunt.registerTask('default', ['build']);
2014-03-23 06:23:45 +00:00
2015-02-19 05:01:50 +00:00
grunt.registerTask('custom', 'Build a custom version of Phaser', function(arg) {
var modules = {
'keyboard': 'Keyboard Input',
'gamepad': 'Gamepad Input',
'bitmapdata': 'BitmapData',
'graphics': 'Graphics',
'rendertexture': 'RenderTextures',
'text': 'Text Game Object',
'tweens': 'Tween Manager',
'sound': 'Sound Manager',
'particles': 'Particle System',
'debug': 'Debug System',
'tilemap': 'Tilemaps',
'arcade': 'Arcade Physics',
'p2': 'P2 Physics',
'nophysics': 'Exclude all physics systems, tilemaps and particles'
};
var autoExclude = {
'retrofont': 'RetroFont Game Object',
'ninja': 'Ninja Physics'
}
grunt.log.writeln("----------------------------");
grunt.log.writeln("Building Phaser " + grunt.config.get('package.version') + '-custom');
grunt.log.writeln("----------------------------");
if (!grunt.option('exclude'))
{
grunt.log.errorlns("No custom build options were specified.");
grunt.log.writeln("\nUse --exclude to select which of the following modules to exclude:\n");
for (var key in modules)
{
grunt.log.writeln(key + ' - ' + modules[key]);
}
grunt.log.writeln("\nThe following are excluded automatically. Use --include to include them:\n");
for (var key in autoExclude)
{
grunt.log.writeln(key + ' - ' + autoExclude[key]);
}
grunt.log.writeln("\nFor example: --exclude p2,tilemap --include retrofont\n");
grunt.log.writeln("Note that some modules have dependencies on others.");
}
else
{
grunt.log.writeln("Excluding modules:\n");
var excludes = grunt.option('exclude').split(',');
for (var i = 0; i < excludes.length; i++)
{
if (modules[excludes[i]])
{
grunt.log.writeln("* " + excludes[i] + ' - ' + modules[excludes[i]]);
}
else
{
grunt.fail.fatal("Unknown module '" + excludes[i] + "'");
}
}
grunt.log.writeln("Building blah blah:\n");
}
});
grunt.registerTask('test', ['clean:dist', 'concat', 'uglify']);
2014-11-25 00:22:57 +00:00
grunt.registerTask('build', ['clean:dist', 'jshint', 'concat', 'uglify']);
2014-11-25 00:22:57 +00:00
grunt.registerTask('dist', ['replace:pixi', 'replace:p2', 'build', 'copy']);
2013-10-23 12:15:56 +00:00
2015-02-19 05:01:50 +00:00
grunt.registerTask('docs', ['clean:docs', 'pixidoc', 'jsdoc:html', 'replace:docs', 'clean:out']);
grunt.registerTask('tsdocs', ['clean:out', 'pixidoc', 'gitclone:plugins', 'jsdoc:json', 'buildtsdoc:pixi', 'buildtsdoc:phaser', 'replace:phasertsdefheader', 'clean:out']);
2013-10-23 12:15:56 +00:00
};