Skip to content

Commit a1bd0d2

Browse files
committed
github/library plan step 2
1 parent 48d0dfd commit a1bd0d2

5 files changed

Lines changed: 148 additions & 76 deletions

File tree

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,24 @@ The ACL phase is planned but not implemented. Currently:
136136
- **Vite** - Build tooling
137137
- **TypeScript** - Type safety
138138

139+
## Use as a library
140+
141+
Install from GitHub (replace `devalbo/tb-solid-pod` with your fork if needed):
142+
143+
```bash
144+
npm install github:devalbo/tb-solid-pod
145+
```
146+
147+
Then import schemas, CLI, or components:
148+
149+
```ts
150+
import { createPersona, createContact, PersonaSchema } from 'tb-solid-pod';
151+
import { CliTerminal } from 'tb-solid-pod';
152+
import { PersonaList, PersonaForm } from 'tb-solid-pod';
153+
```
154+
155+
For full integration (TinyBase store setup, components, CLI), see the [Integration Guide](#integration-guide) below.
156+
139157
## Integration Guide
140158

141159
### Option 1: Use as Reference / Copy Components
@@ -374,6 +392,8 @@ export function createProject(input: { name: string }, baseUrl: string) {
374392

375393
## Getting Started (Demo App)
376394

395+
Requires Node 18+ (or use `nvm use` if you use nvm).
396+
377397
```bash
378398
npm install
379399
npm run dev

docs/GITHUB_AND_LIBRARY_PLAN.md

Lines changed: 77 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,45 @@ Make this repo suitable for **three uses**:
1010

1111
## Goals
1212

13-
Goals follow the same order as the implementation steps below.
13+
Goals follow the same order as sections 1–4. Track progress via the checklists in each section (1.4, 2.6, 3.6, 4.5).
1414

15-
| Goal | Outcome (aligned with step) |
15+
| Goal | Outcome (aligned with section) |
1616
|------|-----------------------------|
17-
| **1. GitHub-ready** | Repo created on GitHub; code pushed; LICENSE in repo; description and topics set (step 1). |
18-
| **2. Runnable on checkout** | `git clone``npm install``npm run dev` works; README “Getting Started” accurate (step 2). |
19-
| **3. Use as library** | package.json and entry point in place; consumers can install from GitHub/npm and import; README “Use as a library” section (step 3). |
20-
| **4. GitHub Pages demo** | Vite `base` set; Pages workflow deploys `dist/` to `gh-pages`; Settings → Pages enabled; “Live demo” link in README (steps 4–5). |
21-
| **5. Clear docs** | README explains run locally, use as library, and try the live demo (across steps 2–5). |
22-
| **6. Publish (optional)** | npm publish or install-from-GitHub documented (step 6). |
17+
| **1. GitHub-ready** | Repo created on GitHub; code pushed; LICENSE in repo; description and topics set (§4). |
18+
| **2. Runnable on checkout** | `git clone``npm install``npm run dev` works; README “Getting Started” accurate (§1). |
19+
| **3. Use as library** | package.json and entry point in place; consumers can install from GitHub/npm and import; README “Use as a library” section (§2). |
20+
| **4. GitHub Pages demo** | Vite `base` set; Pages workflow deploys `dist/` to `gh-pages`; Settings → Pages enabled; “Live demo” link in README (§3). |
21+
| **5. Clear docs** | README explains run locally, use as library, and try the live demo (§1–4). |
22+
| **6. Publish (optional)** | npm publish or install-from-GitHub documented. |
2323

2424
---
2525

26+
## Current state (as of plan update)
27+
28+
Summary of what exists in the repo today.
29+
30+
| Area | Status | Notes |
31+
|------|--------|--------|
32+
| **App entry** | Done | `index.html` + `src/main.tsx`; scripts `dev`, `build`, `preview`, `lint` present. |
33+
| **Source layout** | Done | `src/schemas/`, `src/utils/`, `src/cli/`, `src/components/` with expected files. |
34+
| **LICENSE** | Done | AGPL-3.0-or-later in repo; `package.json` has `"license": "AGPL-3.0-or-later"`. |
35+
| **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. |
36+
| **Runnable on checkout** | Partial | Commands work; no `.nvmrc`; README matches commands. |
37+
| **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`). |
39+
| **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. |
40+
41+
**Next steps (in order):**
42+
1) ~~Confirm repo on GitHub and push if needed.~~ Done (repo is private).
43+
2) ~~Add `.nvmrc` and optional Node note in README.~~ Done.
44+
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.
46+
47+
---
48+
49+
**When you complete a task:** mark it `[x]` in the **checklist** at the end of the relevant section (1.4, 2.6, 3.6, 4.5) and refresh this **Current state** table so the plan stays accurate.
50+
51+
---
2652
## 1. Runnable on Checkout
2753

