kira-crud
Version:
Intelligent CRUD Generator for Laravel and Angular
280 lines (217 loc) • 7.71 kB
JavaScript
/**
* Display the application banner
*/
function displayBanner() {
console.clear();
console.log(
titleGradient.multiline(
figlet.textSync("KIRA CODE", {
font: "Big",
horizontalLayout: "full",
})
)
);
console.log(
boxen(
`${chalk.bold("Intelligent CRUD Generator")} ${chalk.dim("v1.0.0")}\n` +
`${chalk.blue("Laravel")} + ${chalk.red(
"Angular"
)} Full-Stack Generator`,
{
padding: 1,
margin: { top: 1, bottom: 1 },
borderStyle: "round",
borderColor: "blue",
}
)
);
}
async function displayBanner(withAnimation = false) {
// Nettoyer l'écran
console.clear();
// Créer le logo KIRA CODE
const logoText = figlet.textSync("KIRA CODE", {
font: "Big",
horizontalLayout: "full",
});
// Si c'est le premier affichage, montrer l'animation
if (withAnimation) {
// Animation simple avec barre de progression et spinner
const loadingBar = new cliProgress.SingleBar({
format: chalk.cyan('Initialisation |{bar}| {percentage}%'),
barCompleteChar: '█',
barIncompleteChar: '░',
clearOnComplete: true
});
loadingBar.start(100, 0);
for (let i = 0; i <= 100; i += 5) {
loadingBar.update(i);
await new Promise(resolve => setTimeout(resolve, 15));
}
loadingBar.stop();
// Afficher le logo avec délai
console.log(titleGradient.multiline(logoText));
// Spinner pour indiquer que le système se charge
const spinner = createSpinner("Chargement du générateur CRUD...").start();
await new Promise(resolve => setTimeout(resolve, 800));
spinner.success({ text: "Générateur CRUD prêt !" });
} else {
// Sans animation, afficher directement
console.log(titleGradient.multiline(logoText));
}
// Afficher la boîte d'information (toujours sans animation)
console.log(
boxen(
`${chalk.bold("Intelligent CRUD Generator")} ${chalk.dim("v1.0.0")}\n` +
`${chalk.blue("Laravel")} + ${chalk.red("Angular")} Full-Stack Generator`,
{
padding: 1,
margin: { top: 1, bottom: 1 },
borderStyle: "round",
borderColor: "blue",
}
)
);
}
/**
* Display the application banner - Enhanced version
*/
function displayBanner() {
console.clear();
// Enhanced title with better font and gradient
console.log(
titleGradient.multiline(
figlet.textSync("KIRA CODE", {
font: "ANSI Shadow", // More impactful font
horizontalLayout: "full",
verticalLayout: "default",
})
)
);
// Stylized separator line
const separator = "═".repeat(60);
console.log(chalk.hex("#8731E8")(separator));
// Enhanced info box with better styling and content
const infoContent = [
`${chalk.bold.hex("#8731E8")("🚀 INTELLIGENT CRUD GENERATOR")} ${chalk.dim.hex("#4285F4")("v1.0.0")}`,
``,
`${chalk.hex("#34A853")("▶")} ${chalk.bold.hex("#EA4335")("Laravel")} ${chalk.dim("+")} ${chalk.bold.hex("#4285F4")("Angular")} ${chalk.dim("Full-Stack Generator")}`,
`${chalk.hex("#FBBC05")("▶")} ${chalk.dim("Automated CRUD operations with modern architecture")}`,
`${chalk.hex("#34A853")("▶")} ${chalk.dim("Smart scaffolding • Auto-routing • Multi-language support")}`,
].join("\n");
console.log(
boxen(infoContent, {
padding: { top: 1, bottom: 1, left: 3, right: 3 },
margin: { top: 1, bottom: 2 },
borderStyle: {
topLeft: "╭",
topRight: "╮",
bottomLeft: "╰",
bottomRight: "╯",
horizontal: "─",
vertical: "│",
},
borderColor: "#8731E8",
backgroundColor: "#1a1a2e",
})
);
// Status indicator
console.log(
chalk.hex("#34A853")("● READY") +
chalk.dim(" | ") +
chalk.hex("#4285F4")("● ONLINE") +
chalk.dim(" | ") +
chalk.hex("#FBBC05")("● STANDBY")
);
console.log(); // Extra line for spacing
}
async function displayBanner(withAnimation = false) {
// Nettoyer l'écran
console.clear();
console.log();
// Créer le logo KIRA CODE
const logoText = figlet.textSync("KIRA CODE", {
font: "ANSI Shadow", // More impactful font
horizontalLayout: "full",
verticalLayout: "default",
});
// Si c'est le premier affichage, montrer l'animation
if (withAnimation) {
// Animation simple avec barre de progression et spinner
const loadingBar = new cliProgress.SingleBar({
format: chalk.hex("#8731E8")('Initialisation |{bar}| {percentage}%'),
barCompleteChar: '█',
barIncompleteChar: '░',
clearOnComplete: true
});
loadingBar.start(100, 0);
for (let i = 0; i <= 500; i += 5) {
loadingBar.update(i);
await new Promise(resolve => setTimeout(resolve, 15));
}
loadingBar.stop();
// Afficher le logo avec délai
console.log(titleGradient.multiline(logoText));
// Spinner pour indiquer que le système se charge
const spinner = createSpinner("Chargement du générateur CRUD intelligent...").start();
await new Promise(resolve => setTimeout(resolve, 800));
spinner.success({ text: "CRUD generator ready!" });
} else {
// Sans animation, afficher directement
console.log(titleGradient.multiline(logoText));
}
// Stylized separator line
const separator = "═".repeat(60);
console.log(chalk.hex("#8731E8")(separator));
// Enhanced info box with better styling and content
const infoContent = [
`${chalk.bold.hex("#8731E8")("🚀 INTELLIGENT CRUD GENERATOR")} ${chalk.dim.hex("#4285F4")("v1.0.0")}`,
``,
`${chalk.hex("#34A853")("▶")} ${chalk.bold.hex("#EA4335")("Laravel")} ${chalk.dim("+")} ${chalk.bold.hex("#4285F4")("Angular")} ${chalk.dim("Full-Stack Generator")}`,
`${chalk.hex("#FBBC05")("▶")} ${chalk.dim("Automated CRUD operations with modern architecture")}`,
`${chalk.hex("#34A853")("▶")} ${chalk.dim("Smart scaffolding • Auto-routing • Multi-language support")}`,
`${chalk.hex("#34A853")("")} ${chalk.dim("")}`,
`${chalk.hex("#34A853")("😊")} ${chalk.dim("Developed with by Alexis Katel and Calyarte")}`,
].join("\n");
// Afficher la boîte d'information avec animation conditionnelle
if (withAnimation) {
// Animation typewriter pour chaque ligne avec délai
const lines = infoContent.split('\n');
for (let i = 0; i < lines.length; i++) {
if (lines[i].trim()) {
console.log(` ${lines[i]}`);
await new Promise(resolve => setTimeout(resolve, 200));
} else {
console.log();
}
}
// Délai avant d'afficher la box finale
await new Promise(resolve => setTimeout(resolve, 500));
// Effacer les lignes précédentes et afficher la box complète
process.stdout.write('\u001b[' + (lines.length + 1) + 'A'); // Remonter
process.stdout.write('\u001b[0J'); // Effacer vers le bas
}
// Toujours afficher la box complète (que ce soit avec ou sans animation)
console.log(
boxen(infoContent, {
padding: { top: 1, bottom: 1, left: 3, right: 3 },
margin: { top: 1, bottom: 2 },
borderStyle: {
topLeft: "╭",
topRight: "╮",
bottomLeft: "╰",
bottomRight: "╯",
horizontal: "─",
vertical: "│",
},
borderColor: "#8731E8",
backgroundColor: "#1a1a2e",
})
);
// Status indicator avec animation conditionnelle
const statuses = [
{ text: "READY", color: "#34A853" },
{ text: "ONLINE", color: "#4285F4" },
{ text: "STANDBY", color: "#FBBC05" }
];
}