@enbox/create-dapp 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enbox/create-dapp",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Create a minimal Enbox React application",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -30,6 +30,11 @@ toolchain. Production builds precache the app shell for
30
30
  later offline visits; `npm run preview` serves that built app locally. Deploy
31
31
  the generated `dist` directory on an HTTPS origin with service worker support.
32
32
 
33
+ This starter explicitly activates worker updates immediately in `src/sw.ts`.
34
+ Apps with an update prompt, such as Notesd, approve activation after pending
35
+ edits are persisted. `prepareBrowser()` waits for the current worker; it does
36
+ not choose an application's update policy.
37
+
33
38
  You can also use `bun install` and `bun run dev`. No lockfile is generated
34
39
  until your first install. Commit the resulting `package-lock.json` or `bun.lock`;
35
40
  then use `npm ci` or `bun install --frozen-lockfile` in CI. Direct dependencies
@@ -53,7 +58,7 @@ src/
53
58
  protocol.ts # typed encrypted records and validation
54
59
  store.ts # shared observations, commands, and domain defaults
55
60
  components/ # task board and its styles
56
- shared/components/
61
+ components/ # reusable UI shared by features
57
62
  ProfileCard.tsx
58
63
  main.tsx
59
64
  sw.ts
@@ -61,10 +66,14 @@ src/
61
66
 
62
67
  `createApplication` derives the protocol manifest from registered stores and
63
68
  constructs the browser connection with the configured wallet identity.
64
- `getApplication()` keeps one headless runtime for the browser lifetime.
69
+ `getApplication()` keeps one headless runtime for the page lifetime.
65
70
  `main.tsx` waits for worker control before passing that runtime to
66
71
  `EnboxProvider application={...}`. The provider initializes the borrowed runtime;
67
- the application owns its lifetime. Development module replacement disposes it.
72
+ the application owns its page lifetime. Component Fast Refresh is useful for UI
73
+ edits, but replacing a connected runtime or its store/protocol definitions is
74
+ not a supported hot-reload operation. Disconnect before changing those files,
75
+ then reload the page. Apps with document writers, such as Notesd, drain edits
76
+ as part of disconnecting.
68
77
 
69
78
  The profile card reads published profile information through `useProfile`.
70
79
  Names, images, settlement state, and image URL lifetimes belong to the SDK.
@@ -10,8 +10,8 @@
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
13
- "@enbox/browser": "0.3.84",
14
- "@enbox/react": "0.0.9",
13
+ "@enbox/browser": "0.3.85",
14
+ "@enbox/react": "0.0.10",
15
15
  "react": "19.3.0",
16
16
  "react-dom": "19.3.0"
17
17
  },
@@ -3,7 +3,7 @@ import { useEffect } from 'react';
3
3
 
4
4
  import app from '../app.json' with { type: 'json' };
5
5
  import { TaskBoard } from '../features/tasks/components/TaskBoard.js';
6
- import { ProfileCard } from '../shared/components/ProfileCard.js';
6
+ import { ProfileCard } from '../components/ProfileCard.js';
7
7
 
8
8
  export function App() {
9
9
  const connection = useEnboxConnection();
@@ -10,9 +10,7 @@ export const applicationOptions = {
10
10
 
11
11
  let application: ReturnType<typeof createApplication> | undefined;
12
12
 
13
- /** One browser-lifetime owner shared by React and application controllers. */
13
+ /** One application owner for this page, shared by React and application controllers. */
14
14
  export function getApplication() {
15
15
  return application ??= createApplication(applicationOptions);
16
16
  }
17
-
18
- if (import.meta.hot) import.meta.hot.dispose(() => { void application?.dispose(); });
@@ -36,5 +36,7 @@ if (import.meta.env.PROD) {
36
36
  });
37
37
  }
38
38
 
39
- // The current browser SDK performs automatic worker takeover.
39
+ // This starter activates updates immediately. Apps with an update prompt should
40
+ // call skipWaiting only after the user accepts and pending edits are persisted.
41
+ self.addEventListener('install', (event) => { event.waitUntil(self.skipWaiting()); });
40
42
  activatePolyfills({ onCacheCheck: () => ({ ttl: 30_000 }) });