2015-06-15 21:54:28 +00:00
|
|
|
/*!
|
|
|
|
* Grunt file
|
|
|
|
*
|
|
|
|
* @package CodeEditor
|
|
|
|
*/
|
|
|
|
|
2016-12-09 13:21:02 +00:00
|
|
|
/* eslint-env node */
|
|
|
|
|
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' );
|
|
|
|
grunt.loadNpmTasks( 'grunt-jsonlint' );
|
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: {
|
|
|
|
reportUnusedDisableDirectives: true,
|
|
|
|
cache: true
|
|
|
|
},
|
2015-10-25 12:09:56 +00:00
|
|
|
all: [
|
|
|
|
'**/*.js',
|
|
|
|
'!node_modules/**',
|
2017-08-19 07:40:38 +00:00
|
|
|
'!modules/ace/**',
|
|
|
|
'!vendor/**'
|
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
|
|
|
},
|
2015-06-15 21:54:28 +00:00
|
|
|
banana: conf.MessagesDirs,
|
|
|
|
jsonlint: {
|
|
|
|
all: [
|
|
|
|
'**/*.json',
|
2017-08-19 07:40:38 +00:00
|
|
|
'!node_modules/**',
|
|
|
|
'!vendor/**'
|
2015-06-15 21:54:28 +00:00
|
|
|
]
|
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' ] );
|
2016-12-09 13:21:02 +00:00
|
|
|
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] );
|
2015-06-15 21:54:28 +00:00
|
|
|
grunt.registerTask( 'default', 'test' );
|
|
|
|
};
|