<commit_before>var fs = require('fs');
var mkdirp = require('mkdirp');

function linkModules(opts, toDir, dirName) {
  mkdirp.sync(toDir);
  copyWebpackModules(opts, toDir);
}

function copyWebpackModules(opts, toDir) {
  var fromDir = __dirname + '/../../..';
  var modules = require(fromDir + '/package.json').dependencies;

  Object.keys(modules).forEach(function(packageName) {
    var srcModule = fromDir + '/node_modules/' + packageName;
    var destModule = toDir + '/' + packageName;

    if (!fs.existsSync(srcModule)) {
      if (opts.debug) {
        console.warn("Doesn't exist: " + srcModule);
        console.warn('Error! Make sure you have run npm install in reapp-pack');
      }
    }
    else {
      if (!fs.existsSync(destModule)) {
        try {
          fs.symlinkSync(srcModule, destModule, 'dir');
        }
        catch (e) {
          console.log('Error', e);
          console.log("This may be because your server_modules isn't linked properly, try wiping ./server_modules and running again.");
        }
      }
    }
  });
}

module.exports = linkModules;<commit_msg>using correct dependency dir for getting dependencies from package.json<commit_after>var fs = require('fs');
var mkdirp = require('mkdirp');

function linkModules(opts, toDir, dirName) {
  mkdirp.sync(toDir);
  copyWebpackModules(opts, toDir);
}

function copyWebpackModules(opts, toDir) {
  var dependencyDir = __dirname + '/..';
  var fromDir = __dirname + '/../../..';
  var modules = require(dependencyDir + '/package.json').dependencies;

  Object.keys(modules).forEach(function(packageName) {
    var srcModule = fromDir + '/node_modules/' + packageName;
    var destModule = toDir + '/' + packageName;

    if (!fs.existsSync(srcModule)) {
      if (opts.debug) {
        console.warn("Doesn't exist: " + srcModule);
        console.warn('Error! Make sure you have run npm install in reapp-pack');
      }
    }
    else {
      if (!fs.existsSync(destModule)) {
        try {
          fs.symlinkSync(srcModule, destModule, 'dir');
        }
        catch (e) {
          console.log('Error', e);
          console.log("This may be because your server_modules isn't linked properly, try wiping ./server_modules and running again.");
        }
      }
    }
  });
}

module.exports = linkModules;
{'fraction_non_alphanumeric': 0.1421121251629726, 'fraction_numerical': 0.0, 'mean_word_length': 2.881956155143339, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1632988', 'n_tokens_mistral': 708, 'n_tokens_neox': 695, 'n_words': 166}