<commit_before>import * as child_process from "child_process"

import jsonDatabase from "../db/json"
import { DATABASE_JSON_FILE } from "../globals"

const log = console.log

const go = async () => {
  // Download settings
  const db = jsonDatabase(DATABASE_JSON_FILE)
  await db.setup()

  const installation = await db.getInstallation(0)
  if (!installation) {
    return
  }
  // Look for plugins
  if (installation.settings.plugins && installation.settings.plugins.length !== 0) {
    const plugins = installation.settings.plugins
    log("Installing: " + plugins.join(", "))

    const ls = child_process.spawn("yarn", ["add", ...plugins])

    ls.stdout.on("data", data => log(`stdout: ${data}`))
    ls.stderr.on("data", data => log(`stderr: ${data}`))

    ls.on("close", code => {
      log(`child process exited with code ${code}`)
      process.exit(code)
    })
  } else {
    log("Not adding any plugins")
    process.exit(0)
  }
}

go()
<commit_msg>Don't provide and env vars for the setup sub-process<commit_after>import * as child_process from "child_process"

import jsonDatabase from "../db/json"
import { DATABASE_JSON_FILE } from "../globals"

const log = console.log

const go = async () => {
  // Download settings
  const db = jsonDatabase(DATABASE_JSON_FILE)
  await db.setup()

  const installation = await db.getInstallation(0)
  if (!installation) {
    return
  }
  // Look for plugins
  if (installation.settings.plugins && installation.settings.plugins.length !== 0) {
    const plugins = installation.settings.plugins
    log("Installing: " + plugins.join(", "))

    // This will call `yarn build` which will call this, so we
    // bypass that by providing no ENV - which means `DATABASE_JSON_FILE`
    // won't exist.
    const ls = child_process.spawn("yarn", ["add", ...plugins], { env: {} })

    ls.stdout.on("data", data => log(`stdout: ${data}`))
    ls.stderr.on("data", data => log(`stderr: ${data}`))

    ls.on("close", code => {
      log(`child process exited with code ${code}`)
      process.exit(code)
    })
  } else {
    log("Not adding any plugins")
    process.exit(0)
  }
}

go()

{'fraction_non_alphanumeric': 0.15644028103044497, 'fraction_numerical': 0.002810304449648712, 'mean_word_length': 3.306451612903226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, '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': '795494', 'n_tokens_mistral': 691, 'n_tokens_neox': 673, 'n_words': 179}