create-vite-pp
Version:
CLI to scaffold a Vite + React + Tailwind project with JS/TS option
352 lines (250 loc) โข 8.21 kB
Markdown
# create-vite-pp ๐
> **Lightning-fast React + Vite + Tailwind CSS project generator**
A powerful CLI tool that scaffolds a complete React project with Vite and Tailwind CSS in under 30 seconds. No more repetitive setup - just answer 2 questions and start coding!
[](https://badge.fury.io/js/create-vite-pp)
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
## โจ Features
- ๐ **Ultra Fast Setup** - Complete project in 30 seconds
- ๐ **Smart Validation** - Prerequisites check & name validation
- ๐ฏ **Interactive CLI** - User-friendly prompts with validation
- โก **Latest Tech Stack** - Vite, React 18, TailwindCSS v3.4+
- ๐ **Language Choice** - JavaScript or TypeScript support
- ๐จ **Zero Configuration** - Perfect configs out of the box
- ๐งน **Clean Boilerplate** - No unnecessary code cluttering
- ๐ **Auto Documentation** - Comprehensive README generation
- ๐ก๏ธ **Error Handling** - Graceful failures with helpful messages
- ๐ **Latest Dependencies** - Always uses current versions
## ๐ Quick Start
```bash
# Using npx (recommended)
npx create-vite-pp
# Or install globally
npm install -g create-vite-pp
create-vite-pp
```
## ๐ Requirements
- **Node.js** โฅ 14.0.0
- **npm** โฅ 6.0.0
_The CLI automatically checks these prerequisites before starting._
## ๐ฏ Usage
### Interactive Mode
Simply run the command and follow the prompts:
```bash
$ npx create-vite-pp
==================================================
๐ React + Vite + Tailwind Setup
==================================================
? Enter your project name: โบ my-awesome-app
? Select language: โบ
โฏ JavaScript
TypeScript
โ Prerequisites check passed
โณ Creating Vite project...
โ Vite project created successfully
โณ Installing dependencies...
โ Dependencies installed successfully
โณ Setting up Tailwind CSS...
โ Tailwind CSS setup completed
โณ Updating App component...
โ App component updated
โณ Creating README...
โ README created
==================================================
๐ Setup Complete!
==================================================
Next steps:
1. cd my-awesome-app
2. npm run dev
3. Open http://localhost:5173
โ Your React + Vite + Tailwind project is ready!
```
---
### Project Structure
The CLI creates a well-organized project structure:
```
my-awesome-app/
โโโ public/ # Static assets
โโโ src/
โ โโโ assets/ # Images, icons, etc.
โ โโโ App.jsx (or .tsx) # Main App component
โ โโโ App.css # Component styles
โ โโโ index.css # Global styles (Tailwind imports)
โ โโโ main.js (or .ts) # Application entry point
โโโ index.html # HTML template
โโโ package.json # Dependencies and scripts
โโโ tailwind.config.js # Tailwind configuration
โโโ postcss.config.js # PostCSS configuration
โโโ vite.config.js # Vite configuration
โโโ README.md # Project documentation
```
## ๐ ๏ธ What Gets Installed
### Core Dependencies
- **React** ^18.2.0 - Modern React with hooks
- **React-DOM** ^18.2.0 - React DOM renderer
### Development Dependencies
- **Vite** ^5.0.0+ - Lightning-fast build tool
- **TailwindCSS** ^3.4.0 - Utility-first CSS framework
- **@tailwindcss/postcss** - PostCSS integration
- **Autoprefixer** - CSS vendor prefixes
- **ESLint** - Code linting (React configuration)
### TypeScript (if selected)
- **TypeScript** ^5.0.0+ - Static type checking
- **@types/react** - React type definitions
- **@types/react-dom** - React DOM type definitions
## โ๏ธ Configuration Details
### Tailwind Configuration
```javascript
// tailwind.config.js
export default {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
};
```
### PostCSS Configuration
```javascript
// postcss.config.js
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
```
### CSS Setup
The generated `src/index.css` includes:
```css
@tailwind base;
@tailwind components;
@tailwind utilities;
```
## ๐จ Clean Boilerplate
Unlike other generators, `create-vite-pp` provides a minimal, clean starting point:
```jsx
function App() {
return (
<div className="min-h-screen relative bg-black">
{/* Attribution */}
<div className="fixed bottom-4 right-4 text-xs text-gray-400">
โ Pritam Paul โ
</div>
</div>
);
}
export default App;
```
Perfect for starting your project without removing unnecessary code!
## ๐ฆ Available Scripts
After project creation, you can run:
```bash
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Run linting
npm run lint
```
## ๐ Validation Features
### Project Name Validation
- โ
Non-empty names
- โ
Valid characters (alphanumeric, hyphens, underscores)
- โ
No directory conflicts
- โ
Proper naming conventions
### Prerequisites Check
- โ
Node.js installation
- โ
npm availability
- โ
Version compatibility
## ๐ฏ Advanced Usage
### Handling Errors
The CLI provides helpful error messages:
```bash
โ Command failed: npm install
โ Error: Network timeout
```
### Interruption Handling
Safe interruption with `Ctrl+C`:
```bash
โ Setup interrupted
```
## ๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
### Development Setup
```bash
# Clone the repository
git clone https://github.com/pritam-pauldev/create-vite-pp.git
cd create-vite-pp
# Install dependencies
npm install
# Test locally
npm link
create-vite-pp test-project
```
### Building
```bash
# Test the package
npm run start
# Publish to npm
npm publish
```
## ๐ Changelog
### v1.0.8
- โ
Added TypeScript support
- โ
Improved error handling
- โ
Updated to TailwindCSS v3.4+
- โ
Enhanced project validation
- โ
Better README generation
### v1.0.7
- โ
Initial release
- โ
Basic Vite + React + Tailwind setup
- โ
Interactive CLI prompts
## ๐ Troubleshooting
### Common Issues
**Issue**: `npm ERR! EACCES: permission denied`
```bash
# Solution: Fix npm permissions
npm config set prefix ~/.npm-global
export PATH=~/.npm-global/bin:$PATH
```
**Issue**: `Command 'create-vite-pp' not found`
```bash
# Solution: Install globally or use npx
npm install -g create-vite-pp
# OR
npx create-vite-pp
```
**Issue**: Slow installation
```bash
# Solution: Use faster npm registry
npm config set registry https://registry.npmjs.org/
```
## ๐ Performance
- **Setup Time**: ~30 seconds
- **Package Size**: ~24 dependencies
- **Node.js Requirement**: โฅ14.0.0
- **Cross-Platform**: โ
Windows, macOS, Linux
## ๐ Related Projects
- [Vite](https://vitejs.dev/) - Next generation frontend tooling
- [React](https://reactjs.org/) - A JavaScript library for building user interfaces
- [Tailwind CSS](https://tailwindcss.com/) - Rapidly build modern websites
## ๐ License
MIT License - see the [LICENSE](LICENSE) file for details.
## ๐จโ๐ป Author
**Pritam Paul**
- GitHub: @pritam-pauldev
- LinkedIn: linkedin.com/in/pritam-dev
- Email: pritampaulcontactme@gmail.com
## ๐ Acknowledgments
- The Vite team for the amazing build tool
- The React team for the fantastic library
- The Tailwind CSS team for the utility-first framework
- All contributors and users of this package
---
<div align="center">
**[โญ Star this repo](https://github.com/pritam-pauldev/create-vite-pp) if you found it helpful!**
Made with โค๏ธ by **Pritam Paul**
</div>