<commit_before>var gyp = require('./gyp')

function runGyp (opts, target, cb) {
  var args = ['node', 'index.js']
  if (opts.backend === 'node-ninja') {
    args.push('configure')
    args.push('build')
    args.push('--builddir=build/' + target)
  } else {
    args.push('rebuild')
  }
  args.push('--target=' + target)
  args.push('--target_arch=' + opts.arch)
  if (opts.runtime === 'electron') {
    args.push('--runtime=electron')
    args.push('--dist-url=https://atom.io/download/electron')
  } else if (opts.runtime === 'node-webkit') {
    args.push('--runtime=node-webkit')
  }
  if (opts.debug) args.push('--debug')

  if (opts.format) args.push('--', '--format', opts.format)

  gyp({
    gyp: opts.gyp,
    backend: opts.backend,
    log: opts.log,
    args: args,
    filter: function (command) {
      if (command.name === 'configure') {
        return configurePreGyp(command, opts)
      }
    }
  }, cb)
}

function configurePreGyp (command, opts) {
  var binary = opts.pkg.binary
  if (binary && binary.module_name) {
    command.args.push('-Dmodule_name=' + binary.module_name)
  }<commit_msg>Added fix for building node 10<commit_after>var gyp = require('./gyp')

function runGyp (opts, target, cb) {
  var args = ['node', 'index.js']
  if (opts.backend === 'node-ninja') {
    args.push('configure')
    args.push('build')
    args.push('--builddir=build/' + target)
  } else {
    args.push('rebuild')
  }
  args.push('--target=' + target)
  args.push('--target_arch=' + opts.arch)
  if (opts.runtime === 'electron') {
    args.push('--runtime=electron')
    args.push('--dist-url=https://atom.io/download/electron')
  } else if (opts.runtime === 'node-webkit') {
    args.push('--runtime=node-webkit')
  } else if (opts.runtime === 'node') {
    // work around bug introduced in node 10's build https://github.com/nodejs/node-gyp/issues/1457
    args.push('--build_v8_with_gn=false')
  }
  if (opts.debug) args.push('--debug')

  if (opts.format) args.push('--', '--format', opts.format)

  gyp({
    gyp: opts.gyp,
    backend: opts.backend,
    log: opts.log,
    args: args,
    filter: function (command) {
      if (command.name === 'configure') {
        return configurePreGyp(command, opts)
      }
    }
  }, cb)
}

function configurePreGyp (command, opts) {
  var binary = opts.pkg.binary
  if (binary && binary.module_name) {
    command.args.push('-Dmodule_name=' + binary.module_name)
  }
{'fraction_non_alphanumeric': 0.19381443298969073, 'fraction_numerical': 0.003711340206185567, 'mean_word_length': 3.05685618729097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1616427', 'n_tokens_mistral': 873, 'n_tokens_neox': 848, 'n_words': 167}