@tsed/cli
Version:
CLI to bootstrap your Ts.ED project
33 lines (32 loc) • 1.1 kB
JavaScript
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
});
})
};
}