Skip to content

Commit 47b3ab8

Browse files
committed
feat(hub-ui): mount the real Git devframe in the playground
Replaces the two hand-rolled static "Alpha"/"Beta" devframes with the real `@devframes/plugin-git` dashboard - the playground now shows this very checkout's actual commit history, branches, and status instead of placeholder pages. `@devframes/plugin-git` is the one built-in plugin that doesn't itself depend on `@devframes/vite` - every other plugin does, and mounting one of those here would reintroduce the cyclic workspace dependency `hub-plugin.ts` already avoids by hand-rolling its hub middleware, just one hop further out.
1 parent dabe215 commit 47b3ab8

7 files changed

Lines changed: 26 additions & 114 deletions

File tree

‎packages/hub-ui/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"build:node": "tsdown",
3535
"build:embedded": "vite build --config vite.embedded.config.ts",
3636
"build:standalone": "vite build --config src/client/standalone/vite.config.ts",
37-
"dev": "pnpm -C ../.. exec turbo run build --filter=@devframes/hub... && vite --config playground/vite.config.ts",
37+
"dev": "pnpm -C ../.. exec turbo run build --filter=@devframes/hub... --filter=@devframes/plugin-git... && vite --config playground/vite.config.ts",
3838
"typecheck": "tsc --noEmit",
3939
"prepack": "pnpm build",
4040
"storybook": "storybook dev -p 6014",
@@ -49,6 +49,7 @@
4949
"@antfu/design": "catalog:frontend",
5050
"@devframes/hub": "workspace:*",
5151
"@devframes/json-render": "workspace:*",
52+
"@devframes/plugin-git": "workspace:*",
5253
"@iconify-json/ph": "catalog:frontend",
5354
"@storybook/addon-docs": "catalog:storybook",
5455
"@storybook/vue3-vite": "catalog:storybook",

‎packages/hub-ui/playground/devframes.ts‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

‎packages/hub-ui/playground/devframes/alpha/index.html‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎packages/hub-ui/playground/devframes/beta/index.html‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎packages/hub-ui/playground/hub-plugin.ts‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@ import type { HubInstance } from '@devframes/hub/initiate'
22
import type { Plugin, ViteDevServer } from 'vite'
33
import { Server as NodeHttpServer } from 'node:http'
44
import { DEVFRAMES_HUB_BASE, initHub } from '@devframes/hub/initiate'
5+
import gitDevframe from '@devframes/plugin-git'
56
import { PLAYGROUND_GROUP_ID } from './constants'
6-
import { playgroundAlphaDevframe, playgroundBetaDevframe } from './devframes'
77
import { seedPlayground } from './seed'
88

99
/**
1010
* Mounts a bare, headless hub instance as Vite dev-server middleware — just
1111
* enough backend for `main.ts`'s `DockStandalone`/`DockEmbedded` to connect
12-
* to (RPC, WebSocket, `__connection.json`), plus two tiny static devframes
13-
* (`devframes.ts`) so the dock bar has real mounted content to switch
14-
* between, not just the client-only entries `seed.ts` registers. No `ui`
15-
* slot, no renderer manifest: this playground is developing hub-ui itself,
16-
* not exercising the wider hub protocol (`examples/hub-vite` already does
17-
* that).
12+
* to (RPC, WebSocket, `__connection.json`), plus a real mounted devframe (the
13+
* Git dashboard, below) so the dock bar has real content to switch between,
14+
* not just the client-only entries `seed.ts` registers. No `ui` slot, no
15+
* renderer manifest: this playground is developing hub-ui itself, not
16+
* exercising the wider hub protocol (`examples/hub-vite` already does that).
1817
*
1918
* A hand-rolled slice of `@devframes/vite/hub` rather than that package
2019
* itself — pulling it in here would make `@devframes/hub-ui` and
2120
* `@devframes/vite` depend on each other (`@devframes/vite` already carries
2221
* an optional peer dependency on `@devframes/hub-ui` for its own default UI
2322
* slot), a cyclic workspace dependency for no real benefit.
23+
*
24+
* `@devframes/plugin-git` is the one built-in plugin that doesn't itself
25+
* depend on `@devframes/vite` (every other plugin does, for its own
26+
* dev-spa/build tooling) — mounting any of those here would reintroduce the
27+
* same cyclic dependency `@devframes/vite/hub` avoids, just one hop further
28+
* out (hub-ui → that plugin → `@devframes/vite` → hub-ui again, via its peer
29+
* dependency).
2430
*/
2531
export function hubUiPlaygroundHub(): Plugin {
2632
let instance: HubInstance | undefined
@@ -56,10 +62,12 @@ export function hubUiPlaygroundHub(): Plugin {
5662
server: httpServer,
5763
...(httpServer ? {} : { ws: { sidecar: true } }),
5864
// Collapsed under the "Playground Tools" group `seed.ts`'s
59-
// `configure` registers below, alongside the "Ping" action.
65+
// `configure` registers below, alongside the "Ping" action. Read-only
66+
// (`write` stays unset) — this is a throwaway dev loop, not somewhere
67+
// to stage/commit from. Inspects this very checkout: `cwd` above is
68+
// this package's own directory.
6069
devframes: [
61-
{ devframe: playgroundAlphaDevframe, dock: { groupId: PLAYGROUND_GROUP_ID } },
62-
{ devframe: playgroundBetaDevframe, dock: { groupId: PLAYGROUND_GROUP_ID } },
70+
{ devframe: gitDevframe, dock: { groupId: PLAYGROUND_GROUP_ID } },
6371
],
6472
configure: seedPlayground,
6573
})

‎packages/hub-ui/playground/seed.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const unrenderedDockEntry: PlaygroundUnrenderedDockEntry = {
2828
}
2929

3030
/**
31-
* The dock-bar button collapsing the Alpha/Beta devframes (grouped by
32-
* `hub-plugin.ts`'s `devframes` entries) and the "Ping" action below —
31+
* The dock-bar button collapsing the Git devframe (grouped by
32+
* `hub-plugin.ts`'s `devframes` entry) and the "Ping" action below —
3333
* exercises the grouped-dock UI (`DockGroupButton`/`DockGroupPopover`) the
3434
* playground otherwise never touches.
3535
*/
@@ -46,7 +46,7 @@ const playgroundGroup: DevframeViewGroup = {
4646
/**
4747
* A one-shot action dock — no panel of its own, just a client script
4848
* (`client-scripts/ping-action.ts`) the viewer imports and runs on click.
49-
* Grouped alongside the Alpha/Beta devframes above.
49+
* Grouped alongside the Git devframe above.
5050
*/
5151
const pingAction: DevframeViewAction = {
5252
type: 'action',

‎pnpm-lock.yaml‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)