react-templates/Gruntfile.js

119 lines
3.7 KiB
JavaScript
Raw Normal View History

2014-11-18 15:06:25 +01:00
'use strict';
2014-11-18 14:54:52 +01:00
module.exports = function (grunt) {
grunt.initConfig({
clean: {
main: {
src: ['playground/**/*.rt.js']
}
},
eslint: {
all: {
src: [
2014-11-18 15:06:25 +01:00
'src/**/*.js', 'playground/**/*.js',
2014-12-08 11:45:32 +01:00
'!playground/libs/**/*.js',
'!playground/rt-main.browser.js',
2014-12-02 13:35:20 +01:00
'!playground/bundle/**',
2014-12-03 17:44:57 +01:00
'!playground/tmp/**',
2014-12-02 13:35:20 +01:00
'!playground/**/*.rt.js'
2014-11-18 14:54:52 +01:00
]
},
teamcity: {
options: {
format: 'checkstyle',
'output-file': 'target/eslint.xml'
},
src: ['<%= eslint.all.src %>']
}
},
jasmine_node: {
options: {
forceExit: true,
match: '.',
matchall: false,
specNameMatcher: 'spec',
extensions: 'js'
},
all: ['server/test'],
grunt: ['conf/tasks/test']
},
browserify: {
rt: {
2014-12-03 17:44:57 +01:00
files: {
2014-12-28 10:52:06 +01:00
'playground/dist/rt-main.browser.js': ['playground/rt-main.js']
2014-12-03 17:44:57 +01:00
},
options: {
transform: ['brfs'],
alias: ['react:react/addons']
2014-12-02 15:57:18 +01:00
}
2014-11-18 14:54:52 +01:00
}
},
node_tap: {
default_options: {
options: {
outputType: 'tap',
outputTo: 'console'
},
files: {
2014-12-02 13:35:20 +01:00
tests: ['./test/src/*.js']
}
}
},
watch: {
rt: {
files: [
'playground/**/*.rt'
],
tasks: ['rt'],
options: {
spawn: false
}
}
2014-12-25 11:13:07 +01:00
},
uglify: {
my_target: {
//options: {
// sourceMap: true,
// sourceMapIncludeSources: true,
// sourceMapIn: 'example/coffeescript-sourcemap.js', // input sourcemap from a previous compilation
//},
files: {
2014-12-28 10:52:06 +01:00
'playground/dist/rt-main.browser.min.js': ['playground/dist/rt-main.browser.js'],
2014-12-25 11:13:07 +01:00
'playground/libs/requirejs-plugins/text.min.js': ['playground/libs/requirejs-plugins/text.js'],
'playground/libs/requirejs-plugins/json.min.js': ['playground/libs/requirejs-plugins/json.js']
}
}
},
requirejs: {
compile: {
options: eval(require('fs').readFileSync('./home.config.js').toString())
}
2014-11-18 14:54:52 +01:00
}
});
grunt.loadNpmTasks('grunt-browserify');
2014-12-02 13:35:20 +01:00
grunt.loadNpmTasks('grunt-contrib-watch');
2014-12-25 11:13:07 +01:00
grunt.loadNpmTasks('grunt-contrib-requirejs');
2014-11-18 15:06:25 +01:00
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-node-tap');
2014-12-25 11:13:07 +01:00
grunt.loadNpmTasks('grunt-contrib-uglify');
2014-11-18 14:54:52 +01:00
2014-12-02 13:35:20 +01:00
grunt.registerTask('default', ['eslint']);
grunt.registerTask('test', ['node_tap']);
grunt.registerTask('teamcity', ['eslint:teamcity']);
grunt.registerTask('rt', function () {
var reactTemplates = require('./src/cli');
2014-12-03 10:36:34 +01:00
var files = grunt.file.expand('playground/*.rt');
2014-12-28 10:47:34 +01:00
var conf = {modules: 'amd', force: true, _: files};
var ret = reactTemplates.execute(conf);
2014-12-02 13:35:20 +01:00
return ret === 0;
});
2014-11-18 14:54:52 +01:00
2014-12-02 13:35:20 +01:00
grunt.registerTask('build', ['rt', 'browserify:pg']);
2014-12-02 15:57:18 +01:00
grunt.registerTask('home', ['rt', 'browserify:home']);
2014-12-25 11:13:07 +01:00
grunt.registerTask('pgall', ['rt', 'browserify', 'uglify']);
2014-11-18 14:54:52 +01:00
2014-12-02 13:35:20 +01:00
grunt.registerTask('all', ['default', 'test']);
2014-11-18 14:54:52 +01:00
};