Skip to content

Commit b92b18a

Browse files
authored
more (#13)
- trim CLAUDE.md - Add some more text to README - Add github repo link in header Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent 0321a0f commit b92b18a

4 files changed

Lines changed: 59 additions & 117 deletions

File tree

CLAUDE.md

Lines changed: 3 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Vortex RFC Site
22

3-
Static site generator for Vortex RFC proposals.
3+
Static site generator for Vortex RFC proposals built with Bun.
44

55
## Project Structure
66

77
```
88
index.ts - Main build script and dev server
9-
styles.css - Site styling (light/dark themes, monospace aesthetic)
9+
styles.css - Site styling (light/dark themes)
1010
proposals/ - RFC markdown files (format: NNNN-slug.md)
1111
dist/ - Build output (gitignored)
1212
```
@@ -33,125 +33,15 @@ bun run clean # Remove dist/
3333
- Uses `Bun.serve()` to serve static files from `dist/`
3434
- Watches `proposals/` and `styles.css` for changes
3535
- SSE endpoint at `/__reload` for live reload
36-
- Live reload script only injected in dev mode
3736

3837
## Styling
3938

4039
- CSS custom properties for theming (`--bg`, `--fg`, `--link`, etc.)
4140
- System preference detection via `prefers-color-scheme`
42-
- Three-state toggle: auto → dark light → auto
41+
- Two-state toggle: dark light
4342
- Theme persisted to localStorage
4443

4544
## Adding Features
4645

4746
- Keep dependencies minimal (only `@types/bun` currently)
4847
- Use Bun built-ins: `Bun.file`, `Bun.Glob`, `Bun.markdown`, `Bun.serve`
49-
- Maintain the retro monospace aesthetic
50-
51-
---
52-
53-
Default to using Bun instead of Node.js.
54-
55-
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
56-
- Use `bun test` instead of `jest` or `vitest`
57-
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
58-
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
59-
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
60-
- Use `bunx <package> <command>` instead of `npx <package> <command>`
61-
- Bun automatically loads .env, so don't use dotenv.
62-
63-
## APIs
64-
65-
- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
66-
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
67-
- `Bun.redis` for Redis. Don't use `ioredis`.
68-
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
69-
- `WebSocket` is built-in. Don't use `ws`.
70-
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
71-
- Bun.$`ls` instead of execa.
72-
73-
## Testing
74-
75-
Use `bun test` to run tests.
76-
77-
```ts#index.test.ts
78-
import { test, expect } from "bun:test";
79-
80-
test("hello world", () => {
81-
expect(1).toBe(1);
82-
});
83-
```
84-
85-
## Frontend
86-
87-
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
88-
89-
Server:
90-
91-
```ts#index.ts
92-
import index from "./index.html"
93-
94-
Bun.serve({
95-
routes: {
96-
"/": index,
97-
"/api/users/:id": {
98-
GET: (req) => {
99-
return new Response(JSON.stringify({ id: req.params.id }));
100-
},
101-
},
102-
},
103-
// optional websocket support
104-
websocket: {
105-
open: (ws) => {
106-
ws.send("Hello, world!");
107-
},
108-
message: (ws, message) => {
109-
ws.send(message);
110-
},
111-
close: (ws) => {
112-
// handle close
113-
}
114-
},
115-
development: {
116-
hmr: true,
117-
console: true,
118-
}
119-
})
120-
```
121-
122-
HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
123-
124-
```html#index.html
125-
<html>
126-
<body>
127-
<h1>Hello, world!</h1>
128-
<script type="module" src="./frontend.tsx"></script>
129-
</body>
130-
</html>
131-
```
132-
133-
With the following `frontend.tsx`:
134-
135-
```tsx#frontend.tsx
136-
import React from "react";
137-
import { createRoot } from "react-dom/client";
138-
139-
// import .css files directly and it works
140-
import './index.css';
141-
142-
const root = createRoot(document.body);
143-
144-
export default function Frontend() {
145-
return <h1>Hello, world!</h1>;
146-
}
147-
148-
root.render(<Frontend />);
149-
```
150-
151-
Then, run index.ts
152-
153-
```sh
154-
bun --hot ./index.ts
155-
```
156-
157-
For more information, read the Bun API docs in `node_modules/bun-types/docs/**.mdx`.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
This repo is used to store and discuss design decisions, features and significant changes in Vortex, either in specific APIs, 3rd-party integrations or the conceptual model.
44

5+
## What needs an RFC?
6+
7+
Vortex is a rapidly changing open source project that provides a file format, a compute toolkit, and a set of Rust libraries implementing a range of state-of-the-art compression codecs.
8+
9+
Most development decisions in Vortex happen through the Discussions functionality. Simply open a new discussion describing the kind of change you'd like to make to the project, and if the maintainers like it, open a PR.
10+
11+
This is a great process for bug fixes, simple features and purely additive changes.
12+
13+
However, if you are making a significant change to the way Vortex functions, you may need to write an RFC first. Some example changes that would require an RFC:
14+
15+
* Making a risky change to the format, such as adding new required fields to file metadata
16+
* Rearchitecting core components of Vortex, or wide-ranging refactors that might break language bindings
17+
* Creating new libraries or SDKs that we expect others to adopt
18+
* Making changes to subsystems that are likely to affect performance if not done thoughfully, such as the core IO traits
19+
520
## Process
621

722
The general process is that changes should be opened as PRs, with the discussion happening in comments on top of it.

index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const ICON_MOON = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18
4242

4343
const ICON_EXTERNAL = `<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 7h10v10"/><path d="M7 17 17 7"/></svg>`;
4444

45+
const ICON_GITHUB = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>`;
46+
4547
const TOGGLE_SCRIPT = `
4648
function toggleTheme() {
4749
const root = document.documentElement;
@@ -72,8 +74,9 @@ const LIVE_RELOAD_SCRIPT = `
7274
})();
7375
`;
7476

75-
function baseHTML(title: string, content: string, cssPath: string = "styles.css", liveReload: boolean = false): string {
77+
function baseHTML(title: string, content: string, cssPath: string = "styles.css", liveReload: boolean = false, repoUrl: string | null = null): string {
7678
const basePath = cssPath === "styles.css" ? "./" : "../";
79+
const githubLink = repoUrl ? `<a href="${repoUrl}" class="github-link" aria-label="View on GitHub" target="_blank" rel="noopener">${ICON_GITHUB}</a>` : "";
7780
return `<!DOCTYPE html>
7881
<html lang="en">
7982
<head>
@@ -91,7 +94,10 @@ function baseHTML(title: string, content: string, cssPath: string = "styles.css"
9194
<img src="${basePath}vortex_logo.svg" alt="Vortex" class="header-logo">
9295
<h1>Vortex RFCs</h1>
9396
</a>
94-
<button class="theme-toggle" onclick="toggleTheme()" aria-label="Toggle theme"></button>
97+
<div class="header-actions">
98+
${githubLink}
99+
<button class="theme-toggle" onclick="toggleTheme()" aria-label="Toggle theme"></button>
100+
</div>
95101
</header>
96102
<main>
97103
${content}
@@ -147,7 +153,7 @@ function indexPage(rfcs: RFC[], repoUrl: string | null, liveReload: boolean = fa
147153
${list}
148154
</ul>`;
149155

150-
return baseHTML("Vortex RFCs", content, "styles.css", liveReload);
156+
return baseHTML("Vortex RFCs", content, "styles.css", liveReload, repoUrl);
151157
}
152158

153159
function formatDate(date: Date): string {
@@ -212,7 +218,7 @@ function rfcPage(rfc: RFC, repoUrl: string | null, liveReload: boolean = false):
212218
${rfc.html}
213219
</article>`;
214220

215-
return baseHTML(`RFC ${rfc.number} - ${rfc.title}`, content, "../styles.css", liveReload);
221+
return baseHTML(`RFC ${rfc.number} - ${rfc.title}`, content, "../styles.css", liveReload, repoUrl);
216222
}
217223

218224
function parseRFCNumber(filename: string): string {

styles.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,37 @@ header h1 a:hover {
116116
color: var(--link);
117117
}
118118

119+
.header-actions {
120+
display: flex;
121+
align-items: center;
122+
gap: 0.5rem;
123+
}
124+
125+
.github-link {
126+
display: flex;
127+
align-items: center;
128+
justify-content: center;
129+
width: 36px;
130+
height: 36px;
131+
border-radius: 50%;
132+
color: var(--fg-muted);
133+
transition: color 0.15s ease, box-shadow 0.15s ease;
134+
}
135+
136+
.github-link:hover {
137+
color: var(--fg);
138+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
139+
text-decoration: none;
140+
}
141+
142+
:root[data-theme="dark"] .github-link:hover {
143+
box-shadow: 0 2px 12px rgba(255, 255, 255, 0.1);
144+
}
145+
146+
.github-link svg {
147+
display: block;
148+
}
149+
119150
.theme-toggle {
120151
display: flex;
121152
align-items: center;

0 commit comments

Comments
 (0)