UNPKG

@schemifyjs/cli

Version:
31 lines (30 loc) 1.05 kB
import { FrameworkType, PackageManagerType } from '@schemifyjs/types'; import enquirer from 'enquirer'; export async function askFramework() { const { framework } = await enquirer.prompt({ type: 'select', name: 'framework', message: 'Select the framework to use:', choices: Object.values(FrameworkType) }); return framework; } export async function askPackageManager() { const { packageManager } = await enquirer.prompt({ type: 'select', name: 'packageManager', message: 'Select the package manager to use:', choices: Object.values(PackageManagerType) }); return packageManager; } export async function askProjectName() { const { projectName } = await enquirer.prompt({ type: 'input', name: 'projectName', message: 'Enter the project name:', validate: (input) => /^[a-z]([a-z0-9]*(-[a-z0-9]+)*)?$/.test(input) || '❌ Invalid name. Use lowercase letters, numbers, and hyphens.' }); return projectName; }