react-templates/Gruntfile.js

153 lines
4.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-02 13:35:20 +01:00
'!playground/main.browser.js',
'!playground/bundle/**',
'!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: {
2014-12-02 17:59:03 +01:00
// libs: {
// files: {
// 'playground/libs.browser.js': ['playground/libs.js']
// },
// options: {
// alias: [
// 'react:react/addons'
// ],
// shim: {
// "react/addons": {
// path: 'react/addons',
// exports: 'React',
// depends: {
// lodash: '_'
// }
// },
// "../src/reactTemplates": {
// path: '../src/reactTemplates.js',
// exports: 'reactTemplates',
// depends: {
// lodash: '_'
// }
// },
// "lodash": {
// path: 'lodash',
// exports: '_'
// },
// "brace": {
// path: 'brace',
// exports: 'brace',
// depends: {
// lodash: '_'
// }
// }
// }
//
// }
// },
2014-11-18 14:54:52 +01:00
pg: {
files: {
'playground/main.browser.js': ['playground/main.js']
2014-12-02 17:59:03 +01:00
},
options: {
transform: ['brfs'],
alias: [
'react:react/addons'
]
// exclude:['react','react/addons','../src/reactTemplates','lodash','brace','brace/mode/javascript','brace/mode/html','brace/theme/solarized_light'],
// external: [
// 'react/addons',
// '../src/reactTemplates',
// 'lodash',
// 'brace'
// ]
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
}
},
playground: {
files: [
'playground/**/*.js'
],
tasks: ['browserify:pg'],
options: {
spawn: false
}
}
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-11-18 15:06:25 +01:00
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-node-tap');
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');
var files = grunt.file.expand('playground/**/*.rt');
var conf = {commonJS: true, force: true};
conf._ = files;
var ret = reactTemplates.executeOptions(conf);
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-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
};