mediawiki-extensions-CodeEd.../Gruntfile.js
Ed Sanders c4bc2c7d36 build: Update linters
Change-Id: I0c7b153461300840deb75c695f893b3b4a778dcf
2019-11-15 16:40:39 +00:00

83 lines
1.7 KiB
JavaScript

/*!
* Grunt file
*
* @package CodeEditor
*/
/* eslint-env node, es6 */
module.exports = function ( grunt ) {
var conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-exec' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.initConfig( {
eslint: {
options: {
extensions: [ '.js', '.json' ],
cache: true
},
all: [
'**/*.{js,json}',
'!modules/ace/**',
'!{vendor,node_modules}/**'
]
},
stylelint: {
all: [
'**/*.css',
'**/*.less',
'!node_modules/**',
'!modules/ace/**',
'!vendor/**'
]
},
banana: {
options: {
requireLowerCase: false
},
all: conf.MessagesDirs.CodeEditor
},
exec: {
'npm-update-ace': {
cmd: 'npm update ace-builds',
callback: function ( error, stdout, stderr ) {
grunt.log.write( stdout );
if ( stderr ) {
grunt.log.write( 'Error: ' + stderr );
}
if ( error !== null ) {
grunt.log.error( 'update error: ' + error );
}
}
}
},
clean: {
ace: [ 'modules/ace/*' ]
},
copy: {
ace: {
expand: true,
cwd: 'node_modules/ace-builds/src-noconflict/',
src: [ '**' ],
dest: 'modules/ace/'
},
'ace-license': {
expand: true,
cwd: 'node_modules/ace-builds/',
src: [ 'LICENSE' ],
dest: 'modules/ace/'
}
}
} );
grunt.registerTask( 'update-ace', [ 'exec:npm-update-ace', 'clean:ace', 'copy:ace', 'copy:ace-license' ] );
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'banana' ] );
grunt.registerTask( 'default', 'test' );
};