Skip to content

refactor: standardize dev-playground on the app template - #541

Draft
MarioCadenas wants to merge 1 commit into
mainfrom
playground-standard
Draft

refactor: standardize dev-playground on the app template#541
MarioCadenas wants to merge 1 commit into
mainfrom
playground-standard

Conversation

@MarioCadenas

Copy link
Copy Markdown
Collaborator

What

Standardizes apps/dev-playground on the databricks apps init template layout while keeping it a monorepo-linked dogfood app. No behavior/feature changes — same plugins, routes, and demos, restructured.

Why

The playground had drifted from the template (nested client/package.json, TanStack Router, bespoke tsconfig/deploy config-swaps). Aligning it means template regressions get dogfooded, and contributors see one canonical structure.

Changes

  • Single package — fold the nested client/package.json in; adopt template tsconfig.{shared,server,client} + tsdown.server.config.ts + client vite.config; server entry → server/server.ts; pages at client/src/pages/<name>/<Name>Page.tsx.
  • Router — TanStack Router → react-router 7 (createBrowserRouter in App.tsx, RootLayout/Outlet/NavLink, route errorElement); routeTree.gen.ts removed.
  • Local SDK resolution via pnpm overrides — root pnpm.overrides pins @databricks/appkit{,-ui}workspace:*; the app's package.json keeps the template's pinned version, so the app file is byte-identical to a scaffold but installs link into packages/.
  • Client vite alias for appkit-ui — its exports development condition points at TS source that uses appkit-ui's internal @/ alias (unresolvable by an external bundler), so the client pins appkit-ui's built dist (kept fresh by build:watch; matches prod/deploy). Server/build resolve via the override alone.
  • Deploydeploy-playground.ts simplified for one package (both SDK tarballs into a single package.json; dropped the client/package.json injection + prepared-files/ config swaps). App build uses npm run for Databricks parity.
  • Pre-existing drift fixes — surfaced by the newly tsc-gated build: appkit-ui chart prop renames (curveType→smooth, showDots→showSymbol, showLabel→showLabels), AgentEvent→AgentChatEvent, framework-provided plugin cache, ChartData/e.path guards.

Deviations from the template (monorepo-justified)

Stays pnpm (not npm), lints via root oxlint (no per-app eslint), keeps postcss tailwind, keeps vite dedupe for react, and omits the typegen lifecycle hooks (would break workspace install ordering).

Testing

  • pnpm --filter=dev-playground typecheck — clean (cache-free)
  • pnpm --filter=dev-playground build (tsc + tsdown + vite) — green
  • oxlint + oxfmt --check — clean
  • Verified on a live dev server: routes render, appkit-ui resolves to dist, no transform errors.
  • Playwright E2E not run here (needs a workspace); unchanged.

Note for reviewers

pnpm -r typecheck shows a pre-existing failure in packages/appkit's own source (implicit-any + a shared/workspace-client resolution error) — independent of this PR (no packages/ files are touched; dev-playground passes within that run).

Known follow-up (not in this PR)

appkit.files is inferred by createApp as a non-callable union (FilesExport | agents registry) with this plugin set; worked around with a single Extract<> narrowing in server.ts. Looks like an appkit-side inference issue worth a real fix.

Reshape apps/dev-playground to match the `databricks apps init` template
layout while keeping it a monorepo-linked dogfood app.

- Single package: fold the nested client/package.json in; adopt the
  template tsconfig.{shared,server,client} + tsdown.server.config.ts +
  client vite.config; server entry becomes server/server.ts; pages live
  at client/src/pages/<name>/<Name>Page.tsx.
- Migrate routing from TanStack Router to react-router 7
  (createBrowserRouter in App.tsx, RootLayout/Outlet/NavLink,
  errorElement); drop routeTree.gen.ts.
- Resolve the local SDK build via root pnpm.overrides
  (@databricks/appkit{,-ui} -> workspace:*) while the app pins the
  template's published version. The client vite config aliases appkit-ui
  to its built dist because its exports `development` condition points at
  source using appkit-ui's internal @/ alias, which an external bundler
  cannot resolve.
- Simplify deploy-playground.ts for the single package (both SDK tarballs
  into one package.json; drop the client/package.json injection and the
  prepared-files config swaps).
- Fix pre-existing drift vs current appkit surfaced by the new tsc-gated
  build: appkit-ui chart prop renames, AgentEvent -> AgentChatEvent,
  framework-provided plugin cache, and ChartData/e.path guards.

Lint, format, typecheck, and build are green; verified on a live dev
server (routes render, appkit-ui resolves to dist).

Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
@MarioCadenas
MarioCadenas requested a review from a team as a code owner August 19, 2026 12:30
@github-actions

Copy link
Copy Markdown
Contributor

🤖 AppKit PR bot

🔬 Run evals

Start an eval for this PR from the evals-monitor app: Go to Evals Monitor →

📦 Try this PR's app template

Scaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh auth login — and the Databricks CLI):

gh run download 32252985324 -R databricks/appkit -n appkit-template-0.61.1-pr.94abf32-playground-standard-541 -D appkit-pr-541 \
  && unzip -o "appkit-pr-541/appkit-template-0.61.1-pr.94abf32-playground-standard-541.zip" -d "appkit-pr-541" \
  && databricks apps init --template "appkit-pr-541"

The template pins @databricks/appkit and @databricks/appkit-ui to tarballs built from this branch, so the scaffolded app runs against this PR's code.

@MarioCadenas
MarioCadenas marked this pull request as draft August 19, 2026 12:42
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