|
1 | 1 | # cederache.github.io |
2 | 2 |
|
3 | | -This is a personal website generated with [gitfolio](https://github.com/imfunniee/gitfolio) |
| 3 | +Personal site hosted on [GitHub Pages](https://pages.github.com/). It shows a hero section, a live list of public repositories from the GitHub API, and an about/contact area. |
4 | 4 |
|
5 | | -The Github repositories are automatically refreshed. |
| 5 | +## Stack |
6 | 6 |
|
7 | | -To serve website, run `npm run serve` |
| 7 | +- [Vite](https://vitejs.dev/) + [React](https://react.dev/) 18 + [TypeScript](https://www.typescriptlang.org/) |
| 8 | +- [Tailwind CSS](https://tailwindcss.com/) and [shadcn/ui](https://ui.shadcn.com/) (Radix primitives) |
| 9 | +- [TanStack Query](https://tanstack.com/query) for GitHub API data |
| 10 | +- [React Router](https://reactrouter.com/) for routing |
| 11 | +- [Vitest](https://vitest.dev/) and [Testing Library](https://testing-library.com/react) for unit tests |
| 12 | + |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +- Node.js (LTS recommended) |
| 16 | +- [pnpm](https://pnpm.io/) — the repo pins a `packageManager` version in `package.json` |
| 17 | + |
| 18 | +## Setup |
| 19 | + |
| 20 | +```bash |
| 21 | +pnpm install |
| 22 | +``` |
| 23 | + |
| 24 | +## Development |
| 25 | + |
| 26 | +```bash |
| 27 | +pnpm dev |
| 28 | +``` |
| 29 | + |
| 30 | +The dev server listens on port **8080** (see `vite.config.ts`). |
| 31 | + |
| 32 | +## Build |
| 33 | + |
| 34 | +```bash |
| 35 | +pnpm build |
| 36 | +``` |
| 37 | + |
| 38 | +Output goes to `dist/`. Preview the production build with `pnpm preview`. |
| 39 | + |
| 40 | +## Deploy to GitHub Pages ([gh-pages](https://www.npmjs.com/package/gh-pages)) |
| 41 | + |
| 42 | +This mirrors the flow from [gitname/react-gh-pages](https://github.com/gitname/react-gh-pages), adapted for **Vite** (build output is `dist/`, not `build/`) and a **user site** repo (`username.github.io`), where `homepage` is `https://cederache.github.io` with no repository path segment. |
| 43 | + |
| 44 | +1. **One-time:** In the GitHub repo → **Settings** → **Pages** → **Build and deployment**: source **Deploy from a branch**, branch **`gh-pages`** folder **`/ (root)`**, then Save. |
| 45 | +2. Ensure your local `origin` remote points at this repository (same as the tutorial’s step 6). |
| 46 | +3. From the project root: |
| 47 | + |
| 48 | +```bash |
| 49 | +pnpm run deploy |
| 50 | +``` |
| 51 | + |
| 52 | +(`pnpm deploy` is a different pnpm command; use `run deploy` for this script.) |
| 53 | + |
| 54 | +That runs `predeploy` (production build) then pushes the contents of `dist/` to the `gh-pages` branch. Optional custom commit message: |
| 55 | + |
| 56 | +```bash |
| 57 | +pnpm run deploy -- -m "Deploy site" |
| 58 | +``` |
| 59 | + |
| 60 | +Keep deploying **source** on your default branch (`git push`) separately from `pnpm run deploy`, which only updates the **`gh-pages`** branch with the built site. |
| 61 | + |
| 62 | +## Environment variables |
| 63 | + |
| 64 | +| Variable | Required | Purpose | |
| 65 | +|----------|----------|---------| |
| 66 | +| `VITE_GITHUB_TOKEN` | No | GitHub personal access token (classic fine-grained with `public_repo` or read-only repo scope). Without it, the app uses unauthenticated API calls, which have a lower rate limit. | |
| 67 | + |
| 68 | +Create a `.env` or `.env.local` in the project root (do not commit secrets): |
| 69 | + |
| 70 | +```bash |
| 71 | +VITE_GITHUB_TOKEN=ghp_... |
| 72 | +``` |
| 73 | + |
| 74 | +## Scripts |
| 75 | + |
| 76 | +| Command | Description | |
| 77 | +|---------|-------------| |
| 78 | +| `pnpm dev` | Start Vite dev server | |
| 79 | +| `pnpm build` | Production build | |
| 80 | +| `pnpm build:dev` | Build in development mode | |
| 81 | +| `pnpm preview` | Serve `dist/` locally | |
| 82 | +| `pnpm lint` | Run ESLint | |
| 83 | +| `pnpm test` | Run Vitest once | |
| 84 | +| `pnpm test:watch` | Vitest watch mode | |
| 85 | +| `pnpm run deploy` | Build and publish `dist/` to the `gh-pages` branch | |
| 86 | + |
| 87 | +## Project layout |
| 88 | + |
| 89 | +- `src/` — application code (`pages/`, `components/`, `hooks/`, etc.) |
| 90 | +- `public/` — static assets served as-is |
| 91 | +- `index.html` — Vite entry HTML |
| 92 | + |
| 93 | +Repository data is fetched for the GitHub user `cederache`; adjust `GITHUB_USERNAME` in `src/hooks/useGitHubRepos.ts` if you fork this for another account. |
0 commit comments