<commit_before>const { merge } = require('../merge');

const webpack = opts => {
  opts = merge(
    {
      jsx: 'h'
    },
    opts
  );
  return {
    'package.json': {
      devDependencies: {
        'babel-core': '^6.26.0',
        'babel-loader': '^7.1.2',
        'babel-plugin-transform-react-jsx': '^6.24.1',
        'babel-preset-env': '^1.6.1',
        'babel-preset-flow': '^6.23.0',
        'babel-preset-react': '^6.24.1',
        'babel-preset-stage-0': '^6.24.1',
        webpack: '^3.8.1',
        'webpack-dev-server': '^2.9.4'
      }
    },
    'webpack.config.js'() {
      const path = require('path');
      const webpack = require('webpack');
      const contextPath = path.join(__dirname, 'src');
      const publicPath = path.join(__dirname, 'public');
      return {
        context: contextPath,
        devServer: {
          compress: true,
          contentBase: publicPath,
          historyApiFallback: true,
          open: true
        },
        devtool: 'source-map',
        entry: './index.js',
        module: {
          rules: [
            {
              test: /\.js$/,
              use: {
                loader: 'babel-loader',
                options: {
                  plugins: [
                    opts.jsx
                      ? ['transform-react-jsx', { pragma: opts.jsx }]
                      : undefined
                  ],
                  presets: ['env', 'flow', 'react', 'stage-0']
                }
              }
            },
            {
              test: /\.(html)/,
              loaders: 'file-loader?{ name: "[path][name].[ext]"}'
            }
          ]
        },
        output: {
          filename: 'chunk.[name].js',
          path: publicPath,
          publicPath: '/'
        },
        plugins: [
          new webpack.optimize.CommonsChunkPlugin({
            children: true,
            deepChildren: true,
            filename: 'index.js',
            minChunks: 2,
            name: 'index'
          })
        ]
      };
    }
  };
};<commit_msg>Create way to get local dependencies but still refer to the conartist function. This works for now and it can be fleshed out later if need be.<commit_after>const path = require('path');
const { merge } = require('../merge');

function local(dep) {
  return require(localPath(dep));
}

function localPath(dep) {
  return path.join(process.cwd(), 'node_modules', dep);
}

module.exports = opts => {
  opts = merge(
    {
      dst: 'public',
      jsx: 'React.createElement',
      src: 'src'
    },
    opts
  );
  return {
    'package.json': {
      devDependencies: {
        'babel-core': '^6.26.0',
        'babel-loader': '^7.1.2',
        'babel-plugin-transform-react-jsx': '^6.24.1',
        'babel-preset-env': '^1.6.1',
        'babel-preset-flow': '^6.23.0',
        'babel-preset-react': '^6.24.1',
        'babel-preset-stage-0': '^6.24.1',
        'file-loader': '^1.1.5',
        webpack: '^3.8.1',
        'webpack-dev-server': '^2.9.4'
      }
    },
    'webpack.config.js'() {
      const webpack = local('webpack');
      const contextPath = path.join(process.cwd(), opts.src);
      const publicPath = path.join(process.cwd(), opts.dst);
      return {
        context: contextPath,
        devServer: {
          compress: true,
          contentBase: publicPath,
          historyApiFallback: true,
          open: true
        },
        devtool: 'source-map',
        entry: './index.js',
        module: {
          rules: [
            {
              test: /\.js$/,
              use: {
                loader: localPath('babel-loader'),
                options: {
                  plugins: [
                    opts.jsx
                      ? ['transform-react-jsx', { pragma: opts.jsx }]
                      : undefined
                  ],
                  presets: ['env', 'flow', 'react', 'stage-0']
                }
              }
            },
            {
              test: /\.(html)/,
              use: {
                loader: localPath('file-loader'),
                options: {
                  name: '[path][name].[ext]'
                }
              }
            }
          ]
        },
        output: {
          filename: 'chunk.[name].js',
          path: publicPath,
          publicPath: '/'
        },
        plugins: [
          new webpack.optimize.CommonsChunkPlugin({
            children: true,
            deepChildren: true,
            filename: 'index.js',
            minChunks: 2,
            name: 'index'
          })
        ]
      };
    }
  };
};
{'fraction_non_alphanumeric': 0.15734265734265734, 'fraction_numerical': 0.015952797202797204, 'mean_word_length': 1.2580167735569807, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1838443', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1370, 'n_words': 257}