2854
### 1.1 Keep current app as default
@@ -32,19 +58,19 @@ Goals follow the same order as the implementation steps below.
3258

3359
### 1.2 Getting Started in README
3460

35-
- README already has “Getting Started (Demo App)” with `npm install` and `npm run dev`.
36-
- Add one line if useful: “Requires Node 18+ (or 20+).” Optionally add `.nvmrc` with e.g. `20` so `nvm use` works.
61+
- [x] README already has “Getting Started (Demo App)” with `npm install` and `npm run dev`.
62+
- [x] Add one line if useful: “Requires Node 18+ (or 20+).” Optionally add `.nvmrc` with e.g. `20` so `nvm use` works.
3763

3864
### 1.3 Optional: Node version hint
3965

40-
- Add **`.nvmrc`** with a single line: `20` (or your preferred LTS).
41-
- In README Getting Started, add: “Requires Node 18+ (or use `nvm use` if you use nvm).”
66+
- [x] Add **`.nvmrc`** with a single line: `20` (or your preferred LTS).
67+
- [x] In README Getting Started, add: “Requires Node 18+ (or use `nvm use` if you use nvm).”
4268

4369
### 1.4 Checklist (runnable)
4470

45-
- [ ] `npm install` and `npm run dev` work on a clean clone.
46-
- [ ] README “Getting Started” matches actual commands.
47-
- [ ] (Optional) `.nvmrc` added; README mentions Node version.
71+
- [x] `npm install` and `npm run dev` work on a clean clone.
72+
- [x] README “Getting Started” matches actual commands.
73+
- [x] (Optional) `.nvmrc` added; README mentions Node version.
4874

4975
---
5076

@@ -57,11 +83,13 @@ Two ways to “use as a library”:
5783

5884
Plan focuses on **A** so the repo is a proper installable package; **B** stays as an alternative in the README.
5985

86+
**Assumption for step 2:** we are **not** publishing to npm right now—only making the package installable from the GitHub repo (e.g. `npm install github:user/tb-solid-pod`). You can add npm publish later if needed.
87+
6088
### 2.1 Package identity
6189

62-
- **name**: Keep `tb-solid-pod` or use a scoped name e.g. `@yourname/tb-solid-pod` if you plan to publish to npm.
63-
- **version**: Set a real version, e.g. `0.1.0` (semver).
64-
- **private**: Remove `"private": true` so the package can be published (or installed from GitHub with `npm install git+https://...`).
90+
- [x] **name**: Keep `tb-solid-pod` (or use a scoped name e.g. `@yourname/tb-solid-pod` if you later publish to npm).
91+
- [x] **version**: Set a real version, e.g. `0.1.0` (semver).
92+
- [ ] **private**: Keep `"private": true` for now—it only blocks npm publish; install from GitHub still works. Remove when you want to publish to npm.
6593

6694
### 2.2 What the library exposes
6795

