|
| 1 | +# Contributing |
| 2 | + |
| 3 | +## Quick Start |
| 4 | + |
| 5 | +```bash |
| 6 | +bun install |
| 7 | +bun run dev # Start dev server with hot reload |
| 8 | +bun test # Run tests |
| 9 | +``` |
| 10 | + |
| 11 | +**Runtime Management (Optional):** |
| 12 | +This project uses [Mise](https://mise.jdx.dev/) to pin the Bun version. If you have Mise installed, it will automatically use the correct Bun version from `mise.toml`. Otherwise, just install Bun directly. |
| 13 | + |
| 14 | +## Project Structure |
| 15 | + |
| 16 | +- `src/` - Build scripts and core logic |
| 17 | +- `posts/` - Blog post markdown files |
| 18 | +- `templates/` - HTML templates for rendering |
| 19 | +- `static/` - CSS and static assets |
| 20 | +- `tests/` - Test fixtures |
| 21 | +- `dist/` - Generated static site (gitignored) |
| 22 | +- `public/` - Files copied to dist root without hashing (CNAME, favicons) |
| 23 | + |
| 24 | +Tests live next to source files as `*.test.ts`. |
| 25 | + |
| 26 | +**Content editing:** Posts and pages are edited in Obsidian with the [Linter plugin](https://github.com/platers/obsidian-linter) for consistent markdown formatting. Config is in `.obsidian/` (gitignored). |
| 27 | + |
| 28 | +## Code Quality Standards |
| 29 | + |
| 30 | +Before committing, run: |
| 31 | + |
| 32 | +```bash |
| 33 | +bun run check # Run all checks (typecheck + lint + test) |
| 34 | +``` |
| 35 | + |
| 36 | +Individual commands: |
| 37 | +```bash |
| 38 | +bun run typecheck # Type checking only |
| 39 | +bun run lint # Linting only |
| 40 | +bun run lint:fix # Auto-fix linting issues (--write) |
| 41 | +bun test # Tests only |
| 42 | +``` |
| 43 | + |
| 44 | +For unsafe fixes (use with caution): |
| 45 | +```bash |
| 46 | +biome check . --write --unsafe |
| 47 | +``` |
| 48 | + |
| 49 | +Requirements: |
| 50 | +- All warnings must be fixed (not just errors) |
| 51 | +- Tests required for new features |
| 52 | +- Formatting: tabs for code, 2 spaces for JSON |
| 53 | + |
| 54 | +## Coding Standards |
| 55 | + |
| 56 | +- **DRY:** Don't repeat yourself. Extract common logic into reusable functions |
| 57 | +- **Important code first:** Put the most important logic at the top of files |
| 58 | +- **Use `type` over `interface`:** Prefer `type` for type definitions |
| 59 | +- **Never use `any`:** Always provide proper types. Use `unknown` if type is truly unknown |
| 60 | +- **Use JSDoc for documentation:** Add JSDoc comments to document functions and complex logic. Omit type annotations (TypeScript handles that) |
| 61 | + |
| 62 | +## Testing |
| 63 | + |
| 64 | +- Tests use Bun's built-in test runner |
| 65 | +- Tests are colocated with source files |
| 66 | + |
| 67 | +## Architecture Decisions |
| 68 | + |
| 69 | +**Simple template replacement:** Uses string replacement instead of a templating framework. Fast, predictable, no dependencies. |
| 70 | + |
| 71 | +**Draft filtering:** Posts with `draft: true` in frontmatter are filtered out during build. |
| 72 | + |
| 73 | +## Common Tasks |
| 74 | + |
| 75 | +**Add a new post:** |
| 76 | +```bash |
| 77 | +# Create posts/YYYY-MM-DD-slug.md with frontmatter |
| 78 | +# Set draft: false to publish |
| 79 | +bun run build |
| 80 | +``` |
| 81 | + |
| 82 | +**Modify templates:** |
| 83 | +- Edit files in `templates/` |
| 84 | +- Templates use `{{VARIABLE}}` placeholders |
| 85 | +- Dev server auto-rebuilds on changes |
| 86 | + |
| 87 | +**Add a new build step:** |
| 88 | +- Edit `src/build.ts` |
| 89 | +- Export functions for testability |
| 90 | +- Add tests in `src/build.test.ts` |
| 91 | + |
| 92 | +## What NOT to Do |
| 93 | + |
| 94 | +- Don't over-engineer |
| 95 | +- Don't add frameworks |
| 96 | +- Don't skip warnings |
| 97 | +- Don't commit without running checks |
| 98 | + |
| 99 | +## Philosophy |
| 100 | + |
| 101 | +Pain-driven development. Keep it simple. Fast builds over features. |
0 commit comments