0.1.0 • Published 9 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.comOr you can install it globally:
npm install -g ngrok-clone
ngrok-clone --port 3000Usage
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-cloneSpecify a different port:
npx ngrok-clone --port 8080Connect to a specific server:
npx ngrok-clone --server https://your-ngrok-server.comRequest a custom subdomain:
npx ngrok-clone --subdomain myappUse authentication:
npx ngrok-clone --token your-auth-tokenCombine multiple options:
npx ngrok-clone --port 8080 --subdomain myapp --server https://your-ngrok-server.comFeatures
- 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 startTesting 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.comOption 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-cloneOption 3: Direct execution
Run the TypeScript file directly:
npx tsx src/index.ts --port 3000Or run the compiled JavaScript:
npm run build
node dist/index.js --port 30000.1.0
9 months ago