Skip to content

The open alternative to Salesforce, designed for AI.

952 B
Raw Blame
import { type AppInitNextStep } from '@/app/types/app-init-next-step.type';
import { formatList } from '@/output/format-list';
import {
  boldText,
  commandText,
  dimText,
  formatSuccessLine,
} from '@/output/style';

export const formatAppInitSummary = ({
  appName,
  location,
  packageNames,
  packageVersion,
  nextSteps,
}: {
  appName: string;
  location: string;
  packageNames: string[];
  packageVersion: string;
  nextSteps: AppInitNextStep[];
}) => {
  const commandWidth = Math.max(
    ...nextSteps.map(({ command }) => command.length),
  );

  return [
    formatSuccessLine(`Created ${appName} in ${location}`),
    dimText(
      `  ${formatList(packageNames)} pinned to ${packageVersion}. Nothing was installed.`,
    ),
    '',
    boldText('Next steps'),
    ...nextSteps.map(
      ({ command, description }) =>
        `  ${commandText(command.padEnd(commandWidth))}  ${dimText(`# ${description}`)}`,
    ),
  ].join('\n');
};