<commit_before>const exec = require('child_process').exec
const assert = require('assert')
const chalk = require('chalk')
const git = require('./git')
const eachAsync = require('each-async')

module.exports = installDeps

// chalk settings for colorized output
const blk = chalk.dim.black
const blu = chalk.blue
const mag = chalk.magenta
const red = chalk.red

function installDeps (opts) {
  process.stdout.write(blu('\nDependencies:\n\n'))

  eachAsync(opts.packages, function (item, index, done) {
    exec('npm install --save-dev ' + item, function (err) {
      process.stdout.write(blk('  module: ') + red(item) + '\n')
      done(err)
    })
  }, function (err) {
    assert.ifError(err)
    if (opts.git) git(opts)
    else process.stdout.write(mag('\nAll done.\n'))
  })

}<commit_msg>refactor<commit_after>const exec = require('child_process').exec
const assert = require('assert')
const chalk = require('chalk')
const git = require('./git')
const eachAsync = require('each-async')
const parallel = require('run-parallel')

module.exports = installDeps

// chalk settings for colorized output
const blk = chalk.dim.black
const blu = chalk.blue
const mag = chalk.magenta
const red = chalk.red

function installDeps (opts) {
  process.stdout.write(blu('\nDependencies:\n\n'))

  parallel([
    function (cb) {
      if (opts.devInstall && opts.install) {
        eachAsync(opts.devpackages, function (item, index, done) {
          exec('npm install --save-dev ' + item, function (err) {
            process.stdout.write(blk('  module: ') + red(item) + '\n')
            done(err)
          })
        }, function (err) {
          assert.ifError(err)
          cb(err, 'devDependencies')
        })
      } else {
        cb(null, 'devDependencies')
      }
    },
    function (cb) {
      if (opts.proInstall) {
        eachAsync(opts.packages, function (item, index, done) {
          exec('npm install --save ' + item, function (err) {
            process.stdout.write(blk('  module: ') + red(item) + '\n')
            done(err)
          })
        }, function (err) {
          assert.ifError(err)
          cb(err, 'dependencies')
        })
      } else {
        cb(null, 'dependencies')
      }
    }
  ], function (err, results) {
      assert.ifError(err)
      if (opts.git) git(opts)
      else process.stdout.write(mag('\nAll done.\n'))
  })

}
{'fraction_non_alphanumeric': 0.15413851351351351, 'fraction_numerical': 0.0, 'mean_word_length': 2.6785714285714284, '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': '2523687', 'n_tokens_mistral': 755, 'n_tokens_neox': 736, 'n_words': 172}