<commit_before>import escapeHtml from 'escape-html'

import { DependencyResolved } from '../types'
import { markPackageAsIgnored } from '../helpers'

let showResetInstruction = true
export function confirmPackagesToInstall({
  packageName,
  dependencies,
}: {
  packageName: string
  dependencies: (DependencyResolved | DependencyResolved[])[]
}): Promise<DependencyResolved[]> {
  return new Promise((resolve) => {
    const ungroupedDependencies = dependencies.filter((item) => !Array.isArray(item)) as DependencyResolved[]
    const groupedDependencies = dependencies.filter((item) => Array.isArray(item)) as DependencyResolved[][]

    const skipGroups = groupedDependencies.length === 0
    const detail = skipGroups
      ? ungroupedDependencies.map((item) => item.name).join(', ')
      : 'Something went wrong. Check your developer console'
    const groupChoices = groupedDependencies.map((item) => item[0])

    // If Atom "notifications" package is disabled output a warning in case no other notifications package is installed.
    if (atom.packages.isPackageDisabled('notifications')) {
      console.warn(`Enable notifications to install dependencies for ${packageName}`)
    }
    const notification = atom.notifications.addInfo(`${packageName} needs to install dependencies`, {
      dismissable: true,
      icon: 'cloud-download',
      detail,
      description: `Install dependenc${dependencies.length === 1 ? 'y' : 'ies'}?`,
      buttons: [
        {
          text: 'Yes',
          onDidClick: () => {
            if (skipGroups) {
              resolve([])
            } else {
              resolve(ungroupedDependencies.concat(groupChoices))
            }<commit_msg>fix: ungrouped dependencies were never installed<commit_after>import escapeHtml from 'escape-html'

import { DependencyResolved } from '../types'
import { markPackageAsIgnored } from '../helpers'

let showResetInstruction = true
export function confirmPackagesToInstall({
  packageName,
  dependencies,
}: {
  packageName: string
  dependencies: (DependencyResolved | DependencyResolved[])[]
}): Promise<DependencyResolved[]> {
  return new Promise((resolve) => {
    const ungroupedDependencies = dependencies.filter((item) => !Array.isArray(item)) as DependencyResolved[]
    const groupedDependencies = dependencies.filter((item) => Array.isArray(item)) as DependencyResolved[][]

    const skipGroups = groupedDependencies.length === 0
    const detail = skipGroups
      ? ungroupedDependencies.map((item) => item.name).join(', ')
      : 'Something went wrong. Check your developer console'
    const groupChoices = groupedDependencies.map((item) => item[0])

    // If Atom "notifications" package is disabled output a warning in case no other notifications package is installed.
    if (atom.packages.isPackageDisabled('notifications')) {
      console.warn(`Enable notifications to install dependencies for ${packageName}`)
    }
    const notification = atom.notifications.addInfo(`${packageName} needs to install dependencies`, {
      dismissable: true,
      icon: 'cloud-download',
      detail,
      description: `Install dependenc${dependencies.length === 1 ? 'y' : 'ies'}?`,
      buttons: [
        {
          text: 'Yes',
          onDidClick: () => {
            if (skipGroups) {
              resolve(ungroupedDependencies)
            } else {
              resolve(ungroupedDependencies.concat(groupChoices))
            }
{'fraction_non_alphanumeric': 0.11766414875072632, 'fraction_numerical': 0.0017431725740848344, 'mean_word_length': 3.578457446808511, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '2528522', 'n_tokens_mistral': 914, 'n_tokens_neox': 875, 'n_words': 233}