2015-06-15 21:54:28 +00:00
|
|
|
/*!
|
|
|
|
* Grunt file
|
|
|
|
*
|
|
|
|
* @package CodeEditor
|
|
|
|
*/
|
|
|
|
|
2022-02-07 16:22:02 +00:00
|
|
|
'use strict';
|
2016-12-09 13:21:02 +00:00
|
|
|
|
2015-06-15 21:54:28 +00:00
|
|
|
module.exports = function ( grunt ) {
|
2022-02-07 16:22:02 +00:00
|
|
|
const conf = grunt.file.readJSON( 'extension.json' );
|
2015-10-25 12:09:56 +00:00
|
|
|
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
|
|
|
},
|
2023-12-18 17:09:44 +00:00
|
|
|
all: [ '.' ]
|
2015-10-25 12:09:56 +00:00
|
|
|
},
|
2016-12-09 13:21:02 +00:00
|
|
|
stylelint: {
|
|
|
|
all: [
|
2022-03-13 22:50:06 +00:00
|
|
|
'**/*.{css,less}',
|
2016-12-09 13:21:02 +00:00
|
|
|
'!node_modules/**',
|
2024-03-15 20:19:11 +00:00
|
|
|
'!modules/lib/**',
|
2017-08-19 07:40:38 +00:00
|
|
|
'!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: {
|
2024-03-15 20:19:11 +00:00
|
|
|
ace: [ 'modules/lib/ace/*' ]
|
2018-08-19 12:05:09 +00:00
|
|
|
},
|
|
|
|
copy: {
|
|
|
|
ace: {
|
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/ace-builds/src-noconflict/',
|
|
|
|
src: [ '**' ],
|
2024-03-15 20:19:11 +00:00
|
|
|
dest: 'modules/lib/ace/'
|
2018-08-19 12:05:09 +00:00
|
|
|
},
|
2024-03-15 20:19:11 +00:00
|
|
|
'ace-misc-files': {
|
2018-08-19 12:05:09 +00:00
|
|
|
expand: true,
|
|
|
|
cwd: 'node_modules/ace-builds/',
|
2024-03-15 20:19:11 +00:00
|
|
|
src: [ 'LICENSE', 'CHANGELOG.md', 'README.md' ],
|
|
|
|
dest: 'modules/lib/ace/'
|
2018-08-19 12:05:09 +00:00
|
|
|
}
|
2015-06-15 21:54:28 +00:00
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2024-03-15 20:19:11 +00:00
|
|
|
grunt.registerTask( 'update-ace', [ 'exec:npm-update-ace', 'clean:ace', 'copy:ace', 'copy:ace-misc-files' ] );
|
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' );
|
|
|
|
};
|