These ignores are already in package.json. Placing these here was making `npm test` wait 10-20 seconds doing nothing waiting for Grunt to synchronously recursively glob and expand an array of every file in the current working directory (incl node_modules, and vendor) and then once more for node_modules and vendor, and then to filter one out from the other. And all before eslint even starts. Instead, give '.' to eslint as we do in some other repos already, and let it iterate on its own, skipping sub directories as it goes based on package.json/eslintIgnore. This follows-up445087e5f, which did this once before, andbe400fe75which unintentionally brought the Gruntfile part back while leading the other part behind. Change-Id: If637f2a696326778f25ea208224f5ac101f8c64a
75 lines
1.3 KiB
JavaScript
75 lines
1.3 KiB
JavaScript
/* eslint-env node, es6 */
|
|
module.exports = function ( grunt ) {
|
|
var conf = grunt.file.readJSON( 'extension.json' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
|
grunt.loadNpmTasks( 'grunt-svgmin' );
|
|
|
|
grunt.initConfig( {
|
|
eslint: {
|
|
options: {
|
|
cache: true,
|
|
fix: grunt.option( 'fix' )
|
|
},
|
|
all: [
|
|
'.'
|
|
]
|
|
},
|
|
stylelint: {
|
|
options: {
|
|
syntax: 'less'
|
|
},
|
|
src: [
|
|
'**/*.css',
|
|
'**/*.less',
|
|
'!lib/**',
|
|
'!node_modules/**',
|
|
'!vendor/**'
|
|
]
|
|
},
|
|
banana: conf.MessagesDirs,
|
|
// SVG Optimization
|
|
svgmin: {
|
|
options: {
|
|
js2svg: {
|
|
indent: '\t',
|
|
pretty: true
|
|
},
|
|
multipass: true,
|
|
plugins: [ {
|
|
cleanupIDs: false
|
|
}, {
|
|
removeDesc: false
|
|
}, {
|
|
removeRasterImages: true
|
|
}, {
|
|
removeTitle: false
|
|
}, {
|
|
removeViewBox: false
|
|
}, {
|
|
removeXMLProcInst: false
|
|
}, {
|
|
sortAttrs: true
|
|
} ]
|
|
},
|
|
all: {
|
|
files: [ {
|
|
expand: true,
|
|
cwd: 'resources/images',
|
|
src: [
|
|
'**/*.svg'
|
|
],
|
|
dest: 'resources/images/',
|
|
ext: '.svg'
|
|
} ]
|
|
}
|
|
}
|
|
} );
|
|
|
|
grunt.registerTask( 'minify', 'svgmin' );
|
|
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'banana' ] );
|
|
grunt.registerTask( 'default', [ 'minify', 'test' ] );
|
|
};
|