var shell = require("shelljs");

module.exports = function (grunt) {
    require('load-grunt-tasks')(grunt);

    grunt.initConfig({
      jshint: {
        all: [ 'gruntfile.js', 'index.js' ]
      },
      browserify: {
        dist: {
          src: 'index.js',
          dest: 'plugin.js'
        }
      },
      uglify: {
        dist: {
          files: {
            'plugin.min.js': ['plugin.js']
          }
        }
      },
      bump: {
        options: {
          files: ['package.json','bower.json'],
          updateConfigs: [],
          commit: true,
          commitMessage: 'Release v%VERSION%',
          commitFiles: ['package.json','bower.json'],
          createTag: true,
          tagName: 'v%VERSION%',
          tagMessage: 'Version %VERSION%',
          push: true,
          pushTo: 'origin',
          gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
          globalReplace: false,
          prereleaseName: false,
          regExp: false
        }
      },
    });

    grunt.registerTask('jsdoc', function(){
      shell.exec('npm run jsdoc');
    });
    grunt.registerTask('default', ['browserify','jshint','uglify','jsdoc']);
};

@@ -154,15 +154,20 @@
     
-all
+gruntfile
 : %5B
- 
 'gru
@@ -180,22 +180,335 @@
 .js'
-, 'index.js' %5D
+%5D,%0A        js: %7B%0A          options: %7B%0A            node: true,%0A            browser: true,%0A            browserify: true,%0A            globals: %7B%0A              '$': true,%0A              'jQuery': true,%0A              'tinymce': true%0A            %7D%0A          %7D,%0A          files: %7B%0A            src: %5B'src/**/*.js'%5D%0A          %7D%0A        %7D
 %0A   
@@ -744,24 +744,242 @@
  %7D%0A      %7D,%0A
+      watch: %7B%0A        gruntfile: %7B%0A          files: 'Gruntfile.js',%0A          tasks: %5B'jshint:gruntfile'%5D,%0A        %7D,%0A        js: %7B%0A          files: %5B'src/**/*.js'%5D,%0A          tasks: %5B'jshint:js'%5D,%0A        %7D%0A      %7D,%0A
       bump: 
@@ -1684,16 +1684,19 @@
 ,'jshint
+:js
 ','uglif
@@ -1705,15 +1705,23 @@
 ,'jsdoc'
+,'watch'
 %5D);%0A%7D;%0A

configure watch task and update jshint task