mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
0c60733ec5
* Use jshintrc:true which lets grunt defer autodiscovery of the file to jshint instead of forcing it to '.jshintrc'. This allows us to override certain settings from a subdirectory, to match behaviour of standalone jshint. * Sort modules. * Use plain string instead of single-value array. Change-Id: Ib5cd48f3ff0367b8fc84627c29e4fb32452087c0
90 lines
1.9 KiB
JavaScript
90 lines
1.9 KiB
JavaScript
/*!
|
|
* Grunt file
|
|
*
|
|
* @package VisualEditor
|
|
*/
|
|
|
|
/*jshint node:true */
|
|
module.exports = function ( grunt ) {
|
|
var modules = grunt.file.readJSON( 'lib/ve/build/modules.json' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-csslint' );
|
|
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
|
grunt.loadNpmTasks( 'grunt-jscs-checker' );
|
|
grunt.loadTasks( 'lib/ve/build/tasks' );
|
|
grunt.loadTasks( 'build/tasks' );
|
|
|
|
grunt.initConfig( {
|
|
pkg: grunt.file.readJSON( 'package.json' ),
|
|
jsduckcatconfig: {
|
|
main: {
|
|
target: '.docs/categories.json',
|
|
from: [
|
|
'.docs/mw-categories.json',
|
|
{
|
|
file: 'lib/ve/.docs/categories.json',
|
|
aggregate: {
|
|
'VisualEditor (core)': [
|
|
'General',
|
|
'Initialization',
|
|
'DataModel',
|
|
'ContentEditable',
|
|
'User Interface',
|
|
'Tests'
|
|
]
|
|
},
|
|
include: [ 'UnicodeJS', 'OOJS UI', 'Upstream' ]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
buildloader: {
|
|
egiframe: {
|
|
targetFile: '.docs/eg-iframe.html',
|
|
template: '.docs/eg-iframe.html.template',
|
|
modules: modules,
|
|
load: [ 'visualEditor.desktop.standalone' ],
|
|
pathPrefix: 'lib/ve/',
|
|
indent: '\t\t'
|
|
}
|
|
},
|
|
jshint: {
|
|
options: {
|
|
jshintrc: true
|
|
},
|
|
all: [
|
|
'*.js',
|
|
'{.docs,build}/**/*.js',
|
|
'modules/**/*.js'
|
|
]
|
|
},
|
|
jscs: {
|
|
src: '<%= jshint.all %>'
|
|
},
|
|
csslint: {
|
|
options: {
|
|
csslintrc: '.csslintrc'
|
|
},
|
|
all: 'modules/*/**/*.css'
|
|
},
|
|
banana: {
|
|
all: 'modules/ve-{mw,wmf}/i18n/'
|
|
},
|
|
watch: {
|
|
files: [
|
|
'.{csslintrc,jscsrc,jshintignore,jshintrc}',
|
|
'<%= jshint.all %>',
|
|
'<%= csslint.all %>'
|
|
],
|
|
tasks: 'test'
|
|
}
|
|
} );
|
|
|
|
grunt.registerTask( 'build', [ 'jsduckcatconfig', 'buildloader' ] );
|
|
grunt.registerTask( 'lint', [ 'jshint', 'jscs', 'csslint', 'banana' ] );
|
|
grunt.registerTask( 'test', [ 'build', 'lint' ] );
|
|
grunt.registerTask( 'default', 'test' );
|
|
};
|