UNPKG

haseeb-cli

Version:

44 lines (35 loc) 1.14 kB
#!/usr/bin/env node const fs = require('fs'); const path = require('path'); const args = process.argv.slice(2); const command = args[0]; const packageName = args[1]; if (command === 'install' && packageName === 'god') { console.log('🌟 Installing divine powers...'); // 1. Create a new folder called 'god' const dirPath = path.join(process.cwd(), 'god'); if (!fs.existsSync(dirPath)) { fs.mkdirSync(dirPath); } // 2. Create a fake package.json inside it const pkg = { name: "god", version: "1.0.0", description: "Divine powers installed by Haseeb CLI", main: "index.js", author: "Haseeb", license: "ISC" }; fs.writeFileSync( path.join(dirPath, 'package.json'), JSON.stringify(pkg, null, 2) ); // 3. Create a divine index.js fs.writeFileSync( path.join(dirPath, 'index.js'), `console.log("🧙 Welcome, you now have god powers!");` ); console.log("✅ god package installed at:", dirPath); } else { console.log('❌ Unknown command!'); }