mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-12-23 21:32:49 +00:00
2a47e936aa
* `require()` is more direct and likely faster than a synchronous file read into user land and then sync JSON.parse (as grunt.file does) than Node natively reading and parsing a file in one go. Also benefits being less Grunt-specific and theoretically some minor benefit to IDE and static analysis. * Inline loop as for-of without the forEach function calls. Change-Id: I06c8f8729b2f4ba2c574c7aaeaa2ae56513b4595
44 lines
990 B
JavaScript
44 lines
990 B
JavaScript
/* eslint-env node */
|
|
module.exports = function ( grunt ) {
|
|
const messagesDirs = require( './extension.json' ).MessagesDirs;
|
|
for ( const subExtension of [
|
|
'QuestyCaptcha',
|
|
'ReCaptchaNoCaptcha',
|
|
'FancyCaptcha',
|
|
'MathCaptcha',
|
|
'hCaptcha'
|
|
] ) {
|
|
messagesDirs[ subExtension ] = require( './' + subExtension + '/extension.json' )
|
|
.MessagesDirs[ subExtension ]
|
|
.map( function ( path ) { return subExtension + '/' + path; } );
|
|
}
|
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
|
|
|
grunt.initConfig( {
|
|
eslint: {
|
|
options: {
|
|
cache: true,
|
|
fix: grunt.option( 'fix' )
|
|
},
|
|
all: [
|
|
'**/*.{js,json}',
|
|
'!{vendor,node_modules}/**'
|
|
]
|
|
},
|
|
stylelint: {
|
|
all: [
|
|
'**/*.{css,less}',
|
|
'!node_modules/**',
|
|
'!vendor/**'
|
|
]
|
|
},
|
|
banana: messagesDirs
|
|
} );
|
|
|
|
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'banana' ] );
|
|
grunt.registerTask( 'default', 'test' );
|
|
};
|