You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0eb12f4
Browse filesBrowse the repository at this point in the historyBrowse files
feat(hub-ui-onboard): short-circuit when installed, dim the pill, add hide for now
When every named package is already in node_modules, onInstalled runs on
the first request and the button never shows. The pill is smaller and sits
at 25% opacity until hovered or open. The panel offers "Hide for now" for
the browser tab next to "Disable entirely".
Copy file name to clipboardExpand all lines: docs/content/1.guide/18.hub-initiate.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ if (!onboarding.disabled)
85
85
injectScript(onboarding.scriptSrc)
86
86
```
87
87
88
-
Install runs the project's package manager (detected from the lockfile) with the configured `packages` only; the request body controls nothing, and a cross-origin `POST` is refused. The button polls `status` once a second and, when `onInstalled` returned a handler, loads the real `embedded.js` and removes itself. Without a handler it asks the user to restart. Disable writes `<stateDir>/hub-ui-onboard.json` (default `node_modules/.devframe`); the host reads `onboarding.disabled` on the next start and injects nothing. Mount the onboarding only when the user did not set the host's own devtools option, so an explicit `devtools: true` or `false` in the host configuration always wins. [`examples/hub-onboard-vite`](https://github.com/devframes/devframe/tree/main/examples/hub-onboard-vite) shows the whole flow on Vite.
88
+
Install runs the project's package manager (detected from the lockfile) with the configured `packages` only; the request body controls nothing, and a cross-origin `POST` is refused. The button polls `status` once a second and, when `onInstalled` returned a handler, loads the real `embedded.js` and removes itself. Without a handler it asks the user to restart. When every named package is already in `node_modules`, `onboarding.installed` is `true`, `onInstalled` runs on the first request, and the button never shows. The panel has two ways out: "Hide for now" hides the button for the browser tab (`sessionStorage`), and "Disable entirely" writes `<stateDir>/hub-ui-onboard.json` (default `node_modules/.devframe`) so the host reads `onboarding.disabled` on the next start and injects nothing. Mount the onboarding only when the user did not set the host's own devtools option, so an explicit `devtools: true` or `false` in the host configuration always wins. [`examples/hub-onboard-vite`](https://github.com/devframes/devframe/tree/main/examples/hub-onboard-vite) shows the whole flow on Vite.
Copy file name to clipboardExpand all lines: docs/content/6.errors/DF9003.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
---
2
2
title: 'DF9003: onInstalled Threw'
3
-
description: '`onInstalled` threw after the packages were installed.'
3
+
description: '`onInstalled` threw after the packages were installed: {reason}'
4
4
---
5
5
6
6
## Message
7
7
8
-
> `onInstalled` threw after the packages were installed.
8
+
> `onInstalled` threw after the packages were installed: `{reason}`
9
9
10
10
## Cause
11
11
12
-
The packages are installed. The host's `onInstalled` callback, which usually imports the new packages and starts the hub, threw. The original error is attached as `cause`.
12
+
The packages are installed. The host's `onInstalled` callback, which usually imports the new packages and starts the hub, threw. `{reason}` is its message; the original error is attached as `cause`.
Copy file name to clipboardExpand all lines: examples/hub-onboard-vite/README.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,15 +9,18 @@ pnpm --filter hub-onboard-vite dev
9
9
Open the printed URL. The button at the bottom left opens a panel with two actions:
10
10
11
11
- Install runs `pnpm add -D @devframes/hub @devframes/hub-ui @devframes/plugin-git` in this directory. When it finishes, the host starts the real hub on `/__devframes/` in the same process and the button swaps itself for the floating dock.
12
-
- Disable writes `node_modules/.devframe/hub-ui-onboard.json`. The host reads `onboarding.disabled` on the next start and injects no script.
12
+
- Hide for now hides the button for this browser tab.
13
+
- Disable entirely writes `node_modules/.devframe/hub-ui-onboard.json`. The host reads `onboarding.disabled` on the next start and injects no script.
14
+
15
+
When the three packages are already installed, the button never shows: the host's `onInstalled` runs on the first request and the real dock appears directly.
13
16
14
17
Install changes this example's `package.json` and the lockfile. Run `git checkout -- examples/hub-onboard-vite pnpm-lock.yaml` and delete the state file to reset the demo.
15
18
16
19
## How it works
17
20
18
21
[`vite.config.ts`](./vite.config.ts) holds the whole integration:
-`server.middlewares.use(onboarding.nodeMiddleware)` serves `/__devframes/embedded.js` and the `/__devframes/__onboard/*` routes.
22
25
-`transformIndexHtml` injects `<script type="module" src="/__devframes/embedded.js">` unless the user disabled it earlier.
23
26
-`onInstalled` resolves the new packages from the project root, calls `initHub` with Vite's HTTP server, and returns `hub.handler`. From then on every request under the base goes to the hub.
0 commit comments