create-tinybase 0.2.4 → 0.3.0
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/README.md +62 -18
- package/cli.js +2 -2
- package/package.json +3 -3
- package/screenshots/chat.png +0 -0
- package/screenshots/todos.png +0 -0
- package/templates/README.md.hbs +13 -12
- package/templates/client/eslint.config.js.hbs +7 -0
- package/templates/client/package.json.hbs +28 -8
- package/templates/client/src/chat/App.tsx.hbs +28 -22
- package/templates/client/src/chat/ChatStore.tsx.hbs +108 -27
- package/templates/client/src/chat/Message.tsx.hbs +8 -9
- package/templates/client/src/chat/MessageInput.tsx.hbs +7 -7
- package/templates/client/src/chat/Messages.tsx.hbs +5 -15
- package/templates/client/src/chat/SettingsStore.tsx.hbs +86 -9
- package/templates/client/src/chat/UsernameInput.tsx.hbs +6 -11
- package/templates/client/src/chat/app.ts.hbs +18 -18
- package/templates/client/src/chat/chatStore.ts.hbs +97 -35
- package/templates/client/src/chat/message.ts.hbs +4 -3
- package/templates/client/src/chat/messageInput.css.hbs +1 -1
- package/templates/client/src/chat/messageInput.ts.hbs +7 -8
- package/templates/client/src/chat/messages.ts.hbs +7 -12
- package/templates/client/src/chat/settingsStore.ts.hbs +65 -6
- package/templates/client/src/chat/usernameInput.css.hbs +1 -1
- package/templates/client/src/chat/usernameInput.ts.hbs +6 -6
- package/templates/client/src/chat/utils.ts.hbs +26 -0
- package/templates/client/src/drawing/App.tsx.hbs +26 -20
- package/templates/client/src/drawing/BrushSize.tsx.hbs +8 -11
- package/templates/client/src/drawing/Canvas.tsx.hbs +65 -73
- package/templates/client/src/drawing/CanvasStore.tsx.hbs +104 -18
- package/templates/client/src/drawing/ColorPicker.tsx.hbs +4 -11
- package/templates/client/src/drawing/DrawingControls.tsx.hbs +7 -7
- package/templates/client/src/drawing/SettingsStore.tsx.hbs +81 -8
- package/templates/client/src/drawing/app.ts.hbs +18 -8
- package/templates/client/src/drawing/brushSize.ts.hbs +12 -5
- package/templates/client/src/drawing/canvas.ts.hbs +84 -86
- package/templates/client/src/drawing/canvasStore.ts.hbs +93 -26
- package/templates/client/src/drawing/colorPicker.ts.hbs +3 -3
- package/templates/client/src/drawing/drawingControls.ts.hbs +7 -7
- package/templates/client/src/drawing/settingsStore.ts.hbs +63 -8
- package/templates/client/src/game/App.tsx.hbs +20 -16
- package/templates/client/src/game/Board.tsx.hbs +8 -8
- package/templates/client/src/game/Game.tsx.hbs +14 -21
- package/templates/client/src/game/GameStatus.tsx.hbs +5 -5
- package/templates/client/src/game/Square.tsx.hbs +6 -11
- package/templates/client/src/game/Store.tsx.hbs +106 -16
- package/templates/client/src/game/app.ts.hbs +17 -6
- package/templates/client/src/game/board.ts.hbs +7 -7
- package/templates/client/src/game/game.ts.hbs +12 -18
- package/templates/client/src/game/gameStatus.ts.hbs +3 -3
- package/templates/client/src/game/square.ts.hbs +4 -4
- package/templates/client/src/game/store.ts.hbs +95 -23
- package/templates/client/src/index.tsx.hbs +5 -7
- package/templates/client/src/shared/Button.tsx.hbs +3 -3
- package/templates/client/src/shared/Input.tsx.hbs +2 -2
- package/templates/client/src/shared/Loading.tsx.hbs +5 -0
- package/templates/client/src/shared/button.ts.hbs +2 -2
- package/templates/client/src/shared/config.ts.hbs +4 -6
- package/templates/client/src/shared/input.ts.hbs +2 -2
- package/templates/client/src/shared/loading.css.hbs +21 -0
- package/templates/client/src/shared/loading.ts.hbs +13 -0
- package/templates/client/src/shared/pglite.ts.hbs +10 -0
- package/templates/client/src/shared/sqlite.ts.hbs +17 -0
- package/templates/client/src/todos/App.tsx.hbs +22 -22
- package/templates/client/src/todos/Store.tsx.hbs +106 -23
- package/templates/client/src/todos/TodoInput.tsx.hbs +6 -8
- package/templates/client/src/todos/TodoItem.tsx.hbs +5 -6
- package/templates/client/src/todos/TodoList.tsx.hbs +5 -6
- package/templates/client/src/todos/app.ts.hbs +16 -10
- package/templates/client/src/todos/store.ts.hbs +94 -30
- package/templates/client/src/todos/todoInput.ts.hbs +5 -8
- package/templates/client/src/todos/todoItem.ts.hbs +3 -4
- package/templates/client/src/todos/todoList.ts.hbs +6 -8
- package/templates/client/vite-env.d.ts.hbs +4 -0
- package/templates/client/vite.config.js.hbs +53 -3
- package/templates/server/index-do.ts.hbs +10 -14
- package/templates/server/index-node.ts.hbs +3 -3
- package/templates/server/package.json.hbs +5 -5
- package/templates/server/wrangler.toml.hbs +1 -1
- /package/templates/client/{.prettierrc.hbs → .prettierrc.json.hbs} +0 -0
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
getWsServerDurableObjectFetch,
|
|
4
|
-
WsServerDurableObject,
|
|
5
|
-
} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
1
|
+
{{addImport "import {createMergeableStore} from 'tinybase';"}}
|
|
2
|
+
{{addImport "import {createDurableObjectSqlStoragePersister} from 'tinybase/persisters/persister-durable-object-sql-storage';"}}
|
|
3
|
+
{{addImport "import {getWsServerDurableObjectFetch, WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';"}}
|
|
6
4
|
|
|
7
5
|
export class TinyBaseDurableObject extends WsServerDurableObject {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
console.info(
|
|
14
|
-
(addedOrRemoved ? 'Added' : 'Removed') +
|
|
15
|
-
` client ${clientId} on path ${pathId}`,
|
|
6
|
+
createPersister() {
|
|
7
|
+
const store = createMergeableStore();
|
|
8
|
+
const persister = createDurableObjectSqlStoragePersister(
|
|
9
|
+
store,
|
|
10
|
+
this.ctx.storage.sql,
|
|
16
11
|
);
|
|
12
|
+
return persister;
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
15
|
|
|
20
16
|
export default {
|
|
21
17
|
fetch: getWsServerDurableObjectFetch('TinyBaseDurableObjects'),
|
|
22
|
-
};
|
|
18
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
|
|
2
|
-
import {WebSocketServer} from 'ws';
|
|
1
|
+
{{addImport "import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';"}}
|
|
2
|
+
{{addImport "import {WebSocketServer} from 'ws';"}}
|
|
3
3
|
|
|
4
4
|
const PORT = 8043;
|
|
5
5
|
|
|
6
6
|
const wsServer = createWsServer(new WebSocketServer({port: PORT}));
|
|
7
7
|
|
|
8
|
-
console.log(`WebSocket server running on ws://localhost:${PORT}`);
|
|
8
|
+
console.log(`WebSocket server running on ws://localhost:${PORT}`);
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
{{#list}}
|
|
26
|
-
"tinybase": "^7.3.
|
|
26
|
+
"tinybase": "^7.3.2"
|
|
27
27
|
{{#if (eq serverType "node")}}
|
|
28
|
-
"ws": "^8.
|
|
28
|
+
"ws": "^8.19.0"
|
|
29
29
|
{{/if}}
|
|
30
30
|
{{/list}}
|
|
31
31
|
},
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
{{#if (eq serverType "node")}}
|
|
35
35
|
"@types/ws": "^8.18.1"
|
|
36
36
|
{{else}}
|
|
37
|
-
"@cloudflare/workers-types": "^4.
|
|
37
|
+
"@cloudflare/workers-types": "^4.20260120.0"
|
|
38
38
|
{{/if}}
|
|
39
39
|
{{#if typescript}}
|
|
40
40
|
"typescript": "^5.9.3"
|
|
41
41
|
{{#if (eq serverType "node")}}
|
|
42
|
-
"tsx": "^4.
|
|
42
|
+
"tsx": "^4.21.0"
|
|
43
43
|
{{/if}}
|
|
44
44
|
{{/if}}
|
|
45
45
|
{{#if (eq serverType "durable-objects")}}
|
|
46
|
-
"wrangler": "^4.
|
|
46
|
+
"wrangler": "^4.59.2"
|
|
47
47
|
{{/if}}
|
|
48
48
|
{{/list}}
|
|
49
49
|
}
|
|
File without changes
|