mockey-patcher-cli
Version:
Global CLI tool for managing Mockey Patcher backend services with Docker Compose - API mocking and request redirection made simple
228 lines (156 loc) âĸ 3.98 kB
Markdown
# đ§ Mockey Patcher CLI
Global CLI tool for managing Mockey Patcher backend services with Docker Compose - API mocking and request redirection made simple.
## đĻ Installation
```bash
npm install -g mockey-patcher-cli
```
## đ Quick Start
```bash
# Install globally
npm install -g mockey-patcher-cli
# Initialize project (creates folder automatically)
mockey-patcher setup my-project
cd my-project
# Start services
mockey-patcher start
# Check status
mockey-patcher status
```
## đ Commands
### `mockey-patcher setup`
đ Initialize a new Mockey Patcher project.
```bash
mockey-patcher setup [project-name] [options]
Arguments:
project-name Name of the project folder to create
Options:
-p, --port <number> Backend API port (default: 3000)
--postgres-port <number> PostgreSQL port (default: 5432)
-u, --docker-username <username> Docker Hub username (default: shivarajbakale)
-f, --force Overwrite existing configuration
--no-interactive Skip interactive prompts
```
**Examples:**
```bash
# Interactive setup
mockey-patcher setup
# Create project with custom name
mockey-patcher setup my-api-project
# Non-interactive with custom port
mockey-patcher setup my-api --port 8080 --no-interactive
# Force overwrite existing project
mockey-patcher setup my-api --force
```
### `mockey-patcher start`
âļī¸ Start all services.
```bash
mockey-patcher start [options]
Options:
-d, --detach Run in detached mode
--pull Pull latest images before starting
--build Build images before starting
```
### `mockey-patcher stop`
âšī¸ Stop all services.
```bash
mockey-patcher stop [options]
Options:
-v, --volumes Remove volumes
```
### `mockey-patcher status`
đ Check service status.
```bash
mockey-patcher status [options]
Options:
-v, --verbose Show detailed status information
--json Output in JSON format
```
### `mockey-patcher restart`
đ Restart all services.
```bash
mockey-patcher restart [options]
Options:
--pull Pull latest images before restarting
--build Build images before restarting
```
### `mockey-patcher logs`
đ Show service logs.
```bash
mockey-patcher logs [service] [options]
Arguments:
service Service name (backend, postgres)
Options:
-f, --follow Follow log output
-t, --tail <number> Number of lines to show
--since <string> Show logs since timestamp
```
### `mockey-patcher reset`
đī¸ Reset project (remove containers, volumes, and data).
```bash
mockey-patcher reset [options]
Options:
-f, --force Skip confirmation
```
## đĄ Usage Examples
### Basic Usage
```bash
# Create new project
mockey-patcher setup my-api
cd my-api
# Start services
mockey-patcher start
# Test API
curl http://localhost:3000/health
# Stop services
mockey-patcher stop
```
### Development Workflow
```bash
# Start with latest images
mockey-patcher start --pull
# Monitor logs
mockey-patcher logs --follow
# Check status
mockey-patcher status --verbose
# Restart services
mockey-patcher restart
```
### Custom Configuration
```bash
# Setup with custom ports
mockey-patcher setup my-api --port 8080 --postgres-port 5433
cd my-api
# Start with latest images
mockey-patcher start --pull
# Monitor logs
mockey-patcher logs --follow
```
### Troubleshooting
```bash
# Check detailed status
mockey-patcher status --verbose
# View specific service logs
mockey-patcher logs backend --tail 50
# Reset everything
mockey-patcher reset --force
```
## đ ī¸ Requirements
- Node.js 16 or higher
- Docker and Docker Compose
- npm or yarn
## đ§ Development
```bash
# Clone the repository
git clone https://github.com/shivarajbakale/redirector-app.git
cd redirector-app/packages/backend/cli
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Link for local development
npm link
```
## đ License
MIT