UNPKG

grunt-banana-checker

Version:

Checker for the 'Banana' JSON-file format for interface messages, as used by MediaWiki and jQuery.i18n.

30 lines (23 loc) 691 B
'use strict'; const bananaChecker = require( '../src/banana.js' ); /*! * Grunt task wrapper for the banana-checker */ module.exports = function ( grunt ) { grunt.registerMultiTask( 'banana', function () { const options = this.options(); const messageDirs = this.filesSrc.length; if ( messageDirs === 0 ) { grunt.log.error( 'Target directory does not exist.' ); return false; } let ok = true; for ( const dir of this.filesSrc ) { ok = bananaChecker( dir, options, grunt.log.error, grunt.log.warn, true ) && ok; } if ( !ok ) { return false; } grunt.log.ok( `${ messageDirs } message director${ ( messageDirs > 1 ? 'ies' : 'y' ) } checked.` ); } ); };