<commit_before>require('babel-register')

const config = require('../config')
const debug = require('debug')('app:bin:compile')

debug('Create webpack compiler.')

const compiler = require('webpack')(require('../build/webpack'))

compiler.run(function (err, stats) {
  const jsonStats = stats.toJson()

  debug('Webpack compile completed.')
  console.log(stats.toString(config.compiler_stats))

  if (err) {
    debug('Webpack compiler encountered a fatal error.', err)
    process.exit(1)
  } else if (jsonStats.errors.length > 0) {
    debug('Webpack compiler encountered errors.')
    process.exit(1)
  } else if (jsonStats.warnings.length > 0) {
    debug('Webpack compiler encountered warnings.')

    if (config.compiler_fail_on_warning) {
      process.exit(1)
    }
  } else {
    debug('No errors / warnings encountered.')
  }
})<commit_msg>chore(webpack): log compiler errors and warnings<commit_after>require('babel-register')

const config = require('../config')
const debug = require('debug')('app:bin:compile')

debug('Create webpack compiler.')

const compiler = require('webpack')(require('../build/webpack'))

compiler.run(function (err, stats) {
  const jsonStats = stats.toJson()

  debug('Webpack compile completed.')
  console.log(stats.toString(config.compiler_stats))

  if (err) {
    debug('Webpack compiler encountered a fatal error.', err)
    process.exit(1)
  } else if (jsonStats.errors.length > 0) {
    debug('Webpack compiler encountered errors.')
    console.log(jsonStats.errors)
    process.exit(1)
  } else if (jsonStats.warnings.length > 0) {
    debug('Webpack compiler encountered warnings.')
    console.log(jsonStats.warnings)

    if (config.compiler_fail_on_warning) {
      process.exit(1)
    }
  } else {
    debug('No errors or warnings encountered.')
  }
})
{'fraction_non_alphanumeric': 0.1461794019933555, 'fraction_numerical': 0.005537098560354375, 'mean_word_length': 4.177650429799427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5061038', 'n_tokens_mistral': 555, 'n_tokens_neox': 542, 'n_words': 124}