<commit_before>// TODO: move to separate package. It is used in supi/lib/install.ts as well

import logger from '@pnpm/logger'
import pLimit = require('p-limit')
import {StoreController} from 'package-store'
import R = require('ramda')
import postInstall from 'supi/lib/install/postInstall'
import {DepGraphNodesByDepPath} from '.'
import {ENGINE_NAME} from './constants'

export default async (
  depGraph: DepGraphNodesByDepPath,
  opts: {
    childConcurrency: number,
    prefix: string,
    rawNpmConfig: object,
    unsafePerm: boolean,
    userAgent: string,
    sideEffectsCache: boolean,
    sideEffectsCacheReadonly: boolean,
    storeController: StoreController,
  },
) => {
  // postinstall hooks
  const limitChild = pLimit(opts.childConcurrency || 4)
  await Promise.all(
    R.keys(depGraph)
      .filter((depPath) => !depGraph[depPath].isBuilt)
      .map((depPath) => limitChild(async () => {
        const depNode = depGraph[depPath]<commit_msg>refactor: add todo to postinstall function<commit_after>// TODO: move to separate package. It is used in supi/lib/install.ts as well

import logger from '@pnpm/logger'
import pLimit = require('p-limit')
import {StoreController} from 'package-store'
import R = require('ramda')
import postInstall from 'supi/lib/install/postInstall'
import {DepGraphNodesByDepPath} from '.'
import {ENGINE_NAME} from './constants'

export default async (
  depGraph: DepGraphNodesByDepPath,
  opts: {
    childConcurrency: number,
    prefix: string,
    rawNpmConfig: object,
    unsafePerm: boolean,
    userAgent: string,
    sideEffectsCache: boolean,
    sideEffectsCacheReadonly: boolean,
    storeController: StoreController,
  },
) => {
  // postinstall hooks
  const limitChild = pLimit(opts.childConcurrency || 4)
  // TODO: run depencies first then dependents. Use graph-sequencer to sort the graph
  await Promise.all(
    R.keys(depGraph)
      .filter((depPath) => !depGraph[depPath].isBuilt)
      .map((depPath) => limitChild(async () => {
        const depNode = depGraph[depPath]
{'fraction_non_alphanumeric': 0.11257953989231523, 'fraction_numerical': 0.0009789525208027412, 'mean_word_length': 4.148614609571789, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1529375', 'n_tokens_mistral': 620, 'n_tokens_neox': 619, 'n_words': 168}