<commit_before>module.exports = function(grunt) {
  var browserify = require('browserify-middleware');

  grunt.initConfig({
    coffeelint: {
      app: ['src/**/*.coffee'],
      specs: ['spec/**/*.coffee'],
      options: grunt.file.readJSON('.coffeelint.json')
    },

    coffee: {
      compile: {
        expand: true,
        cwd: 'src',
        src: ['**/*.coffee'],
        dest: 'lib',
        ext: '.js'
      }
    },

    browserify: {
      compile: {
        src: 'lib/index.js',
        dest: 'field-kit.js',
        options: {
          standalone: 'FieldKit',
          debug: false
        }
      }
    },

    uglify: {
      'field-kit.min.js': [ 'field-kit.js' ]
    },

    qunit: {
      all: {
        options: {
          urls: [
            'http://localhost:<%= connect.test.options.port %>/test'
          ]
        }
      }
    },

    connect: {
      test: {
        options: {
          port: process.env.PORT || 8000,
          base: '.',
          middleware: function(connect, options, middlewares) {
            var lib = browserify('./lib/index.js', grunt.config.get('browserify.compile.options'));
            var setup = browserify('./test/test_helper.js', { debug: false });

            middlewares.push(function(req, res, next) {
              switch (req.url) {
                case '/test/setup.js':
                  setup(req, res, next);
                  break;

                case '/test/all.js':
                  res.writeHead(200, { 'Content-Type': 'application/javascript' });
                  grunt.file.expand('test/**/*_test.js').forEach(function(path) {
                    res.write(grunt.file.read(path));
                  });
                  res.end();
                  break;

                case '/lib/field-kit.js':
                  lib(req, res, next);
                  break;

                default:
                  next();
                  break;
              }
            });

            return middlewares;
          }
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-coffeelint');
  grunt.loadNpmTasks('grunt-contrib-coffee');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.registerTask('default', ['test']);
  grunt.registerTask('test', ['coffeelint', 'coffee', 'browserify', 'connect:test', 'qunit', 'uglify']);
  grunt.registerTask('develop', ['connect:test:keepalive']);
};<commit_msg>Copy .js files from src to lib.<commit_after>module.exports = function(grunt) {
  var browserify = require('browserify-middleware');

  grunt.initConfig({
    coffeelint: {
      app: ['src/**/*.coffee'],
      specs: ['spec/**/*.coffee'],
      options: grunt.file.readJSON('.coffeelint.json')
    },

    coffee: {
      compile: {
        expand: true,
        cwd: 'src',
        src: ['**/*.coffee'],
        dest: 'lib',
        ext: '.js'
      }
    },

    copy: {
      source: {
        expand: true,
        cwd: 'src',
        src: ['**/*.js'],
        dest: 'lib'
      }
    },

    browserify: {
      compile: {
        src: 'lib/index.js',
        dest: 'field-kit.js',
        options: {
          standalone: 'FieldKit',
          debug: false
        }
      }
    },

    uglify: {
      'field-kit.min.js': [ 'field-kit.js' ]
    },

    qunit: {
      all: {
        options: {
          urls: [
            'http://localhost:<%= connect.test.options.port %>/test'
          ]
        }
      }
    },

    connect: {
      test: {
        options: {
          port: process.env.PORT || 8000,
          base: '.',
          middleware: function(connect, options, middlewares) {
            var lib = browserify('./lib/index.js', grunt.config.get('browserify.compile.options'));
            var setup = browserify('./test/test_helper.js', { debug: false });

            middlewares.push(function(req, res, next) {
              switch (req.url) {
                case '/test/setup.js':
                  setup(req, res, next);
                  break;

                case '/test/all.js':
                  res.writeHead(200, { 'Content-Type': 'application/javascript' });
                  grunt.file.expand('test/**/*_test.js').forEach(function(path) {
                    res.write(grunt.file.read(path));
                  });
                  res.end();
                  break;

                case '/lib/field-kit.js':
                  lib(req, res, next);
                  break;

                default:
                  next();
                  break;
              }
            });

            return middlewares;
          }
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-coffeelint');
  grunt.loadNpmTasks('grunt-contrib-coffee');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.registerTask('default', ['test']);
  grunt.registerTask('test', ['coffeelint', 'coffee', 'copy', 'browserify', 'connect:test', 'qunit', 'uglify']);
  grunt.registerTask('develop', ['connect:test:keepalive']);
};
{'fraction_non_alphanumeric': 0.16679331306990883, 'fraction_numerical': 0.0026595744680851063, 'mean_word_length': 1.584683357879234, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2165442', 'n_tokens_mistral': 1702, 'n_tokens_neox': 1616, 'n_words': 246}