Skip to content

Commit

Permalink
chore: several minor adjustments
Browse files Browse the repository at this point in the history
chore: wip

chore: wip
  • Loading branch information
chrisbbreuer committed Dec 27, 2024
1 parent c4c9491 commit 77b1297
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 63 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:
uses: softprops/action-gh-release@v2
with:
files: |
bin/lpx-linux-x64
bin/lpx-linux-arm64
bin/lpx-windows-x64.exe
bin/lpx-darwin-x64
bin/lpx-darwin-arm64
bin/localtunnels-linux-x64
bin/localtunnels-linux-arm64
bin/localtunnels-windows-x64.exe
bin/localtunnels-darwin-x64
bin/localtunnels-darwin-arm64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

## Install

```bash
```sh
bun install -d localtunnels
```

<!-- _Alternatively, you can install:_
```bash
```sh
brew install localtunnels # wip
pkgx install localtunnels # wip
``` -->
Expand Down Expand Up @@ -71,13 +71,13 @@ export default config

_Then run:_

```bash
```sh
./localtunnels start
```

### CLI

```bash
```sh
localtunnels start --from localhost:5173 --subdomain test --verbose
localtunnels --help
localtunnels --version
Expand All @@ -87,7 +87,7 @@ To learn more, head over to the [documentation](https://localtunnels.sh/).

## Testing

```bash
```sh
bun test
```

Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const sidebar = [
{ text: 'Intro', link: '/intro' },
{ text: 'Install', link: '/install' },
{ text: 'Usage', link: '/usage' },
{ text: 'Config', link: '/config' },
],
},
{ text: 'Showcase', link: '/Showcase' },
Expand Down
112 changes: 112 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Configuration

`localtunnels` can be configured with the following options:

```ts
// tunnel.config.{ts,js}
import type { LocalTunnelOptions } from 'localtunnels'

const config: LocalTunnelOptions = {
/**
* The port to listen on for incoming HTTP requests.
* We default to 5173 to create a seamless Vite experience.
* @default 5173
* @type {number}
* @example
* port: 5173
*/
port: 5173,

/**
* The host to listen on for incoming HTTP requests.
* @default 'localhost'
* @type {string}
* @example
* host: 'localhost'
*/
host: 'localtunnel.sh',

/**
* The subdomain to use for the tunnel.
* @default null
* @type {string}
* @example
* subdomain: 'my-tunnel'
*/
subdomain: 'my-tunnel',

/**
* Whether to use HTTPS for the tunnel.
* @default false
* @type {boolean}
* @example
* secure: true
*/
secure: true,

/**
* The port to listen on for incoming HTTPS requests.
* @default 3443
* @type {number}
* @example
* localPort: 3443
*/
localPort: 3443,

/**
* The host to listen on for incoming HTTPS requests.
* @default 'localhost'
* @type {string}
* @example
* localHost: 'localhost'
*/
localHost: 'localhost',

/**
* The maximum number of tunnels to allow.
* @default 4
* @type {number}
* @example
* maxTunnels: 4
*/
maxTunnels: 4,

/**
* The maximum number of requests to allow per tunnel.
* @default 10
* @type {number}
* @example
* maxRequests: 10
*/
maxRequests: 10,


/**
* SSL private key, certificate, and CA certificate to use for the tunnel.
* @default null
* @type {object}
* @example
* ssl: {
* key: 'path/to/key.pem',
* cert: 'path/to/cert.pem',
* ca: 'path/to/ca.pem',
* }
*/
ssl: {
key: 'path/to/key.pem',
cert: 'path/to/cert.pem',
ca: 'path/to/ca.pem',
},

/**
* Whether to print debug information to the console.
* @default false
* @type {boolean}
* @example
* verbose: true
*/
verbose: true,
}

export default config
```
102 changes: 63 additions & 39 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,67 @@
# Install

## Bun & Node.js
Installing `localtunnels` is easy. Simply pull it in via your package manager of choice, or download the binary directly.

```bash
bun install -d localtunnels
npm install -g localtunnels
## Package Managers

# or, invoke immediately
bunx localtunnels
npx localtunnels
Choose your package manager of choice:

::: code-group

```sh [npm]
npm install --save-dev localtunnels
# npm i -d localtunnels

# or, install globally via
npm i -g localtunnels
```

_We are looking to publish this package npm under the name `localtunnels`. We are also hoping npm will release the name for us._
```sh [bun]
bun install --dev localtunnels
# bun add --dev localtunnels
# bun i -d localtunnels

## Binaries
# or, install globally via
bun add --global localtunnels
```

```sh [pnpm]
pnpm add --save-dev localtunnels
# pnpm i -d localtunnels

# or, install globally via
pnpm add --global localtunnels
```

```sh [yarn]
yarn add --dev localtunnels
# yarn i -d localtunnels

