Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check

on:
pull_request:
branches:
- master
workflow_call:

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v6
with:
node-version: "22.x"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Build
run: npm run build
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
push:
branches:
- master

permissions:
contents: write
id-token: write

jobs:
check:
uses: ./.github/workflows/check.yml

release:
needs: check
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v6
with:
node-version: "24.x"
registry-url: "https://registry.npmjs.org"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Bump version
uses: phips28/gh-action-bump-version@v11.0.7
with:
tag-prefix: ""

- name: Publish to NPM
run: npm publish --access public --provenance
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
node_modules
dist
node_modules
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run format
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,35 @@ Easily access a localhost website from your mobile device.
npx localview --port 8080
```

The `--port` argument should match the port exposed by the server.

3. To visit the exposed URL, scan the QR code with your mobile device.

![Screenshot](./static/screenshot.png)
![Demo](./static/demo.gif)

## Options

| Flag | Description |
| -------------- | ------------------------------------------------------------- |
| `--port`, `-P` | Port exposed by the local server. **Required.** |
| `--path` | Path appended to the URL (e.g. `/admin`). Optional. |
| `--host` | Override the auto-detected LAN IP (Docker, multi-NIC, demos). |

### Examples

```bash
# Deep-link to a specific route:
npx localview --port 3000 --path /admin

# Pin the LAN IP yourself instead of auto-detecting:
npx localview --port 8080 --host 192.168.1.42
```

If multiple non-internal IPv4 interfaces are detected (e.g. wifi + VPN + Docker bridges), localview prints a numbered list and asks which one to use; press Enter to accept the smart default.

## Notes

- Requires Node.js `^20.19.0`, `^22.12.0`, or `>=23`.
- Both the server and the mobile device need to be connected to the same network.
- You may need to set you server's host to `0.0.0.0`.
- You may need to set your server's host to `0.0.0.0`.

## License

Expand Down
34 changes: 0 additions & 34 deletions bin/cli.js

This file was deleted.

Loading