devtips-cli
Version:
CLI that shows daily productivity, Git, or coding tips
21 lines (15 loc) • 560 B
JavaScript
const fs = require("fs");
const path = require("path");
// Dynamically import ESM-only module
(async () => {
const { default: chalk } = await import('chalk');
// Load tips
const tipsPath = path.join(__dirname, "../data/tips.json");
const tips = JSON.parse(fs.readFileSync(tipsPath, "utf-8"));
// Pick a random tip
const tip = tips[Math.floor(Math.random() * tips.length)];
// Display
console.log(chalk.green.bold("\n💡 Dev Tip of the Day:"));
console.log(chalk.yellowBright(`\n${tip}\n`));
})();