|
@@ -4,62 +4,85 @@
|
|
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
|
- // Project configuration.
|
|
|
- grunt.initConfig({
|
|
|
- pkg: grunt.file.readJSON('package.json'),
|
|
|
- concat: {
|
|
|
- options: {
|
|
|
- sourceMap: true,
|
|
|
- banner: ";/*! <%= pkg.name %> <%= grunt.template.today('dd-mm-yyyy') %> */\n(function(){\n",
|
|
|
- footer: "}).call(this)"
|
|
|
- },
|
|
|
- dist: {
|
|
|
- src: ['src/showdown.js', 'src/helpers.js', 'src/subParsers/*.js', 'src/loader.js'],
|
|
|
- dest: 'dist/<%= pkg.name %>.js'
|
|
|
- }
|
|
|
- },
|
|
|
- uglify: {
|
|
|
- options: {
|
|
|
- sourceMap: true,
|
|
|
- banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
|
|
|
- },
|
|
|
- dist: {
|
|
|
- files: {
|
|
|
- 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- jshint: {
|
|
|
- files: ['Gruntfile.js', 'src/**/*.js']
|
|
|
- },
|
|
|
- simplemocha: {
|
|
|
- node: {
|
|
|
- src: 'test/node/**/*.js',
|
|
|
- options: {
|
|
|
- globals: ['should'],
|
|
|
- timeout: 3000,
|
|
|
- ignoreLeaks: false,
|
|
|
- reporter: 'spec'
|
|
|
- }
|
|
|
- },
|
|
|
- browser: {
|
|
|
- src: 'test/browser/**/*.js',
|
|
|
- options: {
|
|
|
- reporter: 'spec'
|
|
|
- }
|
|
|
- }
|
|
|
+ // Project configuration.
|
|
|
+ var config = {
|
|
|
+ pkg: grunt.file.readJSON('package.json'),
|
|
|
+ concat: {
|
|
|
+ options: {
|
|
|
+ sourceMap: true,
|
|
|
+ banner: ';/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n(function(){\n',
|
|
|
+ footer: '}).call(this)'
|
|
|
+ },
|
|
|
+ dist: {
|
|
|
+ src: [
|
|
|
+ 'src/showdown.js',
|
|
|
+ 'src/helpers.js',
|
|
|
+ 'src/subParsers/*.js',
|
|
|
+ 'src/loader.js'
|
|
|
+ ],
|
|
|
+ dest: 'dist/<%= pkg.name %>.js'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uglify: {
|
|
|
+ options: {
|
|
|
+ sourceMap: true,
|
|
|
+ banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
|
|
|
+ },
|
|
|
+ dist: {
|
|
|
+ files: {
|
|
|
+ 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ jshint: {
|
|
|
+ files: [
|
|
|
+ 'Gruntfile.js',
|
|
|
+ 'src/**/*.js',
|
|
|
+ 'test/**/*.js'
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ jscs: {
|
|
|
+ options: {
|
|
|
+ config: '.jscs.json',
|
|
|
+ files: [
|
|
|
+ 'Gruntfile.js',
|
|
|
+ 'src/**/*.js',
|
|
|
+ 'test/**/*.js'
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ simplemocha: {
|
|
|
+ node: {
|
|
|
+ src: 'test/node/**/*.js',
|
|
|
+ options: {
|
|
|
+ globals: ['should'],
|
|
|
+ timeout: 3000,
|
|
|
+ ignoreLeaks: false,
|
|
|
+ reporter: 'spec'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ browser: {
|
|
|
+ src: 'test/browser/**/*.js',
|
|
|
+ options: {
|
|
|
+ reporter: 'spec'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ grunt.initConfig(config);
|
|
|
|
|
|
- grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
- grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
- grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
- grunt.loadNpmTasks('grunt-simple-mocha');
|
|
|
+ grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
+ grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
+ grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
+ grunt.loadNpmTasks('grunt-simple-mocha');
|
|
|
+ grunt.loadNpmTasks('grunt-jscs');
|
|
|
|
|
|
- grunt.registerTask('test', ['jshint', 'concat', 'simplemocha']);
|
|
|
- grunt.registerTask('test-without-building', ['simplemocha']);
|
|
|
- grunt.registerTask('build', ['jshint', 'concat', 'test', 'uglify']);
|
|
|
+ grunt.registerTask('lint', ['jshint', 'jscs']);
|
|
|
+ grunt.registerTask('test', ['lint', 'concat', 'simplemocha']);
|
|
|
+ grunt.registerTask('test-without-building', ['simplemocha']);
|
|
|
+ grunt.registerTask('build', ['lint', 'test', 'uglify']);
|
|
|
|
|
|
- // Default task(s).
|
|
|
- grunt.registerTask('default', []);
|
|
|
+ // Default task(s).
|
|
|
+ grunt.registerTask('default', []);
|
|
|
};
|