<commit_before>'use strict';

import IndexHtml from 'html-webpack-plugin';
import webpack from 'webpack';
import {watch} from 'chokidar';
import {resolve} from 'path';
import {readFileSync} from 'fs';
import mime from 'mime';
import bundler from '../webpack.client.config';
import {socket, options, minify} from '../config';
import {green} from 'chalk';

export default notesPage;

function notesPage() {
  bundler.entry.app = `${process.cwd()}/${__dirname}/app.js`;
  bundler.output.path = `${process.cwd()}/notes/${options.env}`;
  bundler.plugins[1] = new IndexHtml({
    template: `${__dirname}/index.html`,
    inject: true,
    minify: minify.html,
  });

  // compile the module with webpack
  webpack(bundler, () => {
    // watch all hot update files in the compilation folder
    const hotUpdWatch = watch('*.hot-update.json', {
      cwd: `${process.cwd()}/${__dirname}/${options.env}`,
      // ignore hidden files
      ignored: /^\./,
    });

    socket.on('connection', io => {
      // whenever a hot-update file gets created, emit a hot-update event to all
      // sockets connected to this page
      hotUpdWatch.on('add', () => {
        console.log(green('File changed'));

        io.emit('hot-update');
      });
    });
  });

  return async (ctx, next) => {
    // we only deal with GET requests here
    if(ctx.method !== 'GET') {
      await next();
    }

    const path = resolve(ctx.path);
    if(path === '/' || path === '/index.html') {
      ctx.type = 'html';
      ctx.body = readFileSync(`${__dirname}/${options.env}/index.html`, 'utf-8');
    } else {
      ctx.type = mime.lookup(path);
      ctx.body = readFileSync(`${__dirname}/${options.env}/${path}`, 'utf-8');
    }

    await next();
  };
}
<commit_msg>Removed the notes folder entirely, now that the home folder is the main page<commit_after>'use strict';

import IndexHtml from 'html-webpack-plugin';
import webpack from 'webpack';
import {watch} from 'chokidar';
import {resolve} from 'path';
import {readFileSync} from 'fs';
import mime from 'mime';
import bundler from '../webpack.client.config';
import {socket, options, minify} from '../config';
import {green} from 'chalk';

export default homePage;

function homePage() {
  bundler.entry.app = `${process.cwd()}/${__dirname}/app.js`;
  bundler.output.path = `${process.cwd()}/home/${options.env}`;
  bundler.plugins[1] = new IndexHtml({
    template: `${__dirname}/index.html`,
    inject: true,
    minify: minify.html,
  });

  // compile the module with webpack
  webpack(bundler, () => {
    // watch all hot update files in the compilation folder
    const hotUpdWatch = watch('*.hot-update.json', {
      cwd: `${process.cwd()}/${__dirname}/${options.env}`,
      // ignore hidden files
      ignored: /^\./,
    });

    socket.on('connection', io => {
      // whenever a hot-update file gets created, emit a hot-update event to all
      // sockets connected to this page
      hotUpdWatch.on('add', () => {
        console.log(green('File changed'));

        io.emit('hot-update');
      });
    });
  });

  return async (ctx, next) => {
    // we only deal with GET requests here
    if(ctx.method !== 'GET') {
      await next();
    }

    const path = resolve(ctx.path);
    if(path === '/' || path === '/index.html') {
      ctx.type = 'html';
      ctx.body = readFileSync(`${__dirname}/${options.env}/index.html`, 'utf-8');
    } else {
      ctx.type = mime.lookup(path);
      ctx.body = readFileSync(`${__dirname}/${options.env}/${path}`, 'utf-8');
    }

    await next();
  };
}

{'fraction_non_alphanumeric': 0.18409218662169757, 'fraction_numerical': 0.0016863406408094434, 'mean_word_length': 2.9899103139013454, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1819184', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1137, 'n_words': 291}