@sprouted/create-vibes
Version:
Create a new Vibes monorepo
39 lines • 1.5 kB
JavaScript
import { CreateAppCommand } from './create-app.js';
import inquirer from 'inquirer';
export class AddAppCommand {
constructor(templateEngine) {
this.createAppCommand = new CreateAppCommand(templateEngine);
}
async execute(appType) {
let finalType;
// If no type provided, prompt for it
if (!appType) {
const typeAnswer = await inquirer.prompt([{
type: 'list',
name: 'type',
message: 'What type of app?',
choices: [
{ name: 'Web (React/Next.js)', value: 'web' },
{ name: 'Mobile (React Native/Expo)', value: 'mobile' },
{ name: 'API (Express/TypeScript)', value: 'api' },
{ name: 'Desktop (Electron)', value: 'desktop' }
]
}]);
finalType = typeAnswer.type;
}
else {
// Validate the provided type
const validTypes = ['web', 'mobile', 'api', 'desktop'];
if (!validTypes.includes(appType)) {
throw new Error(`Invalid app type: ${appType}. Must be one of: ${validTypes.join(', ')}`);
}
finalType = appType;
}
// Delegate to CreateAppCommand with the type
const options = {
type: finalType
};
await this.createAppCommand.execute(options);
}
}
//# sourceMappingURL=add-app.js.map