@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
package/template/README.md
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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.
|
|
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.
|
package/template/package.json
CHANGED
package/template/src/app/App.tsx
CHANGED
|
@@ -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 '../
|
|
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
|
|
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(); });
|
package/template/src/sw.ts
CHANGED
|
@@ -36,5 +36,7 @@ if (import.meta.env.PROD) {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
//
|
|
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 }) });
|
|
File without changes
|