How to build a CLI using NodeJS πŸ’»

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • shelljs

    :shell: Portable Unix shell commands for Node.js

  • As we are creating starter files, let's use ShellJS to run commands like git clone, mkdir...

  • react-tailwind-template

    quick template to start off with CRA+Tailwind

  • #! /usr/bin/env node const inquirer = require('inquirer'); const shell = require('shelljs'); const path = process.cwd(); const { questions, questionsTs } = require('./utils/questions.js'); inquirer.prompt(questions).then((answers) => { if (answers.framework === 'React') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/GKaszewski/react-tailwind-typescript-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/YashKumarVerma/react-tailwind-template ${answers.projectName}` ); console.log('πŸ› οΈ Successfully build the required files'); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'NextJS') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/avneesh0612/next-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/Neeraj1005/Nextjs-tailwind-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'Svelte') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/jhanca-vm/Svelte-Tailwind ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/web2033/vite-vue3-tailwind-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } });

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • Nextjs-tailwind-template

    Template Nextjs using Tailwindcss

  • #! /usr/bin/env node const inquirer = require('inquirer'); const shell = require('shelljs'); const path = process.cwd(); const { questions, questionsTs } = require('./utils/questions.js'); inquirer.prompt(questions).then((answers) => { if (answers.framework === 'React') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/GKaszewski/react-tailwind-typescript-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/YashKumarVerma/react-tailwind-template ${answers.projectName}` ); console.log('πŸ› οΈ Successfully build the required files'); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'NextJS') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/avneesh0612/next-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/Neeraj1005/Nextjs-tailwind-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'Svelte') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/jhanca-vm/Svelte-Tailwind ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/web2033/vite-vue3-tailwind-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } });

  • react-tailwind-typescript-template

    React Tailwind with Typescript template

  • #! /usr/bin/env node const inquirer = require('inquirer'); const shell = require('shelljs'); const path = process.cwd(); const { questions, questionsTs } = require('./utils/questions.js'); inquirer.prompt(questions).then((answers) => { if (answers.framework === 'React') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/GKaszewski/react-tailwind-typescript-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/YashKumarVerma/react-tailwind-template ${answers.projectName}` ); console.log('πŸ› οΈ Successfully build the required files'); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'NextJS') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/avneesh0612/next-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/Neeraj1005/Nextjs-tailwind-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'Svelte') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/jhanca-vm/Svelte-Tailwind ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/web2033/vite-vue3-tailwind-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } });

  • next-starter

    This template has everything you need to start building your Next.js app with typescript, tailwind CSS, and ESlint πŸŽ‰ (by avneesh0612)

  • #! /usr/bin/env node const inquirer = require('inquirer'); const shell = require('shelljs'); const path = process.cwd(); const { questions, questionsTs } = require('./utils/questions.js'); inquirer.prompt(questions).then((answers) => { if (answers.framework === 'React') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/GKaszewski/react-tailwind-typescript-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/YashKumarVerma/react-tailwind-template ${answers.projectName}` ); console.log('πŸ› οΈ Successfully build the required files'); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'NextJS') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/avneesh0612/next-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/Neeraj1005/Nextjs-tailwind-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'Svelte') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/jhanca-vm/Svelte-Tailwind ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/web2033/vite-vue3-tailwind-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } });

  • Svelte-Tailwind

    Discontinued Setting up Tailwind CSS in a Svelte project

  • #! /usr/bin/env node const inquirer = require('inquirer'); const shell = require('shelljs'); const path = process.cwd(); const { questions, questionsTs } = require('./utils/questions.js'); inquirer.prompt(questions).then((answers) => { if (answers.framework === 'React') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/GKaszewski/react-tailwind-typescript-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/YashKumarVerma/react-tailwind-template ${answers.projectName}` ); console.log('πŸ› οΈ Successfully build the required files'); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'NextJS') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/avneesh0612/next-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/Neeraj1005/Nextjs-tailwind-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'Svelte') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/jhanca-vm/Svelte-Tailwind ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/web2033/vite-vue3-tailwind-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } });

  • vite-vue3-tailwind-starter

    Discontinued Vite, Vue3, Tailwind CSS (single-page app)

  • #! /usr/bin/env node const inquirer = require('inquirer'); const shell = require('shelljs'); const path = process.cwd(); const { questions, questionsTs } = require('./utils/questions.js'); inquirer.prompt(questions).then((answers) => { if (answers.framework === 'React') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/GKaszewski/react-tailwind-typescript-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/YashKumarVerma/react-tailwind-template ${answers.projectName}` ); console.log('πŸ› οΈ Successfully build the required files'); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'NextJS') { inquirer.prompt(questionsTs).then((answersTs) => { if (answersTs.typescript === 'Yes') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/avneesh0612/next-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/Neeraj1005/Nextjs-tailwind-template ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } }); } else if (answers.framework === 'Svelte') { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/jhanca-vm/Svelte-Tailwind ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } else { shell.exec(`mkdir ${answers.projectName}`); shell.exec( `git clone https://github.com/web2033/vite-vue3-tailwind-starter ${answers.projectName}` ); shell.cd(`${path}/${answers.projectName}`); shell.exec(`npm i`); console.log( 'πŸ‘¨β€πŸ’» Successfully installed all the required dependencies\nHappy hacking πŸš€' ); } });

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • chalk

    πŸ– Terminal string styling done right

  • We add colors to the text by using Chalk

  • license-templates

    Templates for open source and other licenses

  • Check out license-templates GitHub repository for license templates which you could use in your project. In my case, I am using MIT license

  • tailwindcsscli

    A CLI for generating starter files for different JS frameworks with tailwindCSS pre-installed

  • { "name": "@kira272921/tailwindcsscli", "version": "1.0.0", "description": "A CLI for generating starter files for different JS frameworks with tailwindCSS pre-installed", "main": "./bin/index.js", "bin": { "tcli": "./bin/index.js" }, "scripts": { "start": "node ./bin/index.js" }, "keywords": ["cli", "tailwindcss", "nodejs"], "author": "Kira272921", "license": "MIT", "dependencies": { "inquirer": "^8.2.0", "shelljs": "^0.8.4" }, "repository": { "type": "git", "url": "git+https://github.com/Kira272921/tailwindcsscli.git" }, "bugs": { "url": "https://github.com/Kira272921/tailwindcsscli/issues" }, "homepage": "https://github.com/Kira272921/tailwindcsscli/issues#readme" }

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts