From 9912b57684d4eecad1c72d6709c59863f3dc78bf Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Sun, 19 Aug 2018 14:05:09 +0200 Subject: [PATCH] Ace: Handle updates via npm and grunt In order to update run npm install grunt update-ace This should handle all processing of updating ace, other than updating any ResourceLoader settings etc. Change-Id: I7793e49fa93e34fda96ccc69cc082cc0ac3f67ad --- Gruntfile.js | 36 ++++++++++++++++++++++++++++++++++++ Makefile | 19 ------------------- package.json | 6 +++++- 3 files changed, 41 insertions(+), 20 deletions(-) delete mode 100644 Makefile diff --git a/Gruntfile.js b/Gruntfile.js index df5bdd7f..eee7bc58 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,7 +9,10 @@ module.exports = function ( grunt ) { var conf = grunt.file.readJSON( 'extension.json' ); grunt.loadNpmTasks( 'grunt-banana-checker' ); + grunt.loadNpmTasks( 'grunt-contrib-clean' ); + grunt.loadNpmTasks( 'grunt-contrib-copy' ); grunt.loadNpmTasks( 'grunt-eslint' ); + grunt.loadNpmTasks( 'grunt-exec' ); grunt.loadNpmTasks( 'grunt-stylelint' ); grunt.loadNpmTasks( 'grunt-jsonlint' ); @@ -38,9 +41,42 @@ module.exports = function ( grunt ) { '!node_modules/**', '!vendor/**' ] + }, + 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/' + } } } ); + grunt.registerTask( 'update-ace', [ 'exec:npm-update-ace', 'clean:ace', 'copy:ace', 'copy:ace-license' ] ); grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] ); grunt.registerTask( 'default', 'test' ); }; diff --git a/Makefile b/Makefile deleted file mode 100644 index c5d81be5..00000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# Helper to pull the ace goodies - -.PHONY: all clean refresh - -all: refresh - -clean: - rm -rf modules/ace ace-git - -refresh: ace-git - test -d modules/ace || mkdir modules/ace - (cd ace-git && git checkout master && git pull origin master) - (cd ace-git && npm install && node ./Makefile.dryice.js -nc) - rsync -av ace-git/build/src-noconflict/ modules/ace/ - cp ace-git/LICENSE modules/ace/LICENSE - -ace-git: - git clone git://github.com/ajaxorg/ace.git ace-git - diff --git a/package.json b/package.json index 6d9a739a..aaa8483e 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,14 @@ "test": "grunt test" }, "devDependencies": { + "ace-builds": "1.2.9", "eslint-config-wikimedia": "0.5.0", - "grunt": "1.0.1", + "grunt": "1.0.3", "grunt-banana-checker": "0.6.0", + "grunt-contrib-clean": "1.1.0", + "grunt-contrib-copy": "1.0.0", "grunt-eslint": "20.1.0", + "grunt-exec": "3.0.0", "grunt-jsonlint": "1.1.0", "grunt-stylelint": "0.9.0", "postcss-less": "1.1.3",