|
| 1 | +# Project: Gitfolio |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This repo is both: |
| 6 | +- A **Vite + React + TS** template for a GitHub profile site. |
| 7 | +- An **npm CLI package** named `gitforge` that generates static data from the GitHub API. |
| 8 | + |
| 9 | +## Branch Architecture |
| 10 | + |
| 11 | +Two-branch setup: |
| 12 | + |
| 13 | +| Branch | Purpose | |
| 14 | +|--------|---------| |
| 15 | +| `main` | Development — code only. `data/*.json` files are always empty `[]`. | |
| 16 | +| `web` | Deployment — code + personal data. `data/` files hold real content. | |
| 17 | + |
| 18 | +- `validate-main.yml` enforces that `data/*.json` stay empty on `main`. |
| 19 | +- When a user forks the repo they get `main` with empty data, then create their own `web` branch for personal data. |
| 20 | +- `sync-to-web.yml` merges code from `main` → `web` on every push, but always restores `web`'s `data/` and `gitforge.config.json` so personal data is never overwritten. |
| 21 | +- `deploy.yml` always checks out the `web` branch (explicit `ref: web`) for all trigger types (push, schedule, workflow_dispatch). |
| 22 | +- Because `GITHUB_TOKEN` pushes don't trigger other workflows, `sync-to-web.yml` explicitly dispatches `deploy.yml` via the GitHub API after pushing to `web`. |
| 23 | + |
| 24 | +## CLI & Config |
| 25 | + |
| 26 | +- Config source of truth: `gitforge.config.json` (git-ignored). Only `gitforge.config.example.json` is tracked. |
| 27 | +- Generator script: `scripts/generate-github-data.js`, exposed as the `gitforge` binary via `package.json`. |
| 28 | +- Usage: `gitforge [owner] [--type user|org]` — or reads `gitforge.config.json` when no CLI args given. |
| 29 | + |
| 30 | +## Generated Files |
| 31 | + |
| 32 | +Do not hand-edit or rely on these for long-term docs — they are regenerated: |
| 33 | +- `src/generated/githubData.ts` |
| 34 | +- `src/siteContent.json` |
| 35 | + |
| 36 | +When editing site content, work against `src/siteContent.json` (keeping in mind it gets regenerated). |
| 37 | + |
| 38 | +## App Constraints |
| 39 | + |
| 40 | +- Functional React components, TypeScript, Tailwind CSS. |
| 41 | +- Single-page app (React Router for internal nav), clean/dark/minimal/developer-focused. |
| 42 | +- Deterministic and static — no runtime GitHub API calls from the browser. |
| 43 | + |
| 44 | +## Tech Stack |
| 45 | + |
| 46 | +- React + Vite + TypeScript |
| 47 | +- Tailwind CSS |
| 48 | +- pnpm |
| 49 | +- Rich text editor: `luxe-edit` (v0.2.0) |
| 50 | + - Save content as JSON via `getEditorJSON(editorState)` in `onChange` |
| 51 | + - Render saved JSON as HTML via `getDOMFromJSON(savedJson)` |
| 52 | + |
| 53 | +## Key Files |
| 54 | + |
| 55 | +- `scripts/generate-github-data.js` — CLI / data generator |
| 56 | +- `gitforge.config.example.json` — tracked config template |
| 57 | +- `src/generated/githubData.ts` — generated GitHub data (do not hand-edit) |
| 58 | +- `src/siteContent.json` — generated site content (do not hand-edit) |
| 59 | +- `src/admin/pages/AdminBlogsPage.tsx` — blog editor (uses LuxeEditor) |
| 60 | +- `src/pages/BlogPage.tsx` — blog display (renders JSON via `getDOMFromJSON`) |
| 61 | +- `src/types/contentTypes.ts` — shared content types (`Blog`, `Project`, `Post`, `Video`) |
| 62 | +- `.github/workflows/` — CI/CD workflows |
0 commit comments