# or, install globally via
yarn global add localtunnels
```

```sh [brew]
brew install localtunnels # coming soon
```

```sh [pkgx]
pkgx localtunnels # coming soon
```

For now, you can download the `localtunnels` binaries from the [releases page](https://github.com/stacksjs/localtunnels/releases/tag/v0.1.1). Choose the binary that matches your platform and architecture:
:::

Read more about how to use it in the Usage section of the documentation.

## Binaries

## macOS (Darwin)
Choose the binary that matches your platform and architecture:

For M1/M2 Macs (arm64):
::: code-group

```bash
```sh [macOS (arm64)]
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.1.0/lpx-darwin-arm64 -o localtunnels
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.2.0/lpx-darwin-arm64 -o localtunnels

# Make it executable
chmod +x localtunnels
Expand All @@ -32,11 +70,9 @@ chmod +x localtunnels
mv localtunnels /usr/local/bin/localtunnels
```

For Intel Macs (amd64):

```bash
```sh [macOS (x64)]
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.1.0/lpx-darwin-x64 -o localtunnels
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.2.0/localtunnels-darwin-x64 -o localtunnels

# Make it executable
chmod +x localtunnels
Expand All @@ -45,13 +81,9 @@ chmod +x localtunnels
mv localtunnels /usr/local/bin/localtunnels
```

## Linux

For ARM64:

```bash
```sh [Linux (arm64)]
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.1.0/lpx-linux-arm64 -o localtunnels
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.2.0/localtunnels-linux-arm64 -o localtunnels

# Make it executable
chmod +x localtunnels
Expand All @@ -60,11 +92,9 @@ chmod +x localtunnels
mv localtunnels /usr/local/bin/localtunnels
```

For x64:

```bash
```sh [Linux (x64)]
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.1.0/lpx-linux-x64 -o localtunnels
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.2.0/localtunnels-linux-x64 -o localtunnels

# Make it executable
chmod +x localtunnels
Expand All @@ -73,20 +103,14 @@ chmod +x localtunnels
mv localtunnels /usr/local/bin/localtunnels
```

## Windows

For x64:

```bash
```sh [Windows (x64)]
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.1.0/lpx-windows-x64.exe -o localtunnels.exe
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.2.0/localtunnels-windows-x64.exe -o localtunnels.exe

# Move it to your PATH (adjust the path as needed)
move localtunnels.exe C:\Windows\System32\localtunnels.exe
```

<!-- _Alternatively, you can install:_
```bash
brew install localtunnels # wip
pkgx install localtunnels # wip
``` -->
::: tip
You can also find the `localtunnels` binaries in GitHub [releases](https://github.com/stacksjs/localtunnels/releases).
:::
6 changes: 0 additions & 6 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ For casual chit-chat with others using this package:

[Join the Stacks Discord Server](https://discord.gg/stacksjs)

## Postcardware

Two things are true: Stacks OSS will always stay open-source, and we do love to receive postcards from wherever Stacks is used! 🌍 _We also publish them on our website. And thank you, Spatie_

Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094

## Sponsors

We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
Expand Down
2 changes: 0 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,3 @@ localtunnels start --from localhost:5173 --subdomain test --verbose
localtunnels --help
localtunnels --version
```

To learn more, head over to the [documentation](https://localtunnels.sh/).
File renamed without changes.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
"files": ["README.md", "dist"],
"scripts": {
"build": "bun build.ts && bun run compile",
"compile": "bun build ./bin/cli.ts --compile --minify --outfile bin/lpx",
"compile": "bun build ./bin/cli.ts --compile --minify --outfile bin/localtunnels",
"compile:all": "bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64 && bun run compile:darwin-x64 && bun run compile:darwin-arm64",
"compile:linux-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/lpx-linux-x64",
"compile:linux-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/lpx-linux-arm64",
"compile:windows-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/lpx-windows-x64.exe",
"compile:darwin-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/lpx-darwin-x64",
"compile:darwin-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/lpx-darwin-arm64",
"compile:linux-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-x64 --outfile bin/localtunnels-linux-x64",
"compile:linux-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-linux-arm64 --outfile bin/localtunnels-linux-arm64",
"compile:windows-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-windows-x64 --outfile bin/localtunnels-windows-x64.exe",
"compile:darwin-x64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-x64 --outfile bin/localtunnels-darwin-x64",
"compile:darwin-arm64": "bun build ./bin/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile bin/localtunnels-darwin-arm64",
"lint": "bunx --bun eslint --flag unstable_ts_config .",
"lint:fix": "bunx --bun eslint --flag unstable_ts_config . --fix",
"fresh": "bunx rimraf node_modules/ bun.lock && bun i",
Expand Down

0 comments on commit 77b1297

Please sign in to comment.