2016-12-16 11:11:54 +00:00
|
|
|
/* eslint-evn node */
|
|
|
|
|
2015-06-20 05:09:03 +00:00
|
|
|
module.exports = function ( grunt ) {
|
2017-01-23 14:02:14 +00:00
|
|
|
var conf = grunt.file.readJSON( 'extension.json' ),
|
|
|
|
QUNIT_URL_BASE = 'http://localhost:8080/wiki/Special:JavaScriptTest/qunit/plain';
|
2016-11-08 15:59:22 +00:00
|
|
|
|
2015-06-20 05:09:03 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
2016-11-08 15:59:22 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
2016-12-16 11:11:54 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
2015-06-20 05:09:03 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
2016-11-08 15:59:22 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
2015-06-20 05:09:03 +00:00
|
|
|
|
|
|
|
grunt.initConfig( {
|
2017-01-23 14:02:14 +00:00
|
|
|
banana: conf.MessagesDirs,
|
2016-12-16 11:11:54 +00:00
|
|
|
eslint: {
|
|
|
|
fix: {
|
2016-11-08 15:59:22 +00:00
|
|
|
options: {
|
2016-12-16 11:11:54 +00:00
|
|
|
fix: true
|
2016-11-08 15:59:22 +00:00
|
|
|
},
|
2016-12-16 11:11:54 +00:00
|
|
|
src: [
|
|
|
|
'<%= eslint.all %>'
|
|
|
|
]
|
2015-08-26 10:15:16 +00:00
|
|
|
},
|
2015-10-25 16:26:26 +00:00
|
|
|
all: [
|
2017-02-13 14:02:18 +00:00
|
|
|
'src/**',
|
2016-12-16 11:11:54 +00:00
|
|
|
'resources/ext.popups/*.js',
|
|
|
|
'resources/ext.popups/**/*.js',
|
2017-02-13 13:47:59 +00:00
|
|
|
'!resources/dist/index.js',
|
2016-12-16 11:11:54 +00:00
|
|
|
'!docs/**',
|
|
|
|
'!node_modules/**'
|
|
|
|
]
|
2015-08-26 10:15:16 +00:00
|
|
|
},
|
2015-06-20 05:09:03 +00:00
|
|
|
jsonlint: {
|
|
|
|
all: [
|
2016-11-08 15:59:22 +00:00
|
|
|
'*.json',
|
2015-06-20 05:09:03 +00:00
|
|
|
'**/*.json',
|
2016-12-16 11:11:54 +00:00
|
|
|
'!docs/**',
|
2015-06-20 05:09:03 +00:00
|
|
|
'!node_modules/**'
|
|
|
|
]
|
2016-11-08 15:59:22 +00:00
|
|
|
},
|
|
|
|
qunit: {
|
|
|
|
all: {
|
|
|
|
options: {
|
2016-11-09 11:57:24 +00:00
|
|
|
timeout: 10000, // Using the filter query param takes longer
|
2016-11-08 15:59:22 +00:00
|
|
|
summaryOnly: true,
|
|
|
|
urls: [
|
2016-11-08 19:42:21 +00:00
|
|
|
// Execute any QUnit test in those module whose names begin with
|
|
|
|
// "ext.popups".
|
|
|
|
QUNIT_URL_BASE + '?filter=ext.popups'
|
2016-11-08 15:59:22 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
stylelint: {
|
|
|
|
options: {
|
|
|
|
syntax: 'less'
|
|
|
|
},
|
|
|
|
all: [
|
2016-12-16 11:11:54 +00:00
|
|
|
'resources/ext.popups/**/*.less'
|
2016-11-08 15:59:22 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
watch: {
|
2016-11-09 11:57:24 +00:00
|
|
|
options: {
|
|
|
|
interrupt: true,
|
|
|
|
debounceDelay: 1000
|
|
|
|
},
|
2016-11-08 15:59:22 +00:00
|
|
|
lint: {
|
2016-12-16 11:11:54 +00:00
|
|
|
files: [ 'resources/ext.popups/**/*.less', 'resources/**/*.js', 'tests/qunit/**/*.js' ],
|
2016-11-08 15:59:22 +00:00
|
|
|
tasks: [ 'lint' ]
|
|
|
|
},
|
|
|
|
scripts: {
|
|
|
|
files: [ 'resources/**/*.js', 'tests/qunit/**/*.js' ],
|
|
|
|
tasks: [ 'test' ]
|
|
|
|
},
|
|
|
|
configFiles: {
|
|
|
|
files: [ 'Gruntfile.js' ],
|
|
|
|
options: {
|
|
|
|
reload: true
|
|
|
|
}
|
|
|
|
}
|
2015-06-20 05:09:03 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2016-12-16 11:11:54 +00:00
|
|
|
grunt.registerTask( 'lint', [ 'eslint:all', 'stylelint', 'jsonlint', 'banana' ] );
|
2016-11-08 15:59:22 +00:00
|
|
|
grunt.registerTask( 'test', [ 'qunit' ] );
|
2016-12-16 11:11:54 +00:00
|
|
|
grunt.registerTask( 'default', [ 'lint', 'test' ] );
|
2015-06-20 05:09:03 +00:00
|
|
|
};
|