0.1.0 • Published 6 months ago
ngrok-clone v0.1.0
ngrok-clone CLI
A command-line client for creating tunnels to expose your local web server.
Installation
This CLI can be used without installation via npx
:
npx ngrok-clone --port 3000 --server https://your-ngrok-server.com
Or you can install it globally:
npm install -g ngrok-clone
ngrok-clone --port 3000
Usage
ngrok-clone [options]
Options
-p, --port <port>
: Local port to forward (default: 3000)-s, --server <url>
: Server URL (default: https://ngrokclone.com)-d, --subdomain <subdomain>
: Request a specific subdomain (if available)-t, --token <token>
: Authentication token (if required)-h, --help
: Display help information-v, --version
: Display version information
Examples
Basic usage (forwards localhost:3000):
npx ngrok-clone
Specify a different port:
npx ngrok-clone --port 8080
Connect to a specific server:
npx ngrok-clone --server https://your-ngrok-server.com
Request a custom subdomain:
npx ngrok-clone --subdomain myapp
Use authentication:
npx ngrok-clone --token your-auth-token
Combine multiple options:
npx ngrok-clone --port 8080 --subdomain myapp --server https://your-ngrok-server.com
Features
- Exposes local web servers to the internet
- Works with HTTP and HTTPS
- Simple command-line interface
- Custom server support
- Authentication support
Development
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build the CLI
npm run build
# Run the built CLI
npm start
Testing Locally (Without Publishing to npm)
You can test the CLI locally without publishing to npm using several methods:
Option 1: Using the debug script
The easiest way to test is using our debug script that simulates a successful connection:
# Run the debug mode
npm run debug -- --port 8080 --server https://your-server.com
# Or use the convenience shell script
./test-cli.sh --port 8080 --server https://your-server.com
Option 2: Using npm link
You can use npm link to create a global symlink to your package:
# From the client-cli directory
npm run build
npm link
# Now you can run it from anywhere
ngrok-clone --port 3000
# When done, unlink it
npm unlink -g ngrok-clone
Option 3: Direct execution
Run the TypeScript file directly:
npx tsx src/index.ts --port 3000
Or run the compiled JavaScript:
npm run build
node dist/index.js --port 3000
0.1.0
6 months ago