<commit_before>var fs = require('fs'),
    path = require('path'),
    exec = require('child_process').exec,
    uglify = require('uglify-js'),
    targetDir = '../build/release';

fs.mkdirSync(path.join(__dirname, targetDir));

var config = {
  "thorax.js": [
    'lib/jquery.js',
    'lib/handlebars.js',
    'lib/underscore.js',
    'lib/backbone.js',
    'build/dev/thorax.js'
  ],
  "thorax-mobile.js": [
    'lib/zepto.js',
    'lib/handlebars.js',
    'lib/underscore.js',
    'lib/backbone.js',
    'build/dev/thorax-mobile.js'
  ]
};

function minify(code) {
  var jsp = uglify.parser,
      pro = uglify.uglify,
      ast = jsp.parse(code);
  ast = pro.ast_mangle(ast);
  ast = pro.ast_squeeze(ast);
  return pro.gen_code(ast);
}

module.exports = function() {
  exec('jake lumbar', function(error, stdout, stderr) {
    error && process.stdout.write(error);
    stdout && process.stdout.write(stdout);
    stderr && process.stdout.write(stderr);

    for (var target in config) {
      var fileList = config[target],
          output = '';
      fileList.forEach(function(file) {
        output += fs.readFileSync(path.join(__dirname, '..', file)).toString() + "\n";
      });
      var targetFile = path.join(__dirname, targetDir, target);
      fs.writeFileSync(targetFile.replace(/\.js$/, '.min.js'), minify(output));
      fs.writeFileSync(targetFile, output);
      console.log("Wrote: " + targetFile);
      console.log("Wrote: " + targetFile.replace(/\.js$/, '.min.js'));
    }
  });
};<commit_msg>Put try catch around mkdir<commit_after>var fs = require('fs'),
    path = require('path'),
    exec = require('child_process').exec,
    uglify = require('uglify-js'),
    targetDir = '../build/release';

try {
  fs.mkdirSync(path.join(__dirname, targetDir));
} catch(e) {
  
}

var config = {
  "thorax.js": [
    'lib/jquery.js',
    'lib/handlebars.js',
    'lib/underscore.js',
    'lib/backbone.js',
    'build/dev/thorax.js'
  ],
  "thorax-mobile.js": [
    'lib/zepto.js',
    'lib/handlebars.js',
    'lib/underscore.js',
    'lib/backbone.js',
    'build/dev/thorax-mobile.js'
  ]
};

function minify(code) {
  var jsp = uglify.parser,
      pro = uglify.uglify,
      ast = jsp.parse(code);
  ast = pro.ast_mangle(ast);
  ast = pro.ast_squeeze(ast);
  return pro.gen_code(ast);
}

module.exports = function() {
  exec('jake lumbar', function(error, stdout, stderr) {
    error && process.stdout.write(error);
    stdout && process.stdout.write(stdout);
    stderr && process.stdout.write(stderr);

    for (var target in config) {
      var fileList = config[target],
          output = '';
      fileList.forEach(function(file) {
        output += fs.readFileSync(path.join(__dirname, '..', file)).toString() + "\n";
      });
      var targetFile = path.join(__dirname, targetDir, target);
      fs.writeFileSync(targetFile.replace(/\.js$/, '.min.js'), minify(output));
      fs.writeFileSync(targetFile, output);
      console.log("Wrote: " + targetFile);
      console.log("Wrote: " + targetFile.replace(/\.js$/, '.min.js'));
    }
  });
};
{'fraction_non_alphanumeric': 0.1882123086942364, 'fraction_numerical': 0.0, 'mean_word_length': 2.9896103896103896, 'pattern_counts': {'":': 4, '<': 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': '2303110', 'n_tokens_mistral': 1113, 'n_tokens_neox': 1090, 'n_words': 174}