mediawiki-extensions-Visual.../Gruntfile.js
James D. Forrester df79ed8c4b Update VE core submodule to master (5befc34)
New changes:
3368c4c Remove some assumptions about the state of the context
79918af Move contexts to subfolder
820eaec Tests for some drag/drop functionality
e5f0e3e Convert CE surface tests to use a mock UI surface
c81dbcf Localisation updates from https://translatewiki.net.
7561ff3 Create a mock UI surface that only contains a model for model-only action tests
ad60333 Convert test timings on APIResultsQueue from seconds to milliseconds
b52d7df Table cursoring tests
3f8e821 Localisation updates from https://translatewiki.net.
9c737df Update OOjs UI to v0.11.4
5befc34 Stop using deprecated aliases for OO.ui.mixin.*

Change-Id: Ida6d4ba724686d8189975c55a18c4a6c2cfe4875
2015-06-10 12:44:55 -07:00

134 lines
3 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-copy' );
grunt.loadNpmTasks( 'grunt-contrib-csslint' );
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-jscs' );
grunt.loadTasks( 'lib/ve/build/tasks' );
grunt.loadTasks( 'build/tasks' );
grunt.initConfig( {
jsduckcatconfig: {
main: {
target: '.jsduck/categories.json',
from: [
'.jsduck/mw-categories.json',
{
file: 'lib/ve/.jsduck/categories.json',
aggregate: {
'VisualEditor (core)': [
'General',
'Initialization',
'DataModel',
'ContentEditable',
'User Interface',
'Tests'
]
},
include: [ 'UnicodeJS', 'OOjs UI', 'Upstream' ]
}
]
}
},
buildloader: {
egiframe: {
targetFile: '.jsduck/eg-iframe.html',
template: '.jsduck/eg-iframe.html.template',
modules: modules,
load: [ 'visualEditor.desktop.standalone' ],
pathPrefix: 'lib/ve/',
indent: '\t\t'
}
},
jshint: {
options: {
jshintrc: true
},
all: [
'*.js',
'{.jsduck,build}/**/*.js',
'modules/**/*.js'
]
},
jscs: {
fix: {
options: {
fix: true
},
src: '<%= jshint.all %>'
},
main: {
src: '<%= jshint.all %>'
}
},
csslint: {
options: {
csslintrc: '.csslintrc'
},
all: 'modules/**/*.css'
},
banana: {
all: 'modules/ve-{mw,wmf}/i18n/'
},
copy: {
jsduck: {
src: 'lib/ve/**/*',
dest: 'docs/',
expand: true
}
},
watch: {
files: [
'.{csslintrc,jscsrc,jshintignore,jshintrc}',
'<%= jshint.all %>',
'<%= csslint.all %>'
],
tasks: 'test'
}
} );
grunt.registerTask( 'git-status', function () {
var done = this.async();
// Are there unstaged changes?
require( 'child_process' ).exec( 'git ls-files --modified', function ( err, stdout, stderr ) {
var ret = err || stderr || stdout;
if ( ret ) {
grunt.log.error( 'Unstaged changes in these files:' );
grunt.log.error( ret );
// Show a condensed diff
require( 'child_process' ).exec( 'git diff -U1 | tail -n +3', function ( err, stdout, stderr ) {
grunt.log.write( err || stderr || stdout );
done( false );
} );
} else {
grunt.log.ok( 'No unstaged changes.' );
done();
}
} );
} );
grunt.registerTask( 'build', [ 'jsduckcatconfig', 'buildloader' ] );
grunt.registerTask( 'lint', [ 'jshint', 'jscs:main', 'csslint', 'banana' ] );
grunt.registerTask( 'fix', [ 'jscs:fix' ] );
grunt.registerTask( 'test', [ 'build', 'lint' ] );
grunt.registerTask( 'test-ci', [ 'git-status' ] );
grunt.registerTask( 'default', 'test' );
if ( process.env.JENKINS_HOME ) {
grunt.renameTask( 'test', 'test-internal' );
grunt.registerTask( 'test', [ 'test-internal', 'test-ci' ] );
} else {
grunt.registerTask( 'ci', [ 'test', 'test-ci' ] );
}
};