<commit_before>// discuss
var bundleName = 'jsf';

// boilerplate...
var fs = require('fs-extra'),
    path = require('path'),
    glob = require('glob'),
    uglifyjs = require('uglify-js'),
    browserify = require('browserify'),
    template = require('lodash.template');

var buildDir = __dirname,
    projectDir = path.join(__dirname, '..');

var BANNER_TEXT = fs.readFileSync(path.join(buildDir, '.banner.txt')).toString(),
    LOCALE_TEXT = fs.readFileSync(path.join(buildDir, '.locale.js')).toString();

var pkg = require(path.join(projectDir, 'package.json')),
    bannerTemplate = template(BANNER_TEXT),
    localeTemplate = template(LOCALE_TEXT);

var banner = bannerTemplate({ pkg: pkg, now: (new Date()).toISOString().replace('T', ' ') });

// reuse instance later
var b = browserify({
  detectGlobals: false,
  insertGlobals: false,
  builtins: false,
  standalone: bundleName
});

// custom bundler
function bundle(options, next) {
  b.reset();

  var destFile = path.join(projectDir, 'dist', options.dest || '', options.id + '.js');

  if (!options.src) {
    // bundle from generated source
    options.src = path.join(projectDir, options.dest, options.id + '.js');

    fs.outputFileSync(options.src, localeTemplate({ lang: options.id }));
  }

  b.add(path.resolve(options.src), { expose: pkg.name, entry: true });

  b.bundle(function(err, buffer) {
    if (err) {
      return next(err);
    }

    // write out the generated bundle!
    var code = buffer.toString();

    var min = uglifyjs.minify(code, { fromString: true });

    // minified output
    fs.outputFileSync(destFile.replace(/\.js$/, '.min.js'), banner + min.code);

    // regular output
    fs.outputFileSync(destFile, banner + code);

    // OK
    console.log('Bundle: ' + destFile);

    next();
  });
}

var outputs = [
  { id: pkg.name, src: projectDir }
];<commit_msg>Fixed uglify-js settings<commit_after>// discuss
var bundleName = 'jsf';

// boilerplate...
var fs = require('fs-extra'),
    path = require('path'),
    glob = require('glob'),
    uglifyjs = require('uglify-js'),
    browserify = require('browserify'),
    template = require('lodash.template');

var buildDir = __dirname,
    projectDir = path.join(__dirname, '..');

var BANNER_TEXT = fs.readFileSync(path.join(buildDir, '.banner.txt')).toString(),
    LOCALE_TEXT = fs.readFileSync(path.join(buildDir, '.locale.js')).toString();

var pkg = require(path.join(projectDir, 'package.json')),
    bannerTemplate = template(BANNER_TEXT),
    localeTemplate = template(LOCALE_TEXT);

var banner = bannerTemplate({ pkg: pkg, now: (new Date()).toISOString().replace('T', ' ') });

// reuse instance later
var b = browserify({
  detectGlobals: false,
  insertGlobals: false,
  builtins: false,
  standalone: bundleName
});

// custom bundler
function bundle(options, next) {
  b.reset();

  var destFile = path.join(projectDir, 'dist', options.dest || '', options.id + '.js');

  if (!options.src) {
    // bundle from generated source
    options.src = path.join(projectDir, options.dest, options.id + '.js');

    fs.outputFileSync(options.src, localeTemplate({ lang: options.id }));
  }

  b.add(path.resolve(options.src), { expose: pkg.name, entry: true });

  b.bundle(function(err, buffer) {
    if (err) {
      return next(err);
    }

    // write out the generated bundle!
    var code = buffer.toString();

    var min = uglifyjs.minify(code, {
      fromString: true,
      compress: true,
      mangle: true,
      filename: options.src,
      output: {
        comments: /^!|^\*!|@preserve|@license|@cc_on/
      }
    });

    // minified output
    fs.outputFileSync(destFile.replace(/\.js$/, '.min.js'), banner + min.code);

    // regular output
    fs.outputFileSync(destFile, banner + code);

    // OK
    console.log('Bundle: ' + destFile);

    next();
  });
}

var outputs = [
  { id: pkg.name, src: projectDir }
];
{'fraction_non_alphanumeric': 0.17192712342827815, 'fraction_numerical': 0.0, 'mean_word_length': 3.3847019122609674, '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': '4173469', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1267, 'n_words': 279}