UNPKG

@laiyon/create-wasapi

Version:

CLI to create WhatsApp bot projects with Wasapi and BuilderBot

33 lines (32 loc) 1.27 kB
import chalk from "chalk"; import ora from "ora"; import { installTemplate } from "../templates/templateInstaller.js"; import { setupEnv } from "../setupEnv.js"; export class TemplateInstallationService { static async installTemplate(projectName, dbType, apiKey, phone, dbConfig) { try { // Continue with automatic setup steps that are already clear console.log(""); console.log(chalk.bgGreen.black(" 📦 TEMPLATE INSTALLATION ")); console.log(""); const spinner = ora("📦 Installing template...").start(); await installTemplate(projectName, dbType); spinner.succeed(chalk.green("✅ Template installed successfully")); // Configure environment variables console.log(""); console.log(chalk.bgBlue.white(" 🔧 ENVIRONMENT SETUP ")); console.log(""); await setupEnv(projectName, { API_KEY: apiKey, PHONE_ID: phone }, dbType, dbConfig); return { success: true }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error) }; } } }