UNPKG

@tsed/cli

Version:
33 lines (32 loc) 1.1 kB
import { cleanObject, isFunction } from "@tsed/core"; import { FeaturesMap, FeaturesPrompt, FrameworksPrompt } from "../config/FeaturesPrompt.js"; function mapChoices(item, options) { return item.choices.map((choice) => { const { checked } = FeaturesMap[choice]; return cleanObject({ ...FeaturesMap[choice], value: choice, checked: isFunction(checked) ? checked(options) : checked }); }); } export function getFeaturesPrompt(runtimes, availablePackageManagers, options) { return FeaturesPrompt(runtimes, availablePackageManagers).map((item, index) => { return cleanObject({ ...item, choices: item.choices?.length ? mapChoices(item, options) : undefined }); }); } export function getFrameworksPrompt() { return { ...FrameworksPrompt, choices: FrameworksPrompt.choices.map((choice, index) => { return cleanObject({ ...FeaturesMap[choice], checked: index === 0, value: choice }); }) }; }