Skip to content

Add a fully-documented demo/docs site, deployed to GitHub Pages - #9

Merged
PotLid merged 2 commits into
masterfrom
dev
Aug 19, 2026
Merged

Add a fully-documented demo/docs site, deployed to GitHub Pages#9
PotLid merged 2 commits into
masterfrom
dev

Conversation

@PotLid

@PotLid PotLid commented Aug 19, 2026

Copy link
Copy Markdown
Owner

New demo/ Vite + React + TS app under demo/, aliased to build directly against the current src/index.tsx (dogfooding the real source, not a stale published version). Includes:

  • A live playground with four working tabs (embed, popup, custom theme, imperative ref) running against the actual Kakao Postcode widget, not a mock — verified end to end with real network requests and a real onChange payload rendered back into the page.
  • A full API reference generated from the same prop/type data as the README (props table, PostcodeOptions/theme/PostcodeCompleteData key lists), plus install/quick-start snippets and the 1.x migration note.
  • An EN/KO language toggle reusing the README's Korean translation.
  • Light/dark theming via prefers-color-scheme.

Caught and fixed two real bugs while building this:

  • Aliasing src/index.tsx (which lives outside demo/) made its bare import 'react' resolve via the repo root's node_modules instead of demo's own, loading two separate React copies on one page and breaking hooks outright ("Cannot read properties of null"). Fixed with explicit resolve.alias entries forcing every react/react-dom specifier to demo's copy.
  • The hand-rolled code-block syntax highlighter's tag/attribute passes injected raw markup directly, which a later pass (matching class=) then re-matched and corrupted. Fixed by stashing every token type behind a NUL-delimited marker so later passes never see already-highlighted output (same class of bug, and same fix, as the numeric-placeholder collision caught earlier in this file).

Deployment: .github/workflows/deploy-pages.yml builds demo/ and publishes to GitHub Pages on every push to master that touches demo/ or src/. ci.yml gained a build-demo job (typecheck + build, no deploy) so PRs validate the demo too. Needs GitHub Pages enabled with source "GitHub Actions" in repo settings before the first deploy will work.

New demo/ Vite + React + TS app under demo/, aliased to build directly
against the current src/index.tsx (dogfooding the real source, not a
stale published version). Includes:

- A live playground with four working tabs (embed, popup, custom theme,
  imperative ref) running against the actual Kakao Postcode widget, not
  a mock — verified end to end with real network requests and a real
  onChange payload rendered back into the page.
- A full API reference generated from the same prop/type data as the
  README (props table, PostcodeOptions/theme/PostcodeCompleteData key
  lists), plus install/quick-start snippets and the 1.x migration note.
- An EN/KO language toggle reusing the README's Korean translation.
- Light/dark theming via prefers-color-scheme.

Caught and fixed two real bugs while building this:
- Aliasing src/index.tsx (which lives outside demo/) made its bare
  `import 'react'` resolve via the repo root's node_modules instead of
  demo's own, loading two separate React copies on one page and
  breaking hooks outright ("Cannot read properties of null"). Fixed
  with explicit resolve.alias entries forcing every react/react-dom
  specifier to demo's copy.
- The hand-rolled code-block syntax highlighter's tag/attribute passes
  injected raw <span> markup directly, which a later pass (matching
  `class=`) then re-matched and corrupted. Fixed by stashing every
  token type behind a NUL-delimited marker so later passes never see
  already-highlighted output (same class of bug, and same fix, as the
  numeric-placeholder collision caught earlier in this file).

Deployment: .github/workflows/deploy-pages.yml builds demo/ and
publishes to GitHub Pages on every push to master that touches demo/
or src/. ci.yml gained a build-demo job (typecheck + build, no deploy)
so PRs validate the demo too. Needs GitHub Pages enabled with source
"GitHub Actions" in repo settings before the first deploy will work.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@PotLid PotLid closed this Aug 19, 2026
demo/tsconfig.json type-checks ../src/index.tsx directly. That file
lives outside demo/, so TypeScript resolves its bare `import 'react'`
starting from its own location (the repo root), not from demo's own
node_modules. The build-demo job only ever ran `npm ci` inside demo/,
so on a clean checkout there was no root node_modules for it to find,
and the job failed with "Cannot find module 'react'" plus a cascade of
downstream implicit-any errors.

Verified by cloning dev into a scratch directory (a truly clean
checkout, matching what CI does) and reproducing the exact failure
without the root install, then confirming it passes once `npm ci` runs
at the repo root first.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@PotLid PotLid reopened this Aug 19, 2026
@PotLid
PotLid merged commit 4667077 into master Aug 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant