Skip to content

jinxwaree/cli_tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-project

A CLI tool to scaffold new projects with customizable templates.

Node.js License

Demo

$ create-project my-app -y

  Create Project
  Scaffold a new project in seconds

  Project configuration:
  - Name: my-app
  - Author: Anonymous
  - License: MIT
  - Template: JavaScript

✔ Project created successfully!

About

This CLI tool automates project scaffolding, similar to create-react-app. It demonstrates understanding of file systems, templating, and developer workflows.

Features

  • Interactive Prompts - Guided setup asking for project name, author, and license
  • Dynamic Templating - Generates README.md, package.json, and source files based on your input
  • TypeScript Support - Use --typescript flag to generate TypeScript projects
  • Skip Prompts - Use -y flag to scaffold with defaults instantly
  • Colored Output - Clear, readable terminal output with progress indicators
  • Validation - Validates project names for npm compatibility

Installation

# Clone the repository
git clone <repository-url>
cd CLI_Tool

# Install dependencies
npm install

# Link globally (optional)
npm link

Usage

Interactive Mode

# Run with npx
npx create-project

# Or if linked globally
create-project

You'll be prompted for:

  • Project name
  • Author name
  • License type
  • TypeScript preference

With Arguments

# Create a project with a specific name
create-project my-awesome-app

# Skip all prompts with defaults
create-project my-app -y

# Create a TypeScript project
create-project my-ts-app --typescript

# Combine flags
create-project my-app -y --typescript

# Specify author and license
create-project my-app --author "John Doe" --license MIT

All Options

Option Alias Description
--yes -y Skip prompts and use default values
--typescript -t Generate TypeScript project
--author <name> -a Set author name
--license <type> -l Set license (MIT, ISC, Apache-2.0, GPL-3.0)
--version -V Display version number
--help -h Display help information

Generated Project Structure

JavaScript Project

my-project/
├── src/
│   ├── index.js      # Main entry point
│   └── styles.css    # Stylesheet
├── index.html        # HTML template
├── package.json      # Project configuration
├── .gitignore        # Git ignore rules
└── README.md         # Project documentation

TypeScript Project

my-project/
├── src/
│   ├── index.ts      # Main entry point
│   └── styles.css    # Stylesheet
├── index.html        # HTML template
├── package.json      # Project configuration
├── tsconfig.json     # TypeScript configuration
├── .gitignore        # Git ignore rules
└── README.md         # Project documentation

Examples

Quick Start

# Fastest way to scaffold a project
create-project my-app -y
cd my-app
npm install
npm start

TypeScript Project

create-project my-ts-app --typescript --author "Jane Doe" --license MIT
cd my-ts-app
npm install
npm run build
npm start

Development

# Run the CLI locally
npm start

# Or directly
node src/index.js my-test-project

# Test with TypeScript flag
node src/index.js my-test-project --typescript -y

Tech Stack

Why This Project?

Building a CLI tool demonstrates:

  1. Developer Experience Mindset - Understanding what makes tools pleasant to use
  2. File System Operations - Working with directories, files, and paths
  3. Template Generation - Dynamic content creation based on user input
  4. Argument Parsing - Professional flag and option handling
  5. User Interaction - Interactive prompts with validation
  6. Error Handling - Graceful failures with helpful messages

License

MIT

Releases

No releases published

Packages

No packages published