<commit_before>const readPackage = require('read-closest-package')
const createPkg = require('base-package-json')
const prompt = require('inquirer').prompt
const assign = require('xtend/mutable')
const mapLimit = require('map-limit')
const eos = require('end-of-stream')
const json = require('JSONStream')
const mkdirp = require('mkdirp')
const assert = require('assert')
const touch = require('touch')
const path = require('path')
const pump = require('pump')
const fs = require('fs')

module.exports = initializeSubpackage

// Create a fresh subpackage
// (obj, fn) -> null
function initializeSubpackage (argv, cb) {
  assert.equal(typeof argv, 'object')
  assert.equal(typeof cb, 'function')
  const fns = [
    runPrompt,
    mkdir,
    updatePkg,
    touchFiles,
    createPackage
  ]
  mapLimit(fns, 1, function (fn, next) { fn(argv, next) }, cb)
}

// prompt for stuff
// (obj, fn) -> null
function runPrompt (argv, cb) {
  const questions = []
  if (!argv.name) {
    questions.push({ name: 'name', default: '', message: 'Project name' })
  }

  if (!questions.length) return cb()
  prompt(questions, function (res) {
    assign(argv, res)
    cb()
  })
}

// change to directory
// (obj, fn) -> null<commit_msg>prompt: fix text<commit_after>const readPackage = require('read-closest-package')
const createPkg = require('base-package-json')
const prompt = require('inquirer').prompt
const assign = require('xtend/mutable')
const mapLimit = require('map-limit')
const eos = require('end-of-stream')
const json = require('JSONStream')
const mkdirp = require('mkdirp')
const assert = require('assert')
const touch = require('touch')
const path = require('path')
const pump = require('pump')
const fs = require('fs')

module.exports = initializeSubpackage

// Create a fresh subpackage
// (obj, fn) -> null
function initializeSubpackage (argv, cb) {
  assert.equal(typeof argv, 'object')
  assert.equal(typeof cb, 'function')
  const fns = [
    runPrompt,
    mkdir,
    updatePkg,
    touchFiles,
    createPackage
  ]
  mapLimit(fns, 1, function (fn, next) { fn(argv, next) }, cb)
}

// prompt for stuff
// (obj, fn) -> null
function runPrompt (argv, cb) {
  const questions = []
  if (!argv.name) {
    questions.push({ name: 'name', default: '', message: 'Package name' })
  }

  if (!questions.length) return cb()
  prompt(questions, function (res) {
    assign(argv, res)
    cb()
  })
}

// change to directory
// (obj, fn) -> null
{'fraction_non_alphanumeric': 0.15677445763405648, 'fraction_numerical': 0.0008186655751125665, 'mean_word_length': 4.102296450939457, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '150433', 'n_tokens_mistral': 789, 'n_tokens_neox': 775, 'n_words': 221}