mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-27 17:40:11 +00:00
build: Simplify banana config with require() and for-of
* `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
This commit is contained in:
parent
2f9beac0fa
commit
2a47e936aa
18
Gruntfile.js
18
Gruntfile.js
|
@ -1,23 +1,17 @@
|
|||
/* eslint-env node */
|
||||
module.exports = function ( grunt ) {
|
||||
const messagesDirs = grunt.file.readJSON( 'extension.json' ).MessagesDirs;
|
||||
|
||||
const subExtensions = [
|
||||
const messagesDirs = require( './extension.json' ).MessagesDirs;
|
||||
for ( const subExtension of [
|
||||
'QuestyCaptcha',
|
||||
'ReCaptchaNoCaptcha',
|
||||
'FancyCaptcha',
|
||||
'MathCaptcha',
|
||||
'hCaptcha'
|
||||
];
|
||||
|
||||
subExtensions.forEach(
|
||||
function ( subExtension ) {
|
||||
messagesDirs[ subExtension ] = grunt.file.readJSON( subExtension + '/extension.json' ).MessagesDirs[ subExtension ].map(
|
||||
function ( path ) {
|
||||
return subExtension + '/' + path;
|
||||
] ) {
|
||||
messagesDirs[ subExtension ] = require( './' + subExtension + '/extension.json' )
|
||||
.MessagesDirs[ subExtension ]
|
||||
.map( function ( path ) { return subExtension + '/' + path; } );
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
||||
grunt.loadNpmTasks( 'grunt-eslint' );
|
||||
|
|
Loading…
Reference in a new issue