mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-14 11:15:08 +00:00
fa2b10a2e7
This way, src contains sources, and dist contains distribution files. Also, add some documentation about the folders in the README and an adr. Change-Id: Ie0b9f6475b8423b90e927633d883bde3cd5d5e4d
89 lines
1.9 KiB
JavaScript
89 lines
1.9 KiB
JavaScript
/* eslint-evn node */
|
|
|
|
module.exports = function ( grunt ) {
|
|
var conf = grunt.file.readJSON( 'extension.json' ),
|
|
QUNIT_URL_BASE = 'http://localhost:8080/wiki/Special:JavaScriptTest/qunit/plain';
|
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
|
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
|
|
grunt.loadNpmTasks( 'grunt-contrib-watch' );
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
|
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
|
|
|
grunt.initConfig( {
|
|
banana: conf.MessagesDirs,
|
|
eslint: {
|
|
fix: {
|
|
options: {
|
|
fix: true
|
|
},
|
|
src: [
|
|
'<%= eslint.all %>'
|
|
]
|
|
},
|
|
all: [
|
|
'src/**',
|
|
'resources/ext.popups/*.js',
|
|
'resources/ext.popups/**/*.js',
|
|
'!resources/dist/index.js',
|
|
'!docs/**',
|
|
'!node_modules/**'
|
|
]
|
|
},
|
|
jsonlint: {
|
|
all: [
|
|
'*.json',
|
|
'**/*.json',
|
|
'!docs/**',
|
|
'!node_modules/**'
|
|
]
|
|
},
|
|
qunit: {
|
|
all: {
|
|
options: {
|
|
timeout: 10000, // Using the filter query param takes longer
|
|
summaryOnly: true,
|
|
urls: [
|
|
// Execute any QUnit test in those module whose names begin with
|
|
// "ext.popups".
|
|
QUNIT_URL_BASE + '?filter=ext.popups'
|
|
]
|
|
}
|
|
}
|
|
},
|
|
stylelint: {
|
|
options: {
|
|
syntax: 'less'
|
|
},
|
|
all: [
|
|
'resources/ext.popups/**/*.less'
|
|
]
|
|
},
|
|
watch: {
|
|
options: {
|
|
interrupt: true,
|
|
debounceDelay: 1000
|
|
},
|
|
lint: {
|
|
files: [ 'resources/ext.popups/**/*.less', 'resources/**/*.js', 'tests/qunit/**/*.js' ],
|
|
tasks: [ 'lint' ]
|
|
},
|
|
scripts: {
|
|
files: [ 'resources/**/*.js', 'tests/qunit/**/*.js' ],
|
|
tasks: [ 'test' ]
|
|
},
|
|
configFiles: {
|
|
files: [ 'Gruntfile.js' ],
|
|
options: {
|
|
reload: true
|
|
}
|
|
}
|
|
}
|
|
} );
|
|
|
|
grunt.registerTask( 'lint', [ 'eslint:all', 'stylelint', 'jsonlint', 'banana' ] );
|
|
grunt.registerTask( 'test', [ 'qunit' ] );
|
|
grunt.registerTask( 'default', [ 'lint', 'test' ] );
|
|
};
|