{"size": 3865, "ext": "js", "max_stars_repo_path": "public/static/admin/Gruntfile.js", "max_stars_repo_name": "goldenking0412/hartwell", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/static/admin/Gruntfile.js", "max_issues_repo_name": "goldenking0412/hartwell", "max_issues_repo_issues_event_min_datetime": "2021-03-09T04:52:18.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-12T11:03:26.000Z", "max_forks_repo_path": "public/static/admin/Gruntfile.js", "max_forks_repo_name": "goldenking0412/hartwell", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 24.935483871, "max_line_length": 98, "alphanum_fraction": 0.492626132}
module.exports = function( grunt ) {

  /**
   * Use matchdep to load all the grunt related dependencies into grunt.
   */
  require( 'matchdep' ).filterDev( 'grunt-*' ).forEach( grunt.loadNpmTasks );

  /**
   * Project Config!
   */
  grunt.initConfig( {
    pkg: grunt.file.readJSON( 'package.json' ),

    /**
     * The grunt wrapper for the cli ngmin. This is puts our angular controllers,
     * directives, and services into the longhand format.
     */
    ngmin: {
      controllers: {
        expand: true,
        cwd: '.compiled/js/controllers',
        src: [ '**/*.js' ],
        dest: '.compiled/js/controllers'
      },
      directives: {
        expand: true,
        cwd: '.compiled/js/directives',
        src: [ '**/*.js' ],
        dest: '.compiled/js/directives'
      },
      services: {
        expand: true,
        cwd: '.compiled/js/services',
        src: [ '**/*.js' ],
        dest: '.compiled/js/services'
      }
    },

    /**
     * This melds all the input files togther, with some annotations.
     */
    concat: {
      prod: {
        options: {
          process: function( src, filepath ) {
            return  "/*!\n"
                  + " * ------/ Source: " + filepath.replace( '.compiled/', '' ) + "\n"
                  + " */\n" + src + "\n//! END";
          }
        },
        files: {
          '.compiled/admin.min.js' : [
            'plugins/swipe.js',
            'plugins/jquery.placeholder.js',
            'plugins/fineuploader.min.js',
            'plugins/media.match.min.js',
            'plugins/enquire.min.js',
            'js/app.js',
            '.compiled/js/services/*.js',
            '.compiled/js/controllers/*.js',
            '.compiled/js/directives/*.js',
            'js/responsive.js'
          ]
        }
      }
    },

    /**
     * Using this to minify the code.
     *
     * @todo Figure out how to get mangle: true working.
     */
    uglify: {
      prod: {
        options: {
          banner: function() {

            return  "/*!\n"
                  + " */\n\n"
                  + " 'use strict';\n\n";

          }(),
          preserveComments: 'some',
          mangle: false
        },
        files: {
          'js/admin.min.js': [ '.compiled/admin.min.js' ]
        }
      },
      dev: {
        options: {
          beautify: true,
          mangle: false,
          compress: false,
          preserveComments: 'all'
        },
        files: {
          'js/admin.min.js': [ '.compiled/admin.min.js' ]
        }
      }
    },

    /**
     * Watch plugin to run tasks as we change files locally.
     */
    watch: {
      scripts: {
        options: {
          event: [ 'all' ]
        },
        files: [ 'js/**/*.js', '!js/admin.min.js' ],
        tasks: [ 'ngmin', 'concat:prod', 'uglify:dev', 'clean:scripts' ]
      }
    },

    /**
     * Clean out the compiled cruft.
     */
    clean: {
      scripts: [ '.compiled' ]
    }

  } );

  /**
   * Default Grunt Task
   *
   * We will block people from running the default grunt task
   * because this would allow them to run all tasks that are
   * of the multiTask type.
   */
  grunt.registerTask( 'default', function() {
    return grunt.util.error( 'Please specify an enviornment. (i.e. `grunt dev`)' );
  } );

  /**
   * Production Task
   *
   * This prepares the Angular code for minification,
   * minifies it, and shoves it into one file for the client.
   */
  grunt.registerTask( 'prod', [ 'ngmin', 'concat:prod', 'uglify:prod', 'clean:scripts'] );

  /**
   * Development Task
   *
   * This spawns a watch process that oversees changes
   * applied to both .scss and .js files. When it catches
   * one, it runs through the tasks almost as if this
   * were productions.
   */
  grunt.registerTask( 'dev', [ 'ngmin', 'concat:prod', 'uglify:dev', 'clean:scripts', 'watch' ] );

};
