2015-10-29 22:19:56 +03:00
|
|
|
var fs = require('fs');
|
|
|
|
var md = require('markdown-it')();
|
|
|
|
var emoji = require('markdown-it-emoji');
|
|
|
|
|
|
|
|
|
2015-09-16 19:24:15 +03:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
// load all grunt tasks matching the ['grunt-*', '@*/grunt-*'] patterns
|
|
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
|
|
|
|
var configs = require('load-grunt-configs')(grunt, {
|
|
|
|
config: {
|
|
|
|
src: 'tasks/*.js',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
grunt.initConfig(configs);
|
|
|
|
|
2015-10-29 22:19:56 +03:00
|
|
|
grunt.registerTask('buildrules', 'Build the rules', function() {
|
|
|
|
md.use(emoji);
|
|
|
|
var markdown = md.render(fs.readFileSync('docs/rules.md',
|
|
|
|
{ encoding: 'utf8' }));
|
|
|
|
var template = fs.readFileSync('docs/rules.tmpl',
|
|
|
|
{ encoding: 'utf8' });
|
|
|
|
var html = template.replace('{{MARKDOWN}}', markdown);
|
|
|
|
fs.writeFileSync('docs/html/index.html', html);
|
|
|
|
});
|
|
|
|
|
2015-10-23 21:27:59 +03:00
|
|
|
grunt.registerTask('start', [
|
|
|
|
'webpack:eslintwatch',
|
|
|
|
'webpack:buildwatch',
|
|
|
|
]);
|
|
|
|
|
|
|
|
grunt.registerTask('build', [
|
|
|
|
'webpack:eslint',
|
|
|
|
'webpack:build',
|
|
|
|
]);
|
|
|
|
|
2015-10-29 22:19:56 +03:00
|
|
|
grunt.registerTask('publish-rules', [
|
|
|
|
'copy',
|
|
|
|
'buildrules',
|
|
|
|
'gh-pages',
|
|
|
|
]);
|
|
|
|
|
2015-10-08 17:54:41 +03:00
|
|
|
grunt.registerTask('test', [
|
|
|
|
'clean',
|
|
|
|
'instrument',
|
2015-10-23 21:27:59 +03:00
|
|
|
'webpack:eslint',
|
2015-10-23 18:59:39 +03:00
|
|
|
'webpack:coverage',
|
2015-10-08 17:54:41 +03:00
|
|
|
'mochaTest',
|
|
|
|
'storeCoverage',
|
|
|
|
'makeReport',
|
|
|
|
'eslint',
|
|
|
|
'jscs',
|
|
|
|
]);
|
2015-09-16 19:24:15 +03:00
|
|
|
|
2015-10-23 18:59:39 +03:00
|
|
|
grunt.registerTask('test-no-coverage', [
|
|
|
|
'clean',
|
2015-10-23 21:27:59 +03:00
|
|
|
'webpack:eslint',
|
2015-10-23 18:59:39 +03:00
|
|
|
'webpack:test',
|
|
|
|
'mochaTest',
|
|
|
|
'eslint',
|
|
|
|
'jscs',
|
|
|
|
]);
|
|
|
|
|
2015-09-16 19:24:15 +03:00
|
|
|
};
|