Skip to content

Commit b0b52fc

Browse files
committed
chore: add stacksjs/docs and cursor rules
1 parent f140509 commit b0b52fc

File tree

12 files changed

+374
-142
lines changed

12 files changed

+374
-142
lines changed

.cursor/rules/code-style.mdc

Lines changed: 12 additions & 0 deletions
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

Lines changed: 9 additions & 0 deletions
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

Lines changed: 11 additions & 0 deletions
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

Lines changed: 11 additions & 0 deletions
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
Lines changed: 11 additions & 0 deletions
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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
description: General information based on the latest ./README.md content
3+
globs:
4+
---
5+
Update it if APIs change:
6+
7+
# vite-plugin-local
8+
9+
> A smart Vite plugin that enables pretty development URLs, including HTTPS.
10+
11+
## Features
12+
13+
- Proxies HTTP/HTTPS requests
14+
- Pretty development URLs
15+
- Smart HTTPS management
16+
- Automatically cleans URLs
17+
- Lightweight
18+
- _Soon: Local Tunneling & WebSocket Proxying_
19+
20+
## Install
21+
22+
```bash
23+
npm install -d vite-plugin-local
24+
# bun install -d vite-plugin-local
25+
```
26+
27+
## Get Started
28+
29+
```ts
30+
// vite.config.ts
31+
import { defineConfig } from 'vite'
32+
import Local from 'vite-plugin-local'
33+
34+
export default defineConfig({
35+
plugins: [
36+
Local({
37+
domain: 'my-app.local', // default: stacks.localhost
38+
https: true, // default: true, pass TlsConfig options for custom certificates
39+
cleanup: {
40+
certs: true, // default: false, cleans up the certificates created on server shutdown
41+
hosts: true, // default: true, cleans up /etc/hosts on server shutdown
42+
},
43+
cleanUrls: true, // default: false, cleans up URLs by not requiring the .html extension
44+
verbose: true, // default: false, enables detailed logging
45+
})
46+
]
47+
})
48+
```
49+
50+
To learn more, head over to the [documentation](mdc:https:/docs.stackjs.org).
Lines changed: 9 additions & 0 deletions
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

Lines changed: 10 additions & 0 deletions
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

Lines changed: 9 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ For casual chit-chat with others using this package:
7777

7878
## Postcardware
7979

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

8282
Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
8383

0 commit comments

Comments
 (0)