<commit_before>const { pipe, prop, sortBy, propSatisfies, filter } = require('ramda')
const { startsWith } = require('ramdasauce')
const Shell = require('shelljs')

const useYarn = Shell.which('yarn')

/**
 * Adds ignite goodies
 *
 * @return {Function} A function to attach to the context.
 */
function attach (plugin, command, context) {
  function findIgnitePlugins () {
    return pipe(
      filter(propSatisfies(startsWith('ignite-'), 'name')),
      sortBy(prop('name'))
    )(context.runtime.plugins)
  }

  function addModule (moduleName) {
    if (useYarn) {
      Shell.exec(`yarn add ${moduleName} --dev`, {silent: true})
    } else {
      Shell.exec(`npm i ${moduleName} --save-dev`, {silent: true})
    }
  }

  function removeModule (moduleName) {
    if (useYarn) {
      Shell.exec(`yarn remove ${moduleName}`, {silent: true})
    } else {
      Shell.exec(`npm rm ${moduleName}`, {silent: true})
    }
  }

  // copies example usage file to project for use in dev screens
  async function addComponentExample (sourceFolder, fileName) {
    // make sure examples is set
    if (context.config.ignite.examples === 'classic') {
      // copy to components/examples folder
      // Should be using template.generate but we can't due to gluegun #126
      context.filesystem.copy(`${sourceFolder}${fileName}`, `${process.cwd()}/App/Components/Examples/${fileName}`)
      // adds reference to usage example screen (if it exists)
    }
  }

  function removeComponentExample (exampleFile) {
    // remove file from components/examples folder
    // remove reference in usage example screen (if it exists)
  }

  // send back the extension
  return {
    useYarn,
    findIgnitePlugins,
    addModule,
    removeModule,
    addComponentExample,
    removeComponentExample
  }
}

module.exports = attach<commit_msg>remove deletes file<commit_after>const { pipe, prop, sortBy, propSatisfies, filter } = require('ramda')
const { startsWith } = require('ramdasauce')
const Shell = require('shelljs')

const useYarn = Shell.which('yarn')

/**
 * Adds ignite goodies
 *
 * @return {Function} A function to attach to the context.
 */
function attach (plugin, command, context) {
  function findIgnitePlugins () {
    return pipe(
      filter(propSatisfies(startsWith('ignite-'), 'name')),
      sortBy(prop('name'))
    )(context.runtime.plugins)
  }

  function addModule (moduleName) {
    if (useYarn) {
      Shell.exec(`yarn add ${moduleName} --dev`, {silent: true})
    } else {
      Shell.exec(`npm i ${moduleName} --save-dev`, {silent: true})
    }
  }

  function removeModule (moduleName) {
    if (useYarn) {
      Shell.exec(`yarn remove ${moduleName}`, {silent: true})
    } else {
      Shell.exec(`npm rm ${moduleName}`, {silent: true})
    }
  }

  // copies example usage file to project for use in dev screens
  async function addComponentExample (sourceFolder, fileName) {
    // make sure examples is set
    if (context.config.ignite.examples === 'classic') {
      // copy to Components/Examples folder
      // Should be using template.generate but we can't due to gluegun #126
      context.filesystem.copy(`${sourceFolder}${fileName}`, `${process.cwd()}/App/Components/Examples/${fileName}`)
      // adds reference to usage example screen (if it exists)
    }
  }

  function removeComponentExample (fileName) {
    // remove file from Components/Examples folder
    context.filesystem.remove(`${process.cwd()}/App/Components/Examples/${fileName}`)
    // remove reference in usage example screen (if it exists)
  }

  // send back the extension
  return {
    useYarn,
    findIgnitePlugins,
    addModule,
    removeModule,
    addComponentExample,
    removeComponentExample
  }
}

module.exports = attach
{'fraction_non_alphanumeric': 0.13071371291098638, 'fraction_numerical': 0.0016038492381716118, 'mean_word_length': 3.33603707995365, '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': '2557037', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1122, 'n_words': 312}