Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Upgrade the Inkdrop API docs site to match the latest upstream Tailwind UI "Protocol" template. Two orthogonal axes of change executed in phases: (1) major dependency bumps (Next 14→16, React 18→19, framer-motion 10→12, zustand 4→5, flexsearch 0.7→0.8, ESLint 8→9 flat config, etc.) and (2) full JavaScript→TypeScript migration of all non-MDX source. All Inkdrop-specific customizations (Fathom analytics, Navigation structure, pink typography theme, solarized-dark Shiki theme, custom icons, search index customizations,
/guides/list-of-commandsh3 indexing, extra components) preserved.Confirmed Decisions (2026-04-23)
fathom-client— Bump to^3.7.2. (Ships own types — no shim.)src/mdx/*.mjs— User chose convert to TS. Outcome (Phase 6h): deferred. Next 16'snext.config.tscompiles to CJS (exports.default = ...) but loads in ES module scope, throwingReferenceError: exports is not defined in ES module scope. Renamingnext.config.mjs→.tsis the only way to import.tsfiles transitively (Node ESM can't load.ts), but the resulting compiled config crashes at startup. Upstream Protocol template also keeps these as.mjs. Reverted: 4.mjsfiles retained,types.d.tsshim retained for@/mdx/search.mjs.--webpackondev/build. Resolved Phase 3.Status
const resolvedLevel;react-hooks/immutabilityre-enabled<a>for external links,Children.toArray(children).find(isValidElement)in CodePanel)<Fathom />mount preserved--webpack) ✅ 2026-04-23 — absorbed into Phase 3Lint deferrals — final state after Phase 6
The three react-hooks@7 strict rules that were disabled in Phase 3 to match upstream Protocol patterns:
react-hooks/immutability— re-enabled in Phase 6c. Heading.tsx now usesconst resolvedLevel = level ?? (2 as Level)instead of mutating the destructuredlevelparameter.react-hooks/set-state-in-effect— still disabled. AffectssetMounted(true)inThemeToggle.tsxandsetModifierKey(...)inSearch.tsx. Both are SSR/CSR hydration-gate patterns inherited from upstream Protocol; refactor would be invasive (and out of scope).react-hooks/refs— still disabled. AffectsinputElement: inputRef.currentpassed during render inSearch.tsx. Also upstream's pattern.Phase 3 React 19 runtime patches — final state after Phase 6e
Both temporary patches survived TS conversion:
mdx.tsx: external-link wrapper still uses plain<a>(not<Link>). Upstream keepsexport const a = Link(no external-icon decoration); we keep the Inkdrop external-icon decoration via plain<a>. Semantically correct for external links.Code.tsx:CodePanelstill usesChildren.toArray(children).find(isValidElement)instead ofChildren.only. Comment in code documents the Phase 3 finding. Root cause not pinned.Architecture Changes (final)
/tsconfig.json,/types.d.ts,/mdx-components.tsx,/typography.ts— TS landed (nojsconfig.json)./eslint.config.mjs— flat config usingeslint-config-next/core-web-vitalsnative flat export./next.config.mjs— top-leveloutputFileTracingIncludes,outputFileTracingRootpinned. Stays.mjs./package.json— Next 16, React 19, ESLint 9, framer-motion 12, zustand 5, flexsearch 0.8, next-themes 0.4, HUI 2.2.6, fathom-client 3.7.2; removed@headlessui/tailwindcss; added@types/react@19.2.14/@types/react-dom@19.2.3withoverridesblock;dev/builduse--webpack,lintuseseslint ../src/app/*.tsx— layout, not-found, providers (Fathom mount preserved)./src/components/*.tsx— all 21 components typed./src/components/icons/*.tsx— all 33 icons typed./src/lib/remToPx.ts./src/mdx/*.mjs— kept as.mjs(Decision 3 deferred)./src/styles/tailwind.css—@config '../../typography.ts';article kbdrule preserved./tailwind.config.js— vestigial dead code in Tailwind v4 (compiler reads CSS-based config); not loaded; leaving for now.Risks & Mitigations — final reconciliation
navigationarray verbatim, addedlink?: stringtoNavGroupinterface for Inkdrop's group-levellinkfield on App States and App Actions sections. Build green; user verification of every nav link is the smoke step.search.mjs. Resolved Phase 5 — zero source changes needed; API surface preserved.eslint-config-next/core-web-vitalsnative export.@configpath. Resolved Phase 6a.--webpack.next.config.tsESM/CJS conflict. Reverted to.mjs.Success Criteria
package.jsonmatches upstream on Next, React, framer-motion, zustand, flexsearch, ESLint, next-themes, HUI (extras:fathom-client,unist-util-map).typescript,@types/react@19.x,@types/react-dom@19.x,@types/node,@types/mdx,@types/react-highlight-wordsinstalled;overridesblock present.tsconfig.jsonandtypes.d.tspresent;jsconfig.jsonremoved.src/**/*.jsxandsrc/**/*.jsrenamed to.tsx/.ts(61 files);src/mdx/*.mjsretained per Decision 3 final outcome;npx tsc --noEmitgreen.eslint.config.mjs);npm run lintgreen (0 errors / 0 warnings).npm run buildgreen; 70/70 static pages.DatabaseIcon,ImageFileIcon(FileIcon export),NotebookIcon,NoteIcon,UtilsIcon)article kbdstylingoutputFileTracingIncludesat top level.@headlessui/tailwindcssremoved.Execution Log
Phase 1 — TypeScript scaffolding (2026-04-23)
Added
tsconfig.json,types.d.ts; deletedjsconfig.json; installedtypescript@^5.8.3,@types/mdx,@types/node,@types/react-highlight-words. Skipped fathom-client shim. Deferred@types/react/@types/react-domto Phase 3.Verify gate: install/tsc/lint/build all green.
Phase 2 — Tooling bumps (2026-04-23)
Bumped
prettier-plugin-tailwindcss0.6.11→0.7.2,prettier-plugin-organize-imports4.1.0→4.2.0,sharp0.33.1→0.34.3.ESLint 9 + flat config attempted & reverted: Next 14's
next lintdoesn't recognize flat config; bareeslint .fails on missing peer plugins fromeslint-config-next@14. Deferred to Phase 3.Verify gate: lint/build green on ESLint 8 baseline.
Phase 3 — Framework bump: Next 14→16 + React 18→19 + ESLint 9 (2026-04-23)
package.json:next14→16.1.6,react/react-dom18→19.2.4,@next/mdx14→16.1.6,framer-motion10→12.23.11,next-themes0.2→0.4.6,@headlessui/react2.2.2→2.2.6,react-highlight-words0.20→0.21,fathom-client3.6→3.7.2; removed@headlessui/tailwindcss. devDeps:eslint8→9.32.0,eslint-config-next14→16.1.6,@types/react@19.2.14,@types/react-dom@19.2.3.overridesblock.dev/build+=--webpack;lintnext lint→eslint ..tailwind.config.jsplugin removal.next.config.mjsoutputFileTracingIncludesunwrap +outputFileTracingRootpin..eslintrc.jsondeleted.eslint.config.mjsviaeslint-config-next/core-web-vitalsnative flat. Three react-hooks@7 strict rules disabled with rationale.mdx.jsx: external-link wrapper<Link>→<a>(React.Children.only crash on 3 pages).Code.jsx:CodePanelChildren.only→Children.toArray + find(isValidElement)(3 prerender pages).Async APIs audit: zero server-side hits.
Verify gate: install (vulns 12→5), tsc/lint/build all green; 70/70 pages.
Phase 4 — zustand 4 → 5 (2026-04-23)
zustand^4.3.2 → ^5.0.6. Zero source changes — all call sites already v5-compatible.Phase 5 — flexsearch 0.7 → 0.8 (2026-04-23)
flexsearch^0.7.31 → ^0.8.205 (resolved 0.8.212). Zero source changes —Documentconstructor,tokenize: 'full',context: {resolution, depth, bidirectional},.add(),.search(q, { enrich: true }), andEnrichedResultsshape all preserved.Phase 6a — Lib + primitives (2026-04-27)
Added
remToPx.ts,mdx-components.tsx,typography.ts(pink palette restored,const configpattern fixes anonymous-default-export warning); updated tailwind.css@configpath. Tailwind config.js noted as vestigial.Phase 6b — Icons (2026-04-27)
Bulk-copied 28 upstream typed icons via
cp(Bell,Bolt,Book,Calendar,Cart,ChatBubble,Check,ChevronRightLeft,Clipboard,Cog,Copy,Document,Envelope,FaceSmile,Folder,Link,List,MagnifyingGlass,MapPin,Package,PaperAirplane,PaperClip,Shapes,Shirt,SquaresPlus,Tag,User,Users). Wrote 5 Inkdrop-only icons typed (DatabaseIcon,ImageFileIcon(inFileIcon.tsx),NotebookIcon,NoteIcon,UtilsIcon). All useReact.ComponentPropsWithoutRef<'svg'>. Required spread cast for non-standard SVGtransformOriginattribute:<g transform="..." {...{ transformOrigin: "12 12" } as any}>.Phase 6c — Leaf components (2026-04-27)
cpfrom upstream:Button,Tag,Prose,GridPattern,Libraries(no Inkdrop deltas). Manual port preserving Inkdrop branding/content:Heading.tsx(addedselector/warningprops; refactored toconst resolvedLevel = level ?? (2 as Level)— enabled re-enablingreact-hooks/immutability),Feedback.tsx(simple GitHub fork link, not upstream's complex form),HeroPattern.tsx(purple/pink #6760D4→#ff63c3 gradient, not upstream's emerald),ThemeToggle.tsx(preservedcursor-pointer),Footer.tsx(DiscourseIcon + Inkdrop social links: x.com/inkdrop_app, GitHub, forum.inkdrop.app),Guides.tsx(Inkdrop guide list),Resources.tsx(Inkdrop data-access cards withDatabaseIcon/ImageFileIcon/NoteIcon/NotebookIcon/TagIcon/UtilsIcon),Logo.tsx(Inkdrop logo SVG with gradient).Phase 6d — Inkdrop-only components (2026-04-27)
Manual port (no upstream reference):
Fathom.tsx(TrackPageView with usePathname/useSearchParams + load/trackPageview from fathom-client; types from package's bundledtypes/index.d.ts),ListNavigationSection.tsx(usesnavigation.filter(s => s.link === currentPath)so the optionallink?: stringfield on NavGroup is required),MarkdownSourceLink.tsx(GitHub-source link with pathname-based URL).Phase 6e — Composite components (2026-04-27)
Search.tsx(443 lines): port of upstream Search.tsx pattern with Inkdrop pink branding (text-pink-500for highlight,dark:text-pink-400for loader,group-aria-selected:text-pink-500); preserved Phase 3react-hooks/refsdeferral viainputElement: inputRef.current.Code.tsx(~370 lines): port of upstream Code.tsx with Inkdrop pink branding (bg-pink-400/10 ring-pink-400/20on copy button,text-pink-400for "Copied!",border-pink-500 text-pink-400for active tab); addeddiff: 'Diff'tolanguageNames(Inkdrop has it, upstream doesn't); preserved Phase 3Children.toArray + findpatch inCodePanelwith explanatory comment.mdx.tsx(heavily customized): port of current mdx.jsx with all Inkdrop deltas — external-link wrapper using plain<a>+<ExternalIcon>, customh1wrapping<MarkdownSourceLink/>,h2/h3wrappers viaHeading,Note(emerald),Warning(orange),Row/Col/Properties/Property(Property hasrequired?flag with pink "Required" badge that upstream lacks).Phase 6f — Navigation + Layout (2026-04-27)
Navigation.tsx(365 lines): copied upstream typed skeleton, transplanted Inkdrop's fullnavigationarray (8 groups: Guides, Resources, Core Modules, App States, App Actions, Components, Event Subscription, Appendix; ~70 nav entries total), addedlink?: stringtoNavGroupinterface for Inkdrop's group-level link field on App States/Actions, preservedbg-pink-500ActivePageMarker, preserved Inkdrop top-level nav (API, User Manual, Forum), preserved Log in → my.inkdrop.app.Header.tsx: same Inkdrop top-level nav + Log in; preserved "Developers" text next to Logo for mobile.Layout.tsx: preserved "Developers" text next to Logo for desktop sidebar.MobileNavigation.tsxandSectionProvider.tsx: purecpfrom upstream (no Inkdrop deltas).Phase 6g — App files (2026-04-27)
not-found.tsxandproviders.tsx: purecpfrom upstream (identical content).layout.tsx: ported with Inkdrop title metadata ('%s - Inkdrop API Reference') and<Fathom />mount.Phase 6h — MDX pipeline to TS — deferred (2026-04-27)
Attempted full conversion of
src/mdx/*.mjsto.tsper user Decision 3. Wroterecma.ts,remark.ts,rehype.ts,search.ts(with full Inkdrop deltas:extractLabelTextAsContent,urlin vfile, h3 indexing for/guides/list-of-commands); addedmdx-annotationsandsimple-functional-loadermodule declarations totypes.d.ts; renamednext.config.mjs→next.config.ts(Node ESM cannot import.tsfiles, so the config must also be.tsfor transitive imports to work).tsc --noEmitandeslint .both passed.npm run buildfailed:Failed to load next.config.ts—ReferenceError: exports is not defined in ES module scope at next.config.compiled.js:2:23. Next 16's TS config loader compiles to CommonJS-style (exports.default = ...) but executes in ES module scope. Couldn't be quickly worked around with"type": "module"toggling without risking other regressions.Reverted: restored
next.config.mjs,src/mdx/*.mjs(all four files),types.d.tsshim for@/mdx/search.mjs, andSearch.tsximport. Result matches upstream exactly (they also keep these as.mjs).Final verify gate (post-Phase 6, 2026-04-27)
.jsxor.jsfiles insrc/,mdx-components.*, ortypography.*..ts/.tsxfiles insrc/..mjsfiles insrc/mdx/(intentional).npx tsc --noEmit✓ no output.npm run lint✓ 0 errors / 0 warnings (withreact-hooks/immutabilityre-enabled).npm run build✓ Compiled successfully; 70/70 static pages generated.Status: ready for user review before Phase 8 (final sweep).