Skip to content

Commit e6a75ac

Browse files
committed
chore: add stacksjs/docs and cursor rules
1 parent 05541a6 commit e6a75ac

12 files changed

+548
-468
lines changed

.cursor/rules/code-style.mdc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
description: Code Style & Structure specifics
3+
globs:
4+
---
5+
## Code Style & Structure
6+
7+
- Write concise, technical TypeScript code with accurate examples in the docblock
8+
- If Bun native modules are available, use them
9+
- Use functional and declarative programming patterns; avoid classes unless needed
10+
- Prefer iteration and modularization over code duplication
11+
- Use descriptive variable names with auxiliary verbs (e.g., `isLoading`, `hasError`)
12+
- Use proper jsdoc comments for functions, types, interfaces, and ensure examples are accurate

.cursor/rules/documentation.mdc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: Documentation specific rules
3+
globs: docs/**/*.md
4+
---
5+
## Documentation
6+
7+
- Write documentation for all functions, types, interfaces, and ensure examples are accurate
8+
- The `./docs` directory is where the vitepress markdown documentation is stored
9+
- Make sure to update the docs markdown files

.cursor/rules/error-handling.mdc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: Error Handling and Validation specifics
3+
globs:
4+
---
5+
## Error Handling and Validation
6+
7+
- Prioritize error handling: handle errors and edge cases early
8+
- Use early returns and guard clauses
9+
- Implement proper error logging and user-friendly messages
10+
- Use error boundaries for unexpected errors
11+
- when `neverthrow` is available, ensure errors are typed

.cursor/rules/key-conventions.mdc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: Key code conventions
3+
globs:
4+
---
5+
## Key Conventions
6+
7+
- If there are two equally valid implementations, the browser version should be preferred
8+
- Aim for 100% test coverage
9+
- Avoid usage of `any`
10+
- Reuse eslint-ignore comments where present, unless not needed
11+
- ensure we log everything properly, including for debug reasons

.cursor/rules/project-structure.mdc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: Project structure information
3+
globs:
4+
---
5+
## Project Structure
6+
7+
- the `./src` directory is the source code
8+
- the `./test` directory is the test code
9+
- the `./bin` directory is the command-line code
10+
- you can also call the CLI via `./clarity ...`
11+
- the `./docs` directory is the documentation

.cursor/rules/readme.mdc

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
description: General information based on the latest ./README.md content
3+
globs:
4+
---
5+
Update it if APIs change:
6+
7+
8+
# localtunnels
9+
10+
> A zero-config local tunnel that's simple, lightweight, and secure.
11+
12+
## Features
13+
14+
- Simple, lightweight local tunnel
15+
- Security built-in, including HTTPS
16+
- IAC, self-hostable _(via AWS)_
17+
- Custom subdomains
18+
- CLI & Library
19+
20+
## Install
21+
22+
```sh
23+
bun install -d localtunnels
24+
```
25+
26+
<!-- _Alternatively, you can install:_
27+
28+
```sh
29+
brew install localtunnels # wip
30+
pkgx install localtunnels # wip
31+
``` -->
32+
33+
## Get Started
34+
35+
There are two ways of using this local tunnel: _as a library or as a CLI._
36+
37+
### Library
38+
39+
Given the npm package is installed:
40+
41+
```ts
42+
import type { LocalTunnelConfig } from 'localtunnels'
43+
import { startLocalTunnel } from 'localtunnels'
44+
45+
const config: LocalTunnelConfig = {
46+
from: 'localhost:5173',
47+
domain: 'stacksjs.dev', // optional, defaults to the stacksjs.dev domain
48+
subdomain: 'test', // optional, uses a random subdomain by default
49+
verbose: true, // optional, defaults to false
50+
}
51+
52+
startLocalTunnel(config)
53+
```
54+
55+
You may als use a configuration file:
56+
57+
```ts
58+
// tunnel.config.{ts,js}
59+
import type { LocalTunnelConfig } from '@stacksjs/localtunnels'
60+
61+
const config: LocalTunnelConfig = {
62+
from: 'localhost:5173',
63+
domain: 'stacksjs.dev', // optional, defaults to the stacksjs.dev domain
64+
subdomain: 'test', // optional, uses a random subdomain by default
65+
verbose: true, // optional, defaults to false
66+
}
67+
68+
export default config
69+
```
70+
71+
_Then run:_
72+
73+
```sh
74+
./localtunnels start
75+
```
76+
77+
### CLI
78+
79+
```sh
80+
localtunnels start --from localhost:5173 --subdomain test --verbose
81+
localtunnels --help
82+
localtunnels --version
83+
```
84+
85+
To learn more, head over to the [documentation](https://localtunnels.sh/).

.cursor/rules/syntax-formatting.mdc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: Syntax and Formatting specifics
3+
globs:
4+
---
5+
## Syntax and Formatting
6+
7+
- Use the "function" keyword for pure functions
8+
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
9+
- Make sure everything is properly commented

.cursor/rules/testing.mdc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
description: Testing specifics
3+
globs:
4+
---
5+
## Testing
6+
7+
- Write tests for all functions, types, interfaces, and ensure examples are accurate
8+
- The `./test` directory is where the tests are stored
9+
- Use `bun test` to run the tests
10+
- Use bun native modules for testing from `import { x, y, z } from 'bun:test'`

.cursor/rules/typescript.mdc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: TypeScript Usage specifics
3+
globs: docs/**/*.md
4+
---
5+
## TypeScript Usage
6+
7+
- Use TypeScript for all code; prefer interfaces over types
8+
- Avoid enums; use `maps` instead, or `as const`
9+
- Use functional components with TypeScript interfaces

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
77
<!-- [![Codecov][codecov-src]][codecov-href] -->
88

9-
# A Better Developer Experience
9+
# localtunnels
1010

1111
> A zero-config local tunnel that's simple, lightweight, and secure.
1212
@@ -111,9 +111,9 @@ For casual chit-chat with others using this package:
111111

112112
## Postcardware
113113

114-
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_
114+
“Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where `localtunnels` is being used! We showcase them on our website too.
115115

116-
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094
116+
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
117117

118118
## Sponsors
119119

0 commit comments

Comments
 (0)