Skip to content

Commit dfebd38

Browse files
committed
chore: add stacksjs/docs and cursor rules
1 parent a285f99 commit dfebd38

12 files changed

+317
-51
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

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
description: General information based on the latest ./README.md content
3+
globs:
4+
---
5+
Update it if APIs change:
6+
7+
# vidx
8+
9+
> A better save for web developers.
10+
11+
## Features
12+
13+
- Image Optimizations & Manipulations
14+
- Web Optimized by default
15+
- Simple, lightweight
16+
- CLI and Library Support
17+
18+
## Install
19+
20+
```bash
21+
bun install -d @stacksjs/vidx
22+
```
23+
24+
<!-- _Alternatively, you can install:_
25+
26+
```bash
27+
brew install vidx # wip
28+
pkgx install vidx # wip
29+
``` -->
30+
31+
## Get Started
32+
33+
There are two ways of using this tool: _as a library or as a CLI._
34+
35+
### Library
36+
37+
Given the npm package is installed:
38+
39+
```ts
40+
// wip
41+
```
42+
43+
### CLI
44+
45+
```bash
46+
vidx wip
47+
vidx --help
48+
vidx --version
49+
```
50+
51+
## Configuration
52+
53+
The Reverse Proxy can be configured using a `vidx.config.ts` _(or `vidx.config.js`)_ file and it will be automatically loaded when running the `reverse-proxy` command.
54+
55+
```ts
56+
// vidx.config.{ts,js}
57+
import type { vidxOptions } from '@stacksjs/vidx'
58+
59+
const config: vidxOptions = {
60+
verbose: true,
61+
}
62+
63+
export default config
64+
```
65+
66+
_Then run:_
67+
68+
```bash
69+
./vidx start
70+
```
71+
72+
To learn more, head over to the [documentation](https://reverse-proxy.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

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ For casual chit-chat with others using this package:
9999

100100
## Postcardware
101101

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

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

106106
## Sponsors
107107

0 commit comments

Comments
 (0)