UNPKG

nodejs-fs

Version:

Node JS folder structure.

34 lines (28 loc) 1.13 kB
#!/usr/bin/env node import { execSync } from 'child_process'; const runCommand = (command) => { try { execSync(`${command}`, { stdio: 'inherit' }); } catch (e) { console.error(`Failed to execute ${command}`, e); return false; } return true; }; const repoName = process.argv[2]; if (!repoName) { console.log(`=> npx nodejs-fs projectName.`); process.exit(-1); } const gitCheckoutCommand = `git clone https://github.com/iiMuhammadRashed/NodeJS-FS.git ${repoName}`; const installDepsCommand = `cd ${repoName} && npm init -y && npm i bcrypt dotenv express joi jsonwebtoken mongoose multer slugify cloudinary morgan uuid`; console.log(`Making the NodeJS Folder Structure with name ${repoName}`); const checkOut = runCommand(gitCheckoutCommand); if (!checkOut) process.exit(-1); console.log(`Installing dependencies for ${repoName}`); const installDeps = runCommand(installDepsCommand); if (!installDeps) process.exit(-1); console.log(`Your NodeJS Folder Structure is Ready...`); console.log( `cd ${repoName} && Don't Forget edit data in .env file 🔑 && HaveFun ❤️` );