UNPKG

kira-crud

Version:

Intelligent CRUD Generator for Laravel and Angular

141 lines (125 loc) 4.45 kB
#!/usr/bin/env node /** * Test pour l'animation de bannière */ const figlet = require("figlet"); const chalk = require("chalk"); const boxen = require("boxen"); const gradient = require("gradient-string"); const chalkAnimation = require("chalk-animation"); // Fix pour chalk-animation qui exporte différemment en ESM vs CommonJS const animationFunctions = ['rainbow', 'pulse', 'glitch', 'radar', 'neon', 'karaoke']; animationFunctions.forEach(name => { if (typeof chalkAnimation[name] !== 'function') { chalkAnimation[name] = (text, speed) => { // Utiliser la méthode par défaut si disponible if (typeof chalkAnimation.default === 'function') { return chalkAnimation.default(name, text, speed); } // Fallback simple console.log(chalk.cyan(text)); return { stop: () => {} }; }; } }); const { createSpinner } = require("nanospinner"); const clear = require("clear"); const cliProgress = require("cli-progress"); let terminalLink = require("terminal-link"); // Fix pour terminal-link qui peut exporter différemment en ESM vs CommonJS if (typeof terminalLink !== 'function' && terminalLink.default) { terminalLink = terminalLink.default; } // Constants for styling const PRIMARY_COLOR = "#4285F4"; const SUCCESS_COLOR = "#34A853"; const WARNING_COLOR = "#FBBC05"; const ERROR_COLOR = "#EA4335"; const HIGHLIGHT_COLOR = "#8731E8"; // Gradient styles const titleGradient = gradient(["#8731E8", "#4285F4"]); const successGradient = gradient(["#34A853", "#4ECDC4"]); async function displayBanner() { // Nettoyer l'écran clear(); // Afficher une barre de progression de chargement const loadingBar = new cliProgress.SingleBar({ format: `${chalk.cyan('Initialisation')} |${chalk.cyan('{bar}')}| {percentage}% || {value}/{total}`, barCompleteChar: '\u2588', barIncompleteChar: '\u2591', hideCursor: true, clearOnComplete: true }); loadingBar.start(100, 0); // Simuler un chargement for (let i = 0; i <= 100; i += 5) { loadingBar.update(i); await new Promise(resolve => setTimeout(resolve, 20)); } loadingBar.stop(); // Afficher le logo KIRA avec animation const logoText = figlet.textSync("KIRA AI", { font: "Big", horizontalLayout: "full", }); // Animation de texte - entrée lettre par lettre try { const logoAnimation = chalkAnimation.rainbow(logoText); await new Promise(resolve => setTimeout(resolve, 1500)); if (logoAnimation && typeof logoAnimation.stop === 'function') { logoAnimation.stop(); } } catch (error) { // Fallback en cas d'erreur avec l'animation console.log(chalk.cyan(logoText)); } // Afficher le logo avec dégradé fixe après l'animation console.log(titleGradient.multiline(logoText)); // Spinner pour la description const spinner = createSpinner("Chargement de l'environnement Kira").start(); await new Promise(resolve => setTimeout(resolve, 800)); spinner.success({ text: "Environnement Kira prêt!" }); // Version animée const version = "v1.2.5"; try { const versionAnimation = chalkAnimation.pulse(`${chalk.bold("Version")} ${version}`); await new Promise(resolve => setTimeout(resolve, 1000)); if (versionAnimation && typeof versionAnimation.stop === 'function') { versionAnimation.stop(); } } catch (error) { // Fallback en cas d'erreur avec l'animation console.log(chalk.cyan(`${chalk.bold("Version")} ${version}`)); } // Afficher la boîte d'information console.log( boxen( `${chalk.bold("Intelligence artificielle pour génération CRUD")}\n\n` + `${chalk.blue("Laravel")} + ${chalk.red("Angular")} Full-Stack Generator\n\n` + `${chalk.dim("Docs:")} ${typeof terminalLink === 'function' ? terminalLink('Documentation', 'https://kira-generator.dev') : 'https://kira-generator.dev'}`, { padding: 1, margin: { top: 1, bottom: 1 }, borderStyle: "round", borderColor: "blue", title: chalk.bold.cyan("KIRA AI GENERATOR"), titleAlignment: "center", } ) ); } // Exécution du test async function main() { try { await displayBanner(); console.log("Bannière affichée avec succès !"); process.exit(0); } catch (error) { console.error(chalk.red(`\nUne erreur s'est produite : ${error.message}\n`)); process.exit(1); } } // Démarrer le test main();