UNPKG

nextdevkit

Version:

A Comprehensive CLI Toolkit for Next.js Development

27 lines (26 loc) 1.09 kB
import chalk from 'chalk'; import files from '../files.js'; const listCommands = async () => { if (files.length === 0) { console.log(chalk.yellow.bold('\n⚠️ No available files to display.\n')); return; } console.log(chalk.bold.green('\n✨ Available Utility and Hook Files ✨\n')); const headers = ['Name', 'Type']; const columnWidths = [20, 10]; const headerRow = headers .map((header, index) => chalk.bold(header.padEnd(columnWidths[index]))) .join(''); console.log(chalk.blueBright(headerRow)); console.log(chalk.gray('-'.repeat(columnWidths.reduce((a, b) => a + b)))); files.forEach((file) => { const row = [ chalk.cyan(file.command.padEnd(columnWidths[0])), chalk.yellow(file.type.padEnd(columnWidths[1])) ].join(''); console.log(row); }); console.log(chalk.gray('-'.repeat(columnWidths.reduce((a, b) => a + b)))); console.log(`\nTo add a file, run:\n${chalk.bgBlue.white.bold(' npx nextdevkit@latest add <name> ')}\n`); }; export default listCommands;