grunt-console-clean
Version:
Plugin for grunt to clean up code from console object
97 lines (86 loc) • 2.64 kB
JavaScript
/*
* Grunt Console Clean
* https://github.com/tomaszczechowski/grunt-console-clean
*
* Copyright (c) 2015 Tomasz Czechowski
* Licensed under the MIT license.
*
*/
module.exports = function (grunt) {
'use strict';
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// Project configuration.
grunt.initConfig({
"console-clean": {
test1: {
files : [
{ src: ['test/test1/replace.js'], dest: 'test/test1/dist/replace.js' }
]
},
test2: {
files : [
{ src: ['test/test2/replace.js'], dest: 'test/test2/dist/replace.js' }
]
},
test3: {
options: {
allows: ["warn"]
},
files : [
{ src: ['test/test3/replace.js'], dest: 'test/test3/dist/replace.js' }
]
},
test4: {
options: {
strategy: function (content) {
return '//' + content;
}
},
files : [
{ src: ['test/test4/replace.js'], dest: 'test/test4/dist/replace.js' }
]
},
test5: {
files : [
{ src: ['test/test5/replace.js'], dest: 'test/test5/dist/replace.js' }
]
}
},
jshint: {
options: {
jshintrc : '.jshintrc'
},
files: [
'Gruntfile.js',
'tasks/*.js',
'test/*.js'
]
},
nodeunit: {
test1: ['test/test1/test.js'],
test2: ['test/test2/test.js'],
test3: ['test/test3/test.js'],
test4: ['test/test4/test.js'],
test5: ['test/test5/test.js'],
test6: ['test/test6/test.js']
},
clean: {
dist: 'test/dist/*'
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
// Whenever the "test" task is run, first clean the "tmp" dir, then run this
// plugin's task(s), then test the result.
grunt.registerTask('test-1', ['clean', 'console-clean:test1', 'nodeunit:test1']);
grunt.registerTask('test-2', ['clean', 'console-clean:test2', 'nodeunit:test2']);
grunt.registerTask('test-3', ['clean', 'console-clean:test3', 'nodeunit:test3']);
grunt.registerTask('test-4', ['clean', 'console-clean:test4', 'nodeunit:test4']);
grunt.registerTask('test-5', ['clean', 'console-clean:test5', 'nodeunit:test5']);
grunt.registerTask('test-6', ['clean', 'console-clean:test6', 'nodeunit:test6']);
// By default, lint and run all tests.
grunt.registerTask('default', ['jshint', 'test-1', 'test-2', 'test-3', 'test-4', 'test-5', 'test-6']);
};