<commit_before>var fs = require('fs');
var path = require('path');
var spawn = require('child_process').spawn;
var Promise = require('bluebird');

module.exports = function (log) {

  var install = function (project, options) {
    options = options || {};
    return new Promise(function(resolve, reject) {

      var npmJson = JSON.stringify({
        dependencies: project.npm.dependencies,
        devDependencies: options.production ? [] : project.npm.devDependencies,
        name: project.name
      }, null, 4);

      log.info('NPM Installing:', project.name);

      fs.writeFileSync(project.tempPath + '/package.json', npmJson);

      if (project.npm.shrinkwrap) {
        var shrinkwrap = JSON.stringify(project.npm.shrinkwrap);
        fs.writeFileSync(project.tempPath + '/npm-shrinkwrap.json', shrinkwrap);
      }

      var cmd = path.join(__dirname, '..', '..', 'node_modules', '.bin', 'npm');
      var args = ['install'];
      if (options.production) {
        args.push('--production');
      }

      try {
        var npmCli = spawn(cmd, args, { cwd: project.tempPath });
      } catch (e) {
        log.error('NPM Exception', e, 'with command', npmCmd);
      }

      npmCli.stdout.on('data', function (data) {
        if (data) {
          log.debug(data.toString());
        }
      });

      npmCli.stderr.on('data', function (data) {
        if (data) {
          log.debug(data.toString());
        }
      });

      npmCli.on('close', function (code) {
        log.info('NPM Install Complete:', project.name, 'Code:', code);
        fs.unlink(project.tempPath + '/package.json', function () {
          fs.unlink(project.tempPath + '/npm-shrinkwrap.json', function () {
            resolve();
          });
        });

      });
<commit_msg>path join fix<commit_after>var fs = require('fs');
var path = require('path');
var spawn = require('child_process').spawn;
var Promise = require('bluebird');

module.exports = function (log) {

  var install = function (project, options) {
    options = options || {};
    return new Promise(function(resolve, reject) {

      var npmJson = JSON.stringify({
        dependencies: project.npm.dependencies,
        devDependencies: options.production ? [] : project.npm.devDependencies,
        name: project.name
      }, null, 4);

      log.info('NPM Installing:', project.name);

      fs.writeFileSync(path.join(project.tempPath, 'package.json'), npmJson);

      if (project.npm.shrinkwrap) {
        var shrinkwrap = JSON.stringify(project.npm.shrinkwrap);
        fs.writeFileSync(path.join(project.tempPath, 'npm-shrinkwrap.json'), shrinkwrap);
      }

      var cmd = path.join(__dirname, '..', '..', 'node_modules', '.bin', 'npm');
      var args = ['install'];
      if (options.production) {
        args.push('--production');
      }

      try {
        var npmCli = spawn(cmd, args, { cwd: project.tempPath });
      } catch (e) {
        log.error('NPM Exception', e, 'with command', npmCmd);
      }

      npmCli.stdout.on('data', function (data) {
        if (data) {
          log.debug(data.toString());
        }
      });

      npmCli.stderr.on('data', function (data) {
        if (data) {
          log.debug(data.toString());
        }
      });

      npmCli.on('close', function (code) {
        log.info('NPM Install Complete:', project.name, 'Code:', code);
        fs.unlink(path.join(project.tempPath, 'package.json'), function () {
          fs.unlink(path.join(project.tempPath, 'npm-shrinkwrap.json'), function () {
            resolve();
          });
        });

      });

{'fraction_non_alphanumeric': 0.166016713091922, 'fraction_numerical': 0.0005571030640668524, 'mean_word_length': 2.4232602478551, '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': '3998722', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1058, 'n_words': 216}