<commit_before>/* eslint-disable import/no-extraneous-dependencies, no-console */
const webpack = require('webpack');
const chalk = require('chalk');
const devConfig = require('./webpack.config.dev');

const isLogEnabled = process.env.NODE_ENV ? process.env.NODE_ENV !== 'production' : true;
const compiler = webpack(devConfig);
compiler.plugin('invalid', () => {
  if (isLogEnabled) {
    process.stdout.write(process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H');
    console.log(chalk.cyan('Compiling.. Please wait'));
  }
});

compiler.plugin('done', (stats) => {
  if (isLogEnabled) {
    process.stdout.write(process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H');
    if (stats.hasErrors()) {
      console.log(chalk.red('Errors found!'));
      const formattedStats = stats.toJson('errors-only');
      formattedStats.errors.forEach((item) => {
        console.log(item);
      });
      return;
    }
    console.log(chalk.green('Compiled!\n'));
    console.log(chalk.magenta('Please visit http://localhost:1234'));
  }
});
<commit_msg>Warning message for the not-empty dist foler<commit_after>/* eslint-disable import/no-extraneous-dependencies, no-console */
const webpack = require('webpack');
const chalk = require('chalk');
const devConfig = require('./webpack.config.dev');
const fs = require('fs');
const path = require('path');

const isLogEnabled = process.env.NODE_ENV ? process.env.NODE_ENV !== 'production' : true;
const compiler = webpack(devConfig);
compiler.plugin('invalid', () => {
  if (isLogEnabled) {
    process.stdout.write(process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H');
    console.log(chalk.cyan('Compiling.. Please wait'));
  }
});

compiler.plugin('done', (stats) => {
  if (isLogEnabled) {
    process.stdout.write(process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H');
    if (stats.hasErrors()) {
      console.log(chalk.red('Errors found!'));
      const formattedStats = stats.toJson('errors-only');
      formattedStats.errors.forEach((item) => {
        console.log(item);
      });
      return;
    }
    var distPath = path.join(process.cwd(), 'dist');
    fs.readdir(distPath, (error, files) => {
      if (files) {
        console.log(chalk.red('The dist directory is not empty.\nWhat you are seeing is an old already built production build. Please delete the dist folder and restart'));
      }

    });
    console.log(chalk.green('Compiled!\n'));
    console.log(chalk.magenta('Please visit http://localhost:1234'));
  }
});

{'fraction_non_alphanumeric': 0.1868566904196358, 'fraction_numerical': 0.01583531274742676, 'mean_word_length': 3.8689788053949905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '6093645', 'n_tokens_mistral': 858, 'n_tokens_neox': 844, 'n_words': 152}