2015-06-15 21:54:28 +00:00
|
|
|
/*!
|
|
|
|
* Grunt file
|
|
|
|
*
|
|
|
|
* @package CodeEditor
|
|
|
|
*/
|
|
|
|
|
2019-10-07 15:57:17 +00:00
|
|
|
/* eslint-env node, es6 */
|
2016-12-09 13:21:02 +00:00
|
|
|
|
2015-06-15 21:54:28 +00:00
|
|
|
module.exports = function ( grunt ) {
|
2015-10-25 12:09:56 +00:00
|
|
|
var conf = grunt.file.readJSON( 'extension.json' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-banana-checker' );
|
2018-08-19 12:05:09 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-clean' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-contrib-copy' );
|
2016-12-09 13:21:02 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-eslint' );
|
2018-08-19 12:05:09 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-exec' );
|
2016-12-09 13:21:02 +00:00
|
|
|
grunt.loadNpmTasks( 'grunt-stylelint' );
|
2015-06-15 21:54:28 +00:00
|
|
|
|
|
|
|
grunt.initConfig( {
|
2016-12-09 13:21:02 +00:00
|
|
|
eslint: {
|
2019-02-06 01:34:32 +00:00
|
|
|
options: {
|
2020-06-12 21:55:52 +00:00
|
|
|
cache: true,
|
|
|
|
fix: grunt.option( 'fix' )
|
2019-02-06 01:34:32 +00:00
|
|
|
},
|
2015-10-25 12:09:56 +00:00
|
|
|
all: [
|
2019-10-07 15:57:17 +00:00
|
|
|
'**/*.{js,json}',
|
2017-08-19 07:40:38 +00:00
|
|
|
'!modules/ace/**',
|
2019-05-06 22:27:44 +00:00
|
|
|
'!{vendor,node_modules}/**'
|
2015-10-25 12:09:56 +00:00
|
|
|
]
|
|
|
|
},
|
2016-12-09 13:21:02 +00:00
|
|
|
stylelint: {
|
|
|
|
all: [
|
|
|
|
'**/*.css',
|
|
|
|
'**/*.less',
|
|
|
|
'!node_modules/**',
|
2017-08-19 07:40:38 +00:00
|
|
|
'!modules/ace/**',
|
|
|
|
'!vendor/**'
|
2016-12-09 13:21:02 +00:00
|
|
|
]
|
2015-10-25 12:09:56 +00:00
|
|
|
},
|
2019-10-07 15:57:17 +00:00
|
|
|
banana: {
|
|
|
|
options: {
|
|
|
|
requireLowerCase: false
|
|
|
|
},
|
|
|
|
all: conf.MessagesDirs.CodeEditor
|
|
|
|
},
|
2018-08-19 12:05:09 +00:00
|
|
|
exec: {
|
|
|
|
'npm-update-ace': {
|
|
|
|
cmd: 'npm update ace-builds',
|
|
|
|
callback: function ( error, stdout, stderr ) {
|
|
|
|
grunt.log.write( stdout );
|
|
|
|
if ( stderr ) {
|
|
|
|
grunt.log.write( 'Error: ' + stderr );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( error !== null ) {
|
|
|
|
grunt.log.error( 'update error: ' + error );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
clean: {
|
|
|
|
ace: [ 'modules/ace/*' ]
|
|
|
|
},
|
|
|
|
copy: {
|
|
|
|
ace: {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/ace-builds/src-noconflict/',
|
|
|
|
src: [ '**' ],
|
|
|
|
dest: 'modules/ace/'
|
|
|
|
},
|
|
|
|
'ace-license': {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/ace-builds/',
|
|
|
|
src: [ 'LICENSE' ],
|
|
|
|
dest: 'modules/ace/'
|
|
|
|
}
|
2015-06-15 21:54:28 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2018-08-19 12:05:09 +00:00
|
|
|
grunt.registerTask( 'update-ace', [ 'exec:npm-update-ace', 'clean:ace', 'copy:ace', 'copy:ace-license' ] );
|
2019-05-06 22:27:44 +00:00
|
|
|
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'banana' ] );
|
2015-06-15 21:54:28 +00:00
|
|
|
grunt.registerTask( 'default', 'test' );
|
|
|
|
};
|