Skip to content

Commit c32e60f

Browse files
committed
github/library plan step 3 - github pages
1 parent a1bd0d2 commit c32e60f

File tree

5 files changed

+121
-16
lines changed

5 files changed

+121
-16
lines changed

.github/workflows/pages.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Deploy demo app to GitHub Pages (https://<owner>.github.io/tb-solid-pod/)
2+
# Repo Settings → Pages: set "Deploy from a branch", branch gh-pages, folder / (root).
3+
name: Deploy to GitHub Pages
4+
5+
on:
6+
push:
7+
branches: [main]
8+
9+
permissions:
10+
contents: write # push to gh-pages branch
11+
12+
jobs:
13+
build-and-deploy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version-file: ".nvmrc"
23+
cache: "npm"
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Build
29+
env:
30+
BASE_PATH: "/tb-solid-pod/"
31+
run: npm run build
32+
33+
- name: Deploy to gh-pages
34+
uses: peaceiris/actions-gh-pages@v4
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ./dist

AGENTS.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Agent instructions – tb-solid-pod
2+
3+
Context for AI assistants working on this repo.
4+
5+
## What this project is
6+
7+
**tb-solid-pod** is a browser-based personal data pod inspired by the [Solid Project](https://solidproject.org/), built with [TinyBase](https://tinybase.org/) for reactive state and LocalStorage. It is **not** a real Solid server (no LDP, no WebID-TLS); it simulates Solid-style data (personas, contacts, groups, type indexes, file metadata) in a single-page app.
8+
9+
- **Dual interface**: graphical UI (tabs, forms, lists) + CLI terminal.
10+
- **Data**: personas (WebID-style), contacts (including agents), groups (org/team/group), type indexes, virtual file system with metadata, settings/preferences.
11+
- **Stack**: React, TinyBase, Zod, Vite, TypeScript. Vocabularies: FOAF, vCard, Dublin Core, W3C Org, `@inrupt/vocab-*`.
12+
13+
## Repo layout
14+
15+
| Path | Purpose |
16+
|------|--------|
17+
| `src/main.tsx` | App entry (demo only). |
18+
| `src/App.tsx` | Root UI: tabs + CLI. |
19+
| `src/index.ts` | **Library entry** – re-exports schemas, utils, CLI, components for `import from 'tb-solid-pod'`. |
20+
| `src/schemas/` | Zod schemas + factory functions (persona, contact, group, file, typeIndex, preferences, base). |
21+
| `src/utils/` | settings, storeExport, typeIndex helpers, validation. |
22+
| `src/cli/` | CliTerminal, command registry, parse-args, types. |
23+
| `src/components/` | PersonaList/Form, ContactList/Form, GroupList/Form, MembershipManager, FileMetadataPanel. |
24+
| `docs/` | DESIGN.md, IMPLEMENTATION_PLAN.md, **GITHUB_AND_LIBRARY_PLAN.md** (authoritative for “three uses” plan). |
25+
26+
## What’s done so far
27+
28+
1. **GitHub-ready**
29+
Repo on GitHub (`devalbo/tb-solid-pod`), `main` pushed, LICENSE (AGPL-3.0-or-later). Repo is **private** for now.
30+
31+
2. **Runnable on checkout**
32+
`npm install` and `npm run dev` work. README “Getting Started (Demo App)” is accurate. `.nvmrc` (Node 20) and README Node note (“Requires Node 18+” / `nvm use`) added.
33+
34+
3. **Usable as a library (GitHub-only, no npm publish)**
35+
- **package.json**: `version` 0.1.0, `description`, `keywords`, `main`/`types`/`exports``./src/index.ts`, `files`: `["src", "README.md"]`, `private: true` kept.
36+
- **src/index.ts**: Re-exports schemas, utils, CLI, and components.
37+
- **README**: “Use as a library” section with `npm install github:devalbo/tb-solid-pod` and example imports.
38+
39+
## What’s not done
40+
41+
- **GitHub Pages (manual)**: In repo **Settings → Pages**, set "Deploy from a branch", branch `gh-pages`, folder root. (Code is done: Vite `base` env-driven, `.github/workflows/pages.yml` deploys `dist/` to `gh-pages`; README has Live demo link.)
42+
- **Optional**: Repo description/topics on GitHub; README “Library usage” expansion; npm publish later.
43+
44+
## Plan and checklists
45+
46+
- **docs/GITHUB_AND_LIBRARY_PLAN.md** is the source of truth for the “three uses” plan (runnable, library, GitHub Pages).
47+
- Progress is tracked by **checklists** at the end of sections 1–4 (1.4, 2.6, 3.6, 4.5) and by the **Current state** table.
48+
- When you complete a task, mark it `[x]` in the relevant checklist and refresh the Current state table so the plan stays accurate.
49+
50+
## Conventions
51+
52+
- **Library**: Consumers install from GitHub (`npm install github:user/tb-solid-pod`). We do not publish to npm for now; `private: true` is intentional.
53+
- **Schemas**: Zod + JSON-LD; factory functions (e.g. `createPersona`, `createContact`) take a base URL for IRIs.
54+
- **CLI**: Commands live in `src/cli/commands/`; registry in `src/cli/registry.tsx`.
55+
- **Components**: React components expect a TinyBase `store` (and often `indexes`); they are default-exported and re-exported as named from `src/index.ts`.
56+
57+
## Useful docs
58+
59+
- **README.md** – Overview, limitations, Integration Guide (copy-paste vs install-from-GitHub), CLI command list.
60+
- **docs/GITHUB_AND_LIBRARY_PLAN.md** – Goals, current state, section checklists, File Summary, Success Criteria.
61+
- **docs/IMPLEMENTATION_PLAN.md** – Feature/phases.
62+
- **DESIGN.md** – Design notes.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
A browser-based personal data pod inspired by the [Solid Project](https://solidproject.org/), built with [TinyBase](https://tinybase.org/) for reactive state management and LocalStorage persistence.
44

5+
**[Live demo](https://devalbo.github.io/tb-solid-pod/)** · Run locally: `npm install` then `npm run dev` · [Use as a library](#use-as-a-library)
6+
57
## What This Project Does
68

79
This library provides a complete foundation for **user-owned social data** in web applications. It implements core Solid/Linked Data concepts in a lightweight, browser-first package:
@@ -392,7 +394,7 @@ export function createProject(input: { name: string }, baseUrl: string) {
392394

393395
## Getting Started (Demo App)
394396

395-
Requires Node 18+ (or use `nvm use` if you use nvm).
397+
**[Try the live demo](https://devalbo.github.io/tb-solid-pod/)** or run locally. Requires Node 18+ (or use `nvm use` if you use nvm).
396398

397399
```bash
398400
npm install

docs/GITHUB_AND_LIBRARY_PLAN.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ Summary of what exists in the repo today.
3535
| **README** | Partial | Has “Getting Started (Demo App)” with `npm install` / `npm run dev`. No Node version note, no “Use as a library” install-from-GitHub section, no “Live demo” link. Integration Guide documents copy-paste and schema-only use. |
3636
| **Runnable on checkout** | Partial | Commands work; no `.nvmrc`; README matches commands. |
3737
| **Library packaging** | Done | `package.json`: version 0.1.0, description, keywords, main, types, exports, files; `src/index.ts` re-exports schemas, utils, CLI, components; README “Use as a library” section. |
38-
| **GitHub Pages** | Not done | No `base` in `vite.config.js`; no `.github/workflows/` (no `pages.yml` or `ci.yml`). |
38+
| **GitHub Pages** | Done (code) | `vite.config.js` base env-driven; `.github/workflows/pages.yml` builds with `BASE_PATH=/tb-solid-pod/` and deploys to `gh-pages`; README has Live demo link. **You must set Settings → Pages: Deploy from branch `gh-pages`.** |
3939
| **GitHub repo** | Done | Repo on GitHub (`devalbo/tb-solid-pod`), main pushed, LICENSE in repo. **Repo is private for now**; make public when you want install-from-GitHub or a public Live demo. |
4040

4141
**Next steps (in order):**
4242
1) ~~Confirm repo on GitHub and push if needed.~~ Done (repo is private).
4343
2) ~~Add `.nvmrc` and optional Node note in README.~~ Done.
4444
3) ~~Add `src/index.ts`, update `package.json` for library use, add “Use as a library” in README.~~ Done.
45-
4) Set Vite `base`, add Pages workflow, enable Pages, add Live demo link.
45+
4) ~~Set Vite `base`, add Pages workflow, add "Live demo" link.~~ Done. Enable Pages in repo Settings → Pages (Deploy from branch `gh-pages`).
4646

4747
---
4848

@@ -177,10 +177,10 @@ Deploy the built Vite app so visitors can use it at `https://<username>.github.i
177177

178178
GitHub Pages serves project sites from `/<repo>/`, so assets must use that base.
179179

180-
- [ ] In **`vite.config.js`** (or `vite.config.ts`), set **`base`** to the repo name with leading and trailing slash:
181-
- `base: '/tb-solid-pod/'` (replace with actual repo name if different).
182-
- [ ] Rebuild: `npm run build`. Check that `dist/index.html` references assets like `/tb-solid-pod/assets/...` (not `/assets/...`).
183-
- [ ] Optional: use an env variable so local dev keeps `base: '/'` and CI sets `base: '/repo-name/'` for the Pages build.
180+
- [x] In **`vite.config.js`** (or `vite.config.ts`), set **`base`** to the repo name with leading and trailing slash:
181+
- `base: '/tb-solid-pod/'` (replace with actual repo name if different). Implemented as env-driven: `process.env.BASE_PATH ?? '/'`; CI sets `BASE_PATH: '/tb-solid-pod/'`.
182+
- [x] Rebuild: `npm run build`. Check that `dist/index.html` references assets like `/tb-solid-pod/assets/...` (not `/assets/...`).
183+
- [x] Optional: use an env variable so local dev keeps `base: '/'` and CI sets `base: '/repo-name/'` for the Pages build.
184184

185185
### 3.2 Build output
186186

@@ -199,7 +199,7 @@ GitHub Pages serves project sites from `/<repo>/`, so assets must use that base.
199199

200200
Add a workflow that builds and deploys to GitHub Pages. For example:
201201

202-
- [ ] **Trigger**: push to `main` (or only when `dist/` or source changes, if you prefer).
202+
- [x] **Trigger**: push to `main` (or only when `dist/` or source changes, if you prefer).
203203
- **Steps**:
204204
1. Checkout repo.
205205
2. Setup Node (e.g. `actions/setup-node` with version from `.nvmrc` or fixed `20`).
@@ -211,16 +211,16 @@ Result: every push to `main` (or chosen branch) updates the live demo.
211211

212212
### 3.5 README and base path
213213

214-
- [ ] In README, add a **“Try it”** or **“Live demo”** link at the top or in Getting Started: `https://<username>.github.io/<repo>/`.
214+
- [x] In README, add a **“Try it”** or **“Live demo”** link at the top or in Getting Started: `https://<username>.github.io/<repo>/`.
215215
- [ ] If repo is renamed, update `base` in Vite config and the README link.
216216

217217
### 3.6 Checklist (GitHub Pages)
218218

219-
- [ ] `vite.config.js` has `base: '/<repo>/'` (or env-driven) so assets load on GitHub Pages.
220-
- [ ] `npm run build` produces a working `dist/` when base is set.
221-
- [ ] GitHub Actions workflow builds with correct base and deploys `dist/` to `gh-pages` (or chosen branch).
222-
- [ ] Repo Settings → Pages: source = branch (e.g. `gh-pages`), root.
223-
- [ ] README includes “Live demo” / “Try it” link to the Pages URL.
219+
- [x] `vite.config.js` has `base: '/<repo>/'` (or env-driven) so assets load on GitHub Pages.
220+
- [x] `npm run build` produces a working `dist/` when base is set.
221+
- [x] GitHub Actions workflow builds with correct base and deploys `dist/` to `gh-pages` (or chosen branch).
222+
- [ ] Repo Settings → Pages: source = branch (e.g. `gh-pages`), root. **(Do this in GitHub UI after first push.)**
223+
- [x] README includes “Live demo” / “Try it” link to the Pages URL.
224224

225225
---
226226

@@ -259,8 +259,8 @@ Result: every push to `main` (or chosen branch) updates the live demo.
259259
- [x] Repo created on GitHub; default branch set (e.g. main).
260260
- [ ] Description and topics set.
261261
- [x] LICENSE file present; package.json “license” matches.
262-
- [ ] README explains runnable app + library use + “Live demo” link.
263-
- [ ] GitHub Actions Pages workflow added; deploys `dist/` to `gh-pages` on push to main.
262+
- [x] README explains runnable app + library use + “Live demo” link.
263+
- [x] GitHub Actions Pages workflow added; deploys `dist/` to `gh-pages` on push to main.
264264
- [ ] Settings → Pages: source = branch `gh-pages`, root.
265265

266266
---

vite.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
33

44
// https://vite.dev/config/
5+
// BASE_PATH: set in CI (e.g. '/tb-solid-pod/') for GitHub Pages; local dev uses '/'
6+
const base = process.env.BASE_PATH ?? '/'
7+
58
export default defineConfig({
9+
base,
610
plugins: [react()],
711
})

0 commit comments

Comments
 (0)