@@ -101,8 +129,7 @@ Add/update:
101129
```
102130

103131
- **main / types / exports**: Point at **source** so consumers’ bundlers (Vite, etc.) compile TypeScript. No `dist/` or dual build unless you add a separate “lib” build later.
104-
- **files**: Publish only `src` and README; keeps package small and avoids shipping `dist/` or demo-only files if you add a lib build later.
105-
- Omit `"private": true` when you intend to publish or allow install from GitHub.
132+
- **files**: Include only `src` and README; keeps the package small. For GitHub-only install, `private: true` is fine (remove it when you publish to npm).
106133

107134
If you prefer a **single entry** that re-exports everything:
108135

@@ -119,26 +146,26 @@ Then in package.json:
119146
### 2.4 Consumer dependencies (peer / optional)
120147

121148
- **tinybase**, **react**, **react-dom**, **zod**, **@inrupt/vocab-common-rdf**, **@inrupt/vocab-solid-common** are required for full app.
122-
- For **library** use, list them as **dependencies** so `npm install tb-solid-pod` brings them in; or list as **peerDependencies** if you want the app to supply versions (more flexible, but consumers must install them).
149+
- For **library** use, list them as **dependencies** so `npm install github:user/tb-solid-pod` brings them in; or list as **peerDependencies** if you want the app to supply versions (more flexible, but consumers must install them).
123150

124-
Recommendation for simplicity: keep as **dependencies** so install-from-GitHub / npm “just works” for the demo and for apps that don’t care about version alignment. You can switch to peerDependencies later if needed.
151+
Recommendation for simplicity: keep as **dependencies** so `npm install github:user/tb-solid-pod` “just works” for the demo and for consuming apps. You can switch to peerDependencies later if needed.
125152

126153
### 2.5 Library entry file (optional but useful)
127154

128-
- Add **`src/index.ts`** that:
155+
- [x] Add **`src/index.ts`** that:
129156
- Re-exports all public schemas (from `src/schemas/index.ts`).
130157
- Re-exports CLI and components you want to expose (e.g. `CliTerminal`, `createPersona`, etc.).
131-
- Document in README: “To use as a library, `import { createPersona, CliTerminal, ... } from 'tb-solid-pod'` (or from GitHub: `npm i github:user/tb-solid-pod`).”
158+
- [x] Document in README: install from GitHub (`npm i github:user/tb-solid-pod`) and example `import { createPersona, CliTerminal, ... } from 'tb-solid-pod'`.
132159

133160
### 2.6 Checklist (library)
134161

135-
- [ ] `"private": true` removed (when you want it installable).
136-
- [ ] `version` set (e.g. `0.1.0`).
137-
- [ ] `description`, `keywords`, `author`, `license` set.
138-
- [ ] `main`, `types`, `exports` point at source entry (e.g. `src/index.ts`).
139-
- [ ] `files` includes `src` and `README.md`.
140-
- [ ] (Optional) `src/index.ts` added and re-exports public API.
141-
- [ ] README documents: install from npm or GitHub, and example `import` for library use.
162+
- [x] `"private": true` kept for now (GitHub-only install; remove when you publish to npm).
163+
- [x] `version` set (e.g. `0.1.0`).
164+
- [x] `description`, `keywords`, `author`, `license` set.
165+
- [x] `main`, `types`, `exports` point at source entry (e.g. `src/index.ts`).
166+
- [x] `files` includes `src` and `README.md`.
167+
- [x] (Optional) `src/index.ts` added and re-exports public API.
168+
- [x] README documents: install from GitHub and example `import` for library use.
142169

143170
---
144171

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

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

153-
- In **`vite.config.js`** (or `vite.config.ts`), set **`base`** to the repo name with leading and trailing slash:
180+
- [ ] In **`vite.config.js`** (or `vite.config.ts`), set **`base`** to the repo name with leading and trailing slash:
154181
- `base: '/tb-solid-pod/'` (replace with actual repo name if different).
155-
- Rebuild: `npm run build`. Check that `dist/index.html` references assets like `/tb-solid-pod/assets/...` (not `/assets/...`).
156-
- Optional: use an env variable so local dev keeps `base: '/'` and CI sets `base: '/repo-name/'` for the Pages build.
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.
157184

158185
### 3.2 Build output
159186

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

173200
Add a workflow that builds and deploys to GitHub Pages. For example:
174201

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

185212
### 3.5 README and base path
186213

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

190217
### 3.6 Checklist (GitHub Pages)
191218

@@ -201,24 +228,25 @@ Result: every push to `main` (or chosen branch) updates the live demo.
201228

202229
### 4.1 Create the repo on GitHub
203230

204-
- On GitHub: **Create a new repository** (e.g. `tb-solid-pod`).
231+
- [x] On GitHub: **Create a new repository** (e.g. `tb-solid-pod`).
205232
- Choose owner (your user or org).
206233
- Set repo name (this becomes the path in GitHub Pages URL: `https://<owner>.github.io/<repo>/`).
207234
- **Do not** add a README, .gitignore, or license yet if you already have them locally (avoids merge conflicts).
208235
- Default branch: **main**.
209-
- Note the repo URL (e.g. `https://github.com/<owner>/<repo>.git`); you will need the repo name for `base` in Vite and for the “Live demo” link.
236+
- **Public vs private**: The repo can stay **private** for now. Make it public when you want others to install from GitHub (`npm install github:user/tb-solid-pod`) or when you want the Live demo URL to be openly shareable.
237+
- [x] Note the repo URL (e.g. `https://github.com/<owner>/<repo>.git`); you will need the repo name for `base` in Vite and for the “Live demo” link.
210238

211239
### 4.2 Repo settings
212240

213-
- **Description**: e.g. “Browser-based Solid-style data pod with TinyBase – personas, contacts, groups, type indexes, WebID profile. Runnable demo + use as library.”
214-
- **Topics/tags**: e.g. `solid`, `tinybase`, `pod`, `webid`, `linked-data`, `react`, `typescript`.
215-
- **License**: Ensure LICENSE file exists (AGPL-3.0) and matches `package.json` “license”.
241+
- [ ] **Description**: e.g. “Browser-based Solid-style data pod with TinyBase – personas, contacts, groups, type indexes, WebID profile. Runnable demo + use as library.”
242+
- [ ] **Topics/tags**: e.g. `solid`, `tinybase`, `pod`, `webid`, `linked-data`, `react`, `typescript`.
243+
- [x] **License**: Ensure LICENSE file exists (AGPL-3.0) and matches `package.json` “license”.
216244

