<commit_before>var path = require( 'path' );
var fs = require( 'fs' );
var util = require( 'util' );
var Uglify = require( 'uglify-js' );
var exec = require( 'child_process' ).exec;
var Seq = require( 'seq' );
var glob = require( 'glob' );

var bu = require( '../util' );

function processDirectory( options, cb ) {
  var inDir = options.inDir;
  var outDir = options.outDir;
  var header = options.header;

  Seq()
  .seq(function() {
    bu.mkdirpSync( outDir );
    this.ok();
  })
  .seq(function() {
    glob( inDir+'/**/*.js', this );
  })
  .flatten()
  .parEach(function(filePath) {
    var nextFile = this;
    // for each file, uglify, attach header, place in output/lu-controls
    Seq()
    .par(function() {
      bu.grabAndUglify( filePath, this );
    })
    .seq(function() {
      bu.concat( arguments, this );
    })
    .seq(function(file) {
      var target = filePath.replace(inDir, outDir);
      bu.mkdirpSync( path.dirname(target) );
      bu.write( target, file, this );
    })
    .seq(function() {
      nextFile();<commit_msg>restore header functionality<commit_after>var path = require( 'path' );
var fs = require( 'fs' );
var util = require( 'util' );
var Uglify = require( 'uglify-js' );
var exec = require( 'child_process' ).exec;
var Seq = require( 'seq' );
var glob = require( 'glob' );

var bu = require( '../util' );

function processDirectory( options, cb ) {
  var inDir = options.inDir;
  var outDir = options.outDir;
  var header = options.header;

  Seq()
  .seq(function() {
    bu.mkdirpSync( outDir );
    this.ok();
  })
  .seq(function() {
    glob( inDir+'/**/*.js', this );
  })
  .flatten()
  .parEach(function(filePath) {
    var nextFile = this;
    // for each file, uglify, attach header, place in output/lu-controls
    Seq()
    .par(function() {
      bu.grab( header, this );
    })
    .par(function() {
      bu.grabAndUglify( filePath, this );
    })
    .seq(function() {
      bu.concat( arguments, this );
    })
    .seq(function(file) {
      var target = filePath.replace(inDir, outDir);
      bu.mkdirpSync( path.dirname(target) );
      bu.write( target, file, this );
    })
    .seq(function() {
      nextFile();
{'fraction_non_alphanumeric': 0.17315620705451215, 'fraction_numerical': 0.0, 'mean_word_length': 2.8181818181818183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3668345', 'n_tokens_mistral': 767, 'n_tokens_neox': 758, 'n_words': 187}