<commit_before>module.exports = (grunt) ->

  # Project configuration.
  grunt.initConfig
    pkg: grunt.file.readJSON 'package.json'
    coffee:
      compile:
        options:
          bare: true
          sourceMap: true
          sourceMapDir: 'dist/'
        files:
          'dist/moltin.builder.js': ['src/builder.coffee', 'src/builder/loader.coffee', 'src/builder/*.coffee']
          'dist/moltin.js': ['src/moltin.coffee', 'src/features/storage.coffee', 'src/features/*.coffee']
    concat:
      options:
        separator: ';'
        banner: '/*! <%= pkg.name %> minified - v<%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> */' + "\n"
      builder:
        src: ['dist/moltin.builder.js', 'src/dot.js']
        dest: 'dist/moltin.builder.js'
      css:
        src: ['src/css/*.css']
        dest: 'dist/moltin.css'
    karma:
      unit:
        options:
          background: true
          files: ['test/*.js']
    uglify:
      postCompile:
        options:
          mangle: true
          sourceMap: true
          sourceMapIncludeSources: true
          drop_console: true
          banner: '/*! <%= pkg.name %> minified - v<%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> */' + "\n"
        files:
          'dist/moltin.builder.min.js': ['dist/moltin.js', 'dist/moltin.builder.js']
          'dist/moltin.min.js': 'dist/moltin.js'
    cssmin:
      compress:
        options:
          banner: '/*! <%= pkg.name %> minified - v<%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> */' + "\n"
        files:
          'dist/moltin.min.css': ['dist/moltin.css']
    compress:
      main:
        options:
          mode: 'gzip'
        expand: true
        cwd: 'dist/',
        src: ['*.min.js', '*.min.css', '*.min.map']
        dest: 'dist/gzip/'
    watch:
      files: ['src/*.coffee', 'src/features/*.coffee', 'src/builder/*.coffee', 'src/css/*.css']
      tasks: ['coffee', 'concat', 'karma', 'uglify', 'cssmin', 'compress']

    # Load aws credentials,
    aws: grunt.file.readJSON 'aws-credentials.json'

    # Rename files.
    copy:
      aws:
        files: [
          {flatten: true, src: 'dist/gzip/moltin.min.js', dest: 'dist/gzip/v1', filter: 'isFile'}
          {flatten: true, src: 'dist/gzip/moltin.builder.min.js', dest: 'dist/gzip/builder', filter: 'isFile'}
        ]

    # Upload files to s3.
    aws_s3:
      options:
        accessKeyId: '<%= aws.access %>'
        secretAccessKey: '<%= aws.secret %>'
        region: '<%= aws.region %>'
        bucket: '<%= aws.bucket %>'
        uploadConcurrency: 5
        downloadConcurrency: 5
        params:
          ContentEncoding: 'gzip'
      production:
        files: [
          {expand: true, cwd: 'dist/gzip/', src: ['**'], dest: '/'}
          {src: 'builder', dest: 'v1/', action: 'copy'}
          {src: 'moltin.builder.min.js', dest: 'v1/', action: 'copy'}
          {src: 'moltin.builder.min.map', dest: 'v1/', action: 'copy'}
          {src: 'moltin.min.css', dest: 'v1/', action: 'copy'}
          {dest: '/', exclude: 'builder', flipExclude: true, action: 'delete'}
        ]

  # These plugins provide necessary tasks.
  grunt.loadNpmTasks 'grunt-contrib-coffee'
  grunt.loadNpmTasks 'grunt-contrib-uglify'<commit_msg>Updating gruntfile with config check<commit_after>module.exports = (grunt) ->

  # Project configuration.
  config =
    pkg: grunt.file.readJSON 'package.json'
    coffee:
      compile:
        options:
          bare: true
          sourceMap: true
          sourceMapDir: 'dist/'
        files:
          'dist/moltin.builder.js': ['src/builder.coffee', 'src/builder/loader.coffee', 'src/builder/*.coffee']
          'dist/moltin.js': ['src/moltin.coffee', 'src/features/storage.coffee', 'src/features/*.coffee']
    concat:
      options:
        separator: ';'
        banner: '/*! <%= pkg.name %> minified - v<%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> */' + "\n"
      builder:
        src: ['dist/moltin.builder.js', 'src/dot.js']
        dest: 'dist/moltin.builder.js'
      css:
        src: ['src/css/*.css']
        dest: 'dist/moltin.css'
    karma:
      unit:
        options:
          background: true
          files: ['test/*.js']
    uglify:
      postCompile:
        options:
          mangle: true
          sourceMap: true
          sourceMapIncludeSources: true
          drop_console: true
          banner: '/*! <%= pkg.name %> minified - v<%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> */' + "\n"
        files:
          'dist/moltin.builder.min.js': ['dist/moltin.js', 'dist/moltin.builder.js']
          'dist/moltin.min.js': 'dist/moltin.js'
    cssmin:
      compress:
        options:
          banner: '/*! <%= pkg.name %> minified - v<%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> */' + "\n"
        files:
          'dist/moltin.min.css': ['dist/moltin.css']
    compress:
      main:
        options:
          mode: 'gzip'
        expand: true
        cwd: 'dist/',
        src: ['*.min.js', '*.min.css', '*.min.map']
        dest: 'dist/gzip/'
    watch:
      files: ['src/*.coffee', 'src/features/*.coffee', 'src/builder/*.coffee', 'src/css/*.css']
      tasks: ['coffee', 'concat', 'karma', 'uglify', 'cssmin', 'compress']

  # Do we have credentials?
  if grunt.file.exists('aws-credentials.json')

    # Load aws credentials,
    config.aws = grunt.file.readJSON 'aws-credentials.json'

    # Rename files.
    config.copy =
      aws:
        files: [
          {flatten: true, src: 'dist/gzip/moltin.min.js', dest: 'dist/gzip/v1', filter: 'isFile'}
          {flatten: true, src: 'dist/gzip/moltin.builder.min.js', dest: 'dist/gzip/builder', filter: 'isFile'}
        ]

    # Upload files to s3.
    config.aws_s3 =
      options:
        accessKeyId: '<%= aws.access %>'
        secretAccessKey: '<%= aws.secret %>'
        region: '<%= aws.region %>'
        bucket: '<%= aws.bucket %>'
        uploadConcurrency: 5
        downloadConcurrency: 5
        params:
          ContentEncoding: 'gzip'
      production:
        files: [
          {expand: true, cwd: 'dist/gzip/', src: ['**'], dest: '/'}
          {src: 'builder', dest: 'v1/', action: 'copy'}
          {src: 'moltin.builder.min.js', dest: 'v1/', action: 'copy'}
          {src: 'moltin.builder.min.map', dest: 'v1/', action: 'copy'}
          {src: 'moltin.min.css', dest: 'v1/', action: 'copy'}
          {dest: '/', exclude: 'builder', flipExclude: true, action: 'delete'}
        ]

  # Initialize grunt.
  grunt.initConfig config

  # These plugins provide necessary tasks.
  grunt.loadNpmTasks 'grunt-contrib-coffee'
  grunt.loadNpmTasks 'grunt-contrib-uglify'
{'fraction_non_alphanumeric': 0.18473777253977608, 'fraction_numerical': 0.0026517383618149676, 'mean_word_length': 2.015992892047979, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6839137', 'n_tokens_mistral': 2441, 'n_tokens_neox': 2338, 'n_words': 443}