mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
5813d53271
Also * This way we don't need to pass the --config=jsduck.config.json parameter but can run plain 'jsduck' in Jenkins. Allowing it to use the standard job template for testing. * Move processes=0 to jsduck.json. Workaround for https://github.com/senchalabs/jsduck/issues/525 * Use standard ' - Documentation' suffix, which makes the first part of the title render in bold (similar to how we do in OOjs and OOjs UI already). Change-Id: I6c9c7a1f29df0a72dc8cd0d37a83aaef23068062
114 lines
2.6 KiB
JavaScript
114 lines
2.6 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' );
|
|
grunt.loadTasks( 'lib/ve/build/tasks' );
|
|
grunt.loadTasks( 'build/tasks' );
|
|
|
|
grunt.initConfig( {
|
|
pkg: grunt.file.readJSON( 'package.json' ),
|
|
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: {
|
|
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( '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.write( ret );
|
|
grunt.log.error( 'Unstaged changes.' );
|
|
done( false );
|
|
} else {
|
|
grunt.log.ok( 'No unstaged changes.' );
|
|
done();
|
|
}
|
|
} );
|
|
} );
|
|
|
|
grunt.registerTask( 'build', [ 'jsduckcatconfig', 'buildloader' ] );
|
|
grunt.registerTask( 'lint', [ 'jshint', 'jscs', 'csslint', 'banana' ] );
|
|
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' ] );
|
|
}
|
|
};
|