217245
### 4.3 README for GitHub visitors
218246

219-
- First paragraph: what the project is, that it’s **runnable on checkout** and **usable as a library**.
220-
- **Getting Started** – clone, install, run (already there).
221-
- **Library usage** – one short section: install from GitHub (or npm) and a minimal import example; link to “Integration Guide” for details.
247+
- [x] First paragraph: what the project is, that it’s **runnable on checkout** and **usable as a library**.
248+
- [x] **Getting Started** – clone, install, run (already there).
249+
- [ ] **Library usage** – one short section: install from GitHub (or npm) and a minimal import example; link to “Integration Guide” for details.
222250

223251
### 4.4 GitHub Actions
224252

@@ -228,44 +256,18 @@ Result: every push to `main` (or chosen branch) updates the live demo.
228256

229257
### 4.5 Checklist (GitHub)
230258

231-
- [ ] Repo created on GitHub; default branch set (e.g. main).
259+
- [x] Repo created on GitHub; default branch set (e.g. main).
232260
- [ ] Description and topics set.
233-
- [ ] LICENSE file present; package.json “license” matches.
261+
- [x] LICENSE file present; package.json “license” matches.
234262
- [ ] README explains runnable app + library use + “Live demo” link.
235263
- [ ] GitHub Actions Pages workflow added; deploys `dist/` to `gh-pages` on push to main.
236264
- [ ] Settings → Pages: source = branch `gh-pages`, root.
237265

238266
---
239267

240-
## 5. Implementation Order
241-
242-
1. **GitHub-ready** (do this first)
243-
- Create a new repository on GitHub (e.g. `tb-solid-pod`) under your user or org. Do not initialize with README / .gitignore / license if you already have them locally.
244-
- Push your code: add remote (`git remote add origin https://github.com/<owner>/<repo>.git`), push `main`.
245-
- Ensure LICENSE is in the repo. Set the repo description and topics in Settings.
246-
- Note the repo name; you will use it for Vite `base` and the Live demo URL in later steps.
247-
248-
2. **Runnable on checkout**
249-
- Verify `npm install` and `npm run dev` on clean clone.
250-
- (Optional) Add `.nvmrc`; mention Node in README.
251-
252-
3. **Library packaging**
253-
- Add or adjust `src/index.ts` as the public entry; re-export schemas, CLI, and components you want public.
254-
- Update `package.json`: remove `private`, set `version`, `description`, `keywords`, `main`, `types`, `exports`, `files`.
255-
- In README, add a short “Use as a library” section (install from GitHub/npm + one import example).
256-
257-
4. **GitHub Pages: Vite base + workflow**
258-
- Set `base: '/<repo>/'` in `vite.config.js` (use the repo name from step 1).
259-
- Add `.github/workflows/pages.yml` that builds with this base and deploys `dist/` to `gh-pages` (e.g. `peaceiris/actions-gh-pages`). This workflow is required.
260-
- Add “Live demo” / “Try it” link in README: `https://<owner>.github.io/<repo>/`.
261-
262-
5. **Enable Pages and verify**
263-
- In repo Settings → Pages: choose “Deploy from a branch”; branch `gh-pages`, folder root. Save.
264-
- Push your changes (workflow and Vite base). The workflow will run and create/update `gh-pages`; the site will appear at the Pages URL.
268+
## 5. Implementation order
265269

266-
6. **Publish (optional)**
267-
- To publish to npm: add npm account, `npm login`, `npm publish`. Optionally automate with a release workflow.
268-
- To use only from GitHub: document `npm install github:username/tb-solid-pod` (or `user/repo#branch`).
270+
Work through **sections 1 → 4** in order. Track progress using the **checklists** at the end of each section (1.4, 2.6, 3.6, 4.5).
269271

270272
---
271273

package.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
{
22
"name": "tb-solid-pod",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "0.1.0",
5+
"description": "Browser-based Solid-style data pod with TinyBase: personas, contacts, groups, type indexes, WebID profile.",
56
"license": "AGPL-3.0-or-later",
67
"type": "module",
8+
"main": "./src/index.ts",
9+
"types": "./src/index.ts",
10+
"exports": {
11+
".": {
12+
"import": "./src/index.ts",
13+
"types": "./src/index.ts"
14+
}
15+
},
16+
"files": [
17+
"src",
18+
"README.md"
19+
],
20+
"keywords": ["solid", "tinybase", "pod", "webid", "linked-data", "react", "typescript"],
21+
"author": "",
722
"scripts": {
823
"dev": "vite",
924
"build": "vite build",

0 commit comments

Comments
 (0)