emirapp-cli
Version:
A CLI tool to scaffold modern Expo React Native applications with authentication, tab navigation, and TypeScript
247 lines (175 loc) ⢠7.13 kB
Markdown
# š EmirApp CLI
A powerful command-line tool to quickly scaffold modern Expo React Native applications with authentication, tab navigation, TypeScript, and React Query pre-configured.
[](https://badge.fury.io/js/emirapp-cli)
[](https://opensource.org/licenses/MIT)
## ⨠Features
- šÆ **Expo React Native** - Modern React Native framework with Expo Router
- š **Authentication Flow** - Complete phone number + OTP authentication
- š± **Tab Navigation** - Beautiful tab navigation with Expo icons
- š· **TypeScript First** - Full TypeScript support out of the box
- šØ **Modern UI** - Clean, professional design with proper styling
- š **React Query** - Data fetching and caching with TanStack React Query
- š¦ **Complete Structure** - Well-organized folder structure and components
- š§ **Ready to Use** - All dependencies installed and configured
- š **Beautiful CLI** - Colorful interface with spinners and progress indicators
- ā” **Fast Setup** - Optimized for speed with parallel operations
- šØ **ASCII Art Banner** - Eye-catching welcome screen
## š Table of Contents
- [Quick Start](#-quick-start)
- [Installation](#-installation)
- [Usage](#-usage)
- [Project Structure](#-project-structure)
- [How It Works](#-how-it-works)
- [Development](#-development)
- [Contributing](#-contributing)
- [License](#-license)
## š Quick Start
Get started in seconds with no global installation required:
```bash
npx emirapp-cli
```
Follow the interactive prompts and you'll have a fully configured Next.js application ready to go!
## š¦ Installation
### Option 1: Use with npx (Recommended)
No installation needed - just run when you need it:
```bash
npx emirapp-cli
```
### Option 2: Global Installation
Install globally for repeated use:
```bash
npm install -g emirapp-cli
# Then run anywhere
emirapp
```
## šÆ Usage
### Interactive Setup
Run the CLI and follow the guided setup:
```bash
npx emirapp-cli
```
### Step-by-Step Process
1. **Choose Framework**
- Currently supports Next.js with App Router
- More frameworks coming soon!
2. **Select Project Structure**
- **Simple**: Perfect for most projects
- **Enterprise**: Coming soon with advanced patterns
3. **Enter App Name**
- Accepts letters, numbers, spaces, dashes, and underscores
- Automatically sanitized to kebab-case
### What Happens Next
The CLI will automatically:
1. ā
Create a new Next.js app with TypeScript and Tailwind CSS
2. ā
Set up the enterprise folder structure
3. ā
Generate barrel export files for clean imports
4. ā
Install additional dependencies (Zod, React Query)
5. ā
Provide next steps instructions
## š Project Structure
Your generated project will have this clean, scalable structure:
```
my-next-app/
āāā š src/
ā āāā š app/ # Next.js App Router
ā ā āāā š (auth)/ # Authentication routes
ā ā āāā š (protected)/ # Protected routes
ā ā āāā š (unprotected)/ # Public routes
ā āāā š api/ # API layer
ā ā āāā š hooks/ # Custom React hooks
ā ā āāā š services/ # API service functions
ā āāā š components/ # React components
ā ā āāā š common/ # Shared components
ā ā āāā š features/ # Feature-specific components
ā ā āāā š icons/ # Icon components
ā ā āāā š layout/ # Layout components
ā ā āāā š modals/ # Modal components
ā ā āāā š ui/ # UI/Design system components
ā āāā š context/ # React Context providers
ā āāā š data/ # Data management
ā ā āāā š stores/ # State stores
ā āāā š lib/ # Utility libraries
ā āāā š types/ # TypeScript type definitions
āāā š public/ # Static assets
āāā š package.json
āāā š tsconfig.json
āāā š tailwind.config.js
āāā š next.config.js
```
### š Barrel Exports
Each major folder includes an `index.ts` file for clean imports:
```typescript
// src/components/ui/index.ts
export { default as Button } from "./Button";
export { default as Input } from "./Input";
export { default as Modal } from "./Modal";
```
This enables clean imports throughout your app:
```typescript
import { Button, Input, Modal } from "@/components/ui";
```
## āļø How It Works
### Technologies Used
- **[prompts](https://github.com/terkelg/prompts)** - Interactive CLI prompts
- **[execa](https://github.com/sindresorhus/execa)** - Process execution
- **[fs-extra](https://github.com/jprichardson/node-fs-extra)** - Enhanced file system operations
- **[chalk](https://github.com/chalk/chalk)** - Terminal string styling and colors
- **[ora](https://github.com/sindresorhus/ora)** - Elegant terminal spinners
- **[gradient-string](https://github.com/bokub/gradient-string)** - Beautiful color gradients
- **[figlet](https://github.com/patorjk/figlet.js)** - ASCII art text generation
### Process Flow
1. šÆ Interactive prompts collect user preferences
2. šļø Executes `create-next-app` with optimal configuration
3. š Creates enterprise-grade folder structure
4. š Generates barrel export files for clean imports
5. š¦ Installs additional dependencies via Yarn
6. ā
Provides success feedback and next steps
## š ļø Development
### Prerequisites
- Node.js 16+
- Yarn or npm
### Local Development Setup
1. **Clone the repository**
```bash
git clone <repository-url>
cd emirapp-cli
```
2. **Install dependencies**
```bash
yarn install
```
3. **Build the CLI**
```bash
yarn build
```
4. **Link for local testing**
```bash
npm link
```
5. **Test your changes**
```bash
emirapp
```
6. **Unlink when done**
```bash
npm unlink -g emirapp-cli
```
### Available Scripts
- `yarn build` - Compile TypeScript to JavaScript
- `yarn start` - Run the compiled CLI
- `yarn prepare` - Pre-publish build step
## š¤ Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
### Development Guidelines
1. Follow the existing code style
2. Add tests for new features
3. Update documentation as needed
4. Ensure all tests pass before submitting
## š License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## š Acknowledgments
- Next.js team for the amazing framework
- All the open-source libraries that make this tool possible
- The developer community for feedback and contributions
---
**Made with ā¤ļø for the developer community**
_Happy coding! š_