Repository navigation
Architecture
github-actions[bot] edited this page Oct 27, 2026
·
2 revisions
src/
hooks/ # One module per hook (+ shared dialogFrame for overlays)
index.ts # Public barrel — named re-exports only
tsup.config.ts # ESM + CJS + .d.ts / .d.cts from src/index.ts
-
Tree-shaking:
sideEffects: falseand named exports so bundlers drop unused hooks. -
Peers only: published tarball peers on
react/react-dom(>=18). No runtime dependencies. -
Build:
tsupemitsdist/index.js,dist/index.cjs, and matching types.reactis markedexternal. -
Entry: consumers import from
usethishook(seepackage.jsonexports).
The interactive site under playground/ is the public docs surface at usethishook.mentorbridge.in.
| Concern | Location |
|---|---|
| Catalog / categories |
playground/src/*Hooks.ts, hooksCatalog.ts
|
| Descriptions | playground/src/descriptions/ |
| API tables | playground/src/api/ |
| Live demos | playground/src/demos/ |
| Routing | Path-based History API (/, /useBoolean, /compare, /mcp) |
The playground resolves the library via a Vite alias to ../src/index.ts so demos track local source without publishing.
| Target | How |
|---|---|
| Custom domain / Vercel |
npm run playground:build (base: /) |
| GitHub Pages |
npm run playground:build:pages (base: /useThisHook/, 404.html SPA fallback) |
| npm | Manual Publish npm workflow (OIDC) |
| MCP |
usethishook-mcp catalog generated from playground (npm run mcp:catalog) |