2016-12-16 11:11:54 +00:00
|
|
|
/* eslint-evn node */
|
|
|
|
|
2015-06-20 05:09:03 +00:00
|
|
|
module.exports = function ( grunt ) {
|
2018-05-01 19:17:08 +00:00
|
|
|
const conf = grunt.file.readJSON( 'extension.json' );
|
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-watch' );
|
2016-12-16 11:11:54 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
2016-11-08 15:59:22 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
2018-02-12 19:36:32 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-svgmin' );
|
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: {
|
2018-03-19 19:43:29 +00:00
|
|
|
options: {
|
2018-10-08 14:40:57 +00:00
|
|
|
cache: true,
|
2018-06-27 22:55:06 +00:00
|
|
|
maxWarnings: 0,
|
2020-04-27 18:58:30 +00:00
|
|
|
fix: grunt.option( 'fix' )
|
2017-09-05 20:31:21 +00:00
|
|
|
},
|
2020-04-27 18:58:30 +00:00
|
|
|
all: {
|
2018-03-27 19:43:14 +00:00
|
|
|
src: [
|
2019-08-05 12:24:59 +00:00
|
|
|
'*.{js,json}',
|
|
|
|
'src/**/*.{js,json}',
|
2020-04-27 18:58:30 +00:00
|
|
|
'tests/**/*.{js,json}',
|
|
|
|
// Lint the built artifacts with ES5 so that no ES6 slips to production
|
|
|
|
'resources/dist/*.js'
|
2018-03-27 19:43:14 +00:00
|
|
|
]
|
2017-09-05 20:31:21 +00:00
|
|
|
}
|
2015-08-26 10:15:16 +00:00
|
|
|
},
|
2016-11-08 15:59:22 +00:00
|
|
|
stylelint: {
|
|
|
|
options: {
|
2020-02-24 14:11:21 +00:00
|
|
|
syntax: 'less',
|
|
|
|
fix: grunt.option( 'fix' )
|
2016-11-08 15:59:22 +00:00
|
|
|
},
|
|
|
|
all: [
|
2018-05-31 11:56:54 +00:00
|
|
|
'src/**/*.less'
|
2016-11-08 15:59:22 +00:00
|
|
|
]
|
|
|
|
},
|
2018-02-12 19:36:32 +00:00
|
|
|
// SVG Optimization
|
|
|
|
svgmin: {
|
|
|
|
options: grunt.file.readJSON( '.svgo.json' ),
|
|
|
|
all: {
|
|
|
|
files: [ {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'resources/ext.popups.images',
|
|
|
|
src: [
|
|
|
|
'**/*.svg'
|
|
|
|
],
|
|
|
|
dest: 'resources/ext.popups.images/',
|
|
|
|
ext: '.svg'
|
|
|
|
} ]
|
|
|
|
}
|
|
|
|
},
|
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: {
|
2017-10-16 20:09:56 +00:00
|
|
|
files: [ 'resources/ext.popups.main/**/*.less', 'resources/**/*.js' ],
|
2016-11-08 15:59:22 +00:00
|
|
|
tasks: [ 'lint' ]
|
|
|
|
},
|
|
|
|
configFiles: {
|
|
|
|
files: [ 'Gruntfile.js' ],
|
|
|
|
options: {
|
|
|
|
reload: true
|
|
|
|
}
|
|
|
|
}
|
2015-06-20 05:09:03 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2020-04-27 18:58:30 +00:00
|
|
|
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'banana', 'svgmin' ] );
|
2017-04-25 12:06:02 +00:00
|
|
|
grunt.registerTask( 'default', [ 'lint' ] );
|
2015-06-20 05:09:03 +00:00
|
|
|
};
|