<commit_before>const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ManifestPlugin = require('webpack-manifest-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')

const createPlugins = (options, isDevelopment, isLibrary) => {
  const definePlugin = new webpack.DefinePlugin({
    'process.env': {
      IS_BROWSER: true,
      IS_SERVERLESS: JSON.stringify(process.env.IS_SERVERLESS || false),
      NODE_ENV: JSON.stringify(isDevelopment ? 'development' : 'production'),
      SERVER_URL: JSON.stringify(process.env.SERVER_URL || ''),
    },
  })

  const createIndexHTMLPlugin = new HtmlWebpackPlugin({
    title: options.appName,
    inject: true,
    filename: isDevelopment ? 'index.html' : '../index.html',
    template: path.join(__dirname, 'index.html'),
  })

  const compilePlugins = []
  if (options.createSourceMap) {
    compilePlugins.push(
      new webpack.SourceMapDevToolPlugin({
        filename: '[file].map',
      })
    )
  }

  const ignoreMomentJsLocaleResourcesPlugin = new webpack.IgnorePlugin(
    /^\.\/locale$/,
    /moment$/
  )
  compilePlugins.push(ignoreMomentJsLocaleResourcesPlugin)

  const extractCssPlugin = new MiniCssExtractPlugin({
    filename: isDevelopment ? '[name].css' : `${options.appName}-[hash:8].css`,
    chunkFilename: isDevelopment ? '[id].css' : `${options.appName}-[id]-[hash:8].css`,
  })

  const manifestPlugin = new ManifestPlugin({
    fileName: 'asset-manifest.json',
    publicPath: options.outputPublicPath,
  })
  compilePlugins.push(manifestPlugin)

  if
  (isLibrary && !isDevelopment) {
    return [
      definePlugin,
      extractCssPlugin,
      ...compilePlugins
    ]
  }

  if (isDevelopment) {
    return [
      definePlugin,
      extractCssPlugin,
      createIndexHTMLPlugin,
      new webpack.NamedModulesPlugin(),
      new webpack.HotModuleReplacementPlugin(),
      ignoreMomentJsLocaleResourcesPlugin,
      manifestPlugin
    ]
  }

  if (options.createIndexHtml) {
    return [
      definePlugin,
      extractCssPlugin,
      createIndexHTMLPlugin,
      ...compilePlugins,
    ]
  }

  return [
    definePlugin,
    extractCssPlugin,
    ...compilePlugins,
  ]
}

module.exports = createPlugins
<commit_msg>create asset-manifest in correct directory<commit_after>const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ManifestPlugin = require('webpack-manifest-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')

const createPlugins = (options, isDevelopment, isLibrary) => {
  const definePlugin = new webpack.DefinePlugin({
    'process.env': {
      IS_BROWSER: true,
      IS_SERVERLESS: JSON.stringify(process.env.IS_SERVERLESS || false),
      NODE_ENV: JSON.stringify(isDevelopment ? 'development' : 'production'),
      SERVER_URL: JSON.stringify(process.env.SERVER_URL || ''),
    },
  })

  const createIndexHTMLPlugin = new HtmlWebpackPlugin({
    title: options.appName,
    inject: true,
    filename: isDevelopment ? 'index.html' : '../index.html',
    template: path.join(__dirname, 'index.html'),
  })

  const compilePlugins = []
  if (options.createSourceMap) {
    compilePlugins.push(
      new webpack.SourceMapDevToolPlugin({
        filename: '[file].map',
      })
    )
  }

  const ignoreMomentJsLocaleResourcesPlugin = new webpack.IgnorePlugin(
    /^\.\/locale$/,
    /moment$/
  )
  compilePlugins.push(ignoreMomentJsLocaleResourcesPlugin)

  const extractCssPlugin = new MiniCssExtractPlugin({
    filename: isDevelopment ? '[name].css' : `${options.appName}-[hash:8].css`,
    chunkFilename: isDevelopment ? '[id].css' : `${options.appName}-[id]-[hash:8].css`,
  })

  const manifestPlugin = new ManifestPlugin({
    fileName: '../asset-manifest.json',
    publicPath: options.outputPublicPath,
  })
  compilePlugins.push(manifestPlugin)

  if
  (isLibrary && !isDevelopment) {
    return [
      definePlugin,
      extractCssPlugin,
      ...compilePlugins
    ]
  }

  if (isDevelopment) {
    return [
      definePlugin,
      extractCssPlugin,
      createIndexHTMLPlugin,
      new webpack.NamedModulesPlugin(),
      new webpack.HotModuleReplacementPlugin(),
      ignoreMomentJsLocaleResourcesPlugin,
    ]
  }

  if (options.createIndexHtml) {
    return [
      definePlugin,
      extractCssPlugin,
      createIndexHTMLPlugin,
      ...compilePlugins,
    ]
  }

  return [
    definePlugin,
    extractCssPlugin,
    ...compilePlugins,
  ]
}

module.exports = createPlugins

{'fraction_non_alphanumeric': 0.12475548793740492, 'fraction_numerical': 0.000869376222560313, 'mean_word_length': 3.442084942084942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5485801', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1386, 'n_words': 243}