Skip to content

Commit

Permalink
docs: added install, usage and intro
Browse files Browse the repository at this point in the history
  • Loading branch information
cab-mikee committed Dec 20, 2024
1 parent 5b6fbd3 commit 30f980b
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 100 deletions.
9 changes: 5 additions & 4 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ const sidebar = [
items: [
{ text: 'Introduction', link: '/intro' },
{ text: 'Install', link: '/install' },
{ text: 'Usage', link: '/usage' },
],
},
]

export default withPwa(
defineConfig({
lang: 'en-US',
title: 'Local Tunnels',
description: 'A better developer environment.',
title: 'localtunnels',
description: 'A simple and smart tunneling alternative. Without or with self-hosting.',
lastUpdated: true,
cleanUrls: true,
metaChunk: true,
Expand All @@ -73,8 +74,8 @@ export default withPwa(
['meta', { name: 'theme-color', content: '#0A0ABC' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:locale', content: 'en' }],
['meta', { property: 'og:title', content: 'Local Tunnels | A better developer environment.' }],
['meta', { property: 'og:site_name', content: 'Local Tunnels' }],
['meta', { property: 'og:title', content: 'localtunnels | A simple and smart tunneling alternative. Without or with self-hosting.' }],
['meta', { property: 'og:site_name', content: 'localtunnels' }],
['meta', { property: 'og:image', content: './images/og-image.jpg' }],
['meta', { property: 'og:url', content: 'https://localtunnel.sh/' }],
// ['script', { 'src': 'https://cdn.usefathom.com/script.js', 'data-site': '', 'data-spa': 'auto', 'defer': '' }],
Expand Down
133 changes: 70 additions & 63 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,92 @@
# Markdown Extension Examples
# Install

This page demonstrates some of the built-in markdown extensions provided by VitePress.
## Bun & Node.js

## Syntax Highlighting
```bash
bun install -d localtunnels
npm install -g localtunnels

VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
# or, invoke immediately
bunx localtunnels
npx localtunnels
```

**Input**
_We are looking to publish this package npm under the name `localtunnels`. We are also hoping npm will release the name for us._

````md
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````

**Output**

```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
## Binaries

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:

## macOS (Darwin)

For M1/M2 Macs (arm64):

```bash
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.10.0/lpx-darwin-arm64 -o localtunnels

# Make it executable
chmod +x localtunnels

# Move it to your PATH
mv localtunnels /usr/local/bin/localtunnels
```

## Custom Containers
For Intel Macs (amd64):

```bash
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.10.0/lpx-darwin-x64 -o localtunnels

**Input**
# Make it executable
chmod +x localtunnels

# Move it to your PATH
mv localtunnels /usr/local/bin/localtunnels
```

```md
::: info
This is an info box.
:::
## Linux

::: tip
This is a tip.
:::
For ARM64:

::: warning
This is a warning.
:::
```bash
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.10.0/lpx-linux-arm64 -o localtunnels

::: danger
This is a dangerous warning.
:::
# Make it executable
chmod +x localtunnels

::: details
This is a details block.
:::
# Move it to your PATH
mv localtunnels /usr/local/bin/localtunnels
```

**Output**
For x64:

::: info
This is an info box.
:::
```bash
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.10.0/lpx-linux-x64 -o localtunnels

::: tip
This is a tip.
:::
# Make it executable
chmod +x localtunnels

::: warning
This is a warning.
:::
# Move it to your PATH
mv localtunnels /usr/local/bin/localtunnels
```

## Windows

::: danger
This is a dangerous warning.
:::
For x64:

::: details
This is a details block.
:::
```bash
# Download the binary
curl -L https://github.com/stacksjs/localtunnels/releases/download/v0.10.0/lpx-windows-x64.exe -o localtunnels.exe

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

Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).
<!-- _Alternatively, you can install:_
```bash
brew install localtunnels # wip
pkgx install localtunnels # wip
``` -->
72 changes: 39 additions & 33 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,60 @@
---
outline: deep
---

<p align="center"><img src="https://github.com/stacksjs/localtunnels/blob/main/.github/art/cover.jpg?raw=true" alt="Social Card of this repo"></p>

# Runtime API Examples
# A Better Developer Experience

> A zero-config local tunnel that's simple, lightweight, and secure.
## Features

- Simple, lightweight local tunnel
- Security built-in, including HTTPS
- IAC, self-hostable _(via AWS)_
- Custom subdomains
- CLI & Library

## Changelog

Please see our [releases](https://github.com/stacksjs/localtunnels/releases) page for more information on what has changed recently.

## Contributing

This page demonstrates usage of some of the runtime APIs provided by VitePress.
Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.

The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
## Community

```md
<script setup>
import { useData } from 'vitepress'
For help, discussion about best practices, or any other conversation that would benefit from being searchable:

const { theme, page, frontmatter } = useData()
</script>
[Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)

## Results
For casual chit-chat with others using this package:

### Theme Data
<pre>{{ theme }}</pre>
[Join the Stacks Discord Server](https://discord.gg/stacksjs)

### Page Data
<pre>{{ page }}</pre>
## Postcardware

### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```
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_

<script setup>
import { useData } from 'vitepress'
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094

const { site, theme, page, frontmatter } = useData()
</script>
## Sponsors

## Results
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.

### Theme Data
- [JetBrains](https://www.jetbrains.com/)
- [The Solana Foundation](https://solana.com/)

<pre>{{ theme }}</pre>
## Credits

### Page Data
- [Chris Breuer](https://github.com/chrisbbreuer)
- [All Contributors](../../contributors)

<pre>{{ page }}</pre>
## License

### Page Frontmatter
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.

<pre>{{ frontmatter }}</pre>
Made with 💙

## More
<!-- Badges -->

Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
<!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/localtunnels/main?style=flat-square
[codecov-href]: https://codecov.io/gh/stacksjs/localtunnels -->
53 changes: 53 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Usage

There are two ways of using this local tunnel: _as a library or as a CLI._

## Library

Given the npm package is installed:

```ts
import type { LocalTunnelConfig } from 'localtunnels'
import { startLocalTunnel } from 'localtunnels'

const config: LocalTunnelConfig = {
from: 'localhost:5173',
domain: 'stacksjs.dev', // optional, defaults to the stacksjs.dev domain
subdomain: 'test', // optional, uses a random subdomain by default
verbose: true, // optional, defaults to false
}

startLocalTunnel(config)
```

You may als use a configuration file:

```ts
// tunnel.config.{ts,js}
import type { LocalTunnelConfig } from '@stacksjs/localtunnels'

const config: LocalTunnelConfig = {
from: 'localhost:5173',
domain: 'stacksjs.dev', // optional, defaults to the stacksjs.dev domain
subdomain: 'test', // optional, uses a random subdomain by default
verbose: true, // optional, defaults to false
}

export default config
```

_Then run:_

```bash
./localtunnels start
```

## CLI

```bash
localtunnels start --from localhost:5173 --subdomain test --verbose
localtunnels --help
localtunnels --version
```

To learn more, head over to the [documentation](https://localtunnels.sh/).

0 comments on commit 30f980b

Please sign in to comment.