<commit_before>const fs = require('fs')
const path = require('path')
const nm = require('../../utils/nm')

const bin = (key, target) => {
  const pkgJSON = require(path.join(target, 'package.json'))
  if (!pkgJSON.bin) return
  if (typeof pkgJSON.bin === 'string') {
    try {
      fs.unlinkSync(path.join(nm, '.bin', key))
    } catch (e) {}
    fs.symlinkSync(
      path.join(target, pkgJSON.bin),
      path.join(nm, '.bin', key)
    )
  } else if (typeof pkgJSON.bin === 'object') {
    Object.keys(pkgJSON.bin).forEach((cmd) => {
      try {
        fs.unlinkSync(path.join(nm, '.bin', cmd))
      } catch (e) {}
      fs.symlinkSync(
        path.join(target, pkgJSON.bin[cmd]),
        path.join(nm, '.bin', cmd)
      )
    })
  }
}

module.exports = bin<commit_msg>fix(install): mkdirp node_modules/.bin<commit_after>const fs = require('fs')
const path = require('path')
const mkdirp = require('mkdirp')
const nm = require('../../utils/nm')

const bin = (key, target) => {
  const pkgJSON = require(path.join(target, 'package.json'))
  if (!pkgJSON.bin) return
  mkdirp.sync(path.join(nm, '.bin'))
  if (typeof pkgJSON.bin === 'string') {
    try {
      fs.unlinkSync(path.join(nm, '.bin', key))
    } catch (e) {}
    fs.symlinkSync(
      path.join(target, pkgJSON.bin),
      path.join(nm, '.bin', key)
    )
  } else if (typeof pkgJSON.bin === 'object') {
    Object.keys(pkgJSON.bin).forEach((cmd) => {
      try {
        fs.unlinkSync(path.join(nm, '.bin', cmd))
      } catch (e) {}
      fs.symlinkSync(
        path.join(target, pkgJSON.bin[cmd]),
        path.join(nm, '.bin', cmd)
      )
    })
  }
}

module.exports = bin
{'fraction_non_alphanumeric': 0.19672131147540983, 'fraction_numerical': 0.0, 'mean_word_length': 2.695067264573991, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5602187', 'n_tokens_mistral': 603, 'n_tokens_neox': 588, 'n_words': 118}