import chalk from 'chalk' import ora from 'ora' import { logger } from '@laughing-cli/utils' import type { PkgInstallerMap } from '../installers' import type { GenerateContext } from '../types' // This runs the installer for all the packages that the user has selected export const installPackages = async ( context: GenerateContext, packages: PkgInstallerMap, ) => { logger.info('Installing packages...') for (const [name, opts] of Object.entries(packages)) { if (opts.inUse) { const spinner = ora(`Installing ${name}...`).start() await opts.installer(context) spinner.succeed( chalk.green(`Successfully installed ${chalk.green.bold(name)}`), ) } } logger.info('') }