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.
Files changed (79) hide show
  1. package/README.md +62 -18
  2. package/cli.js +2 -2
  3. package/package.json +3 -3
  4. package/screenshots/chat.png +0 -0
  5. package/screenshots/todos.png +0 -0
  6. package/templates/README.md.hbs +13 -12
  7. package/templates/client/eslint.config.js.hbs +7 -0
  8. package/templates/client/package.json.hbs +28 -8
  9. package/templates/client/src/chat/App.tsx.hbs +28 -22
  10. package/templates/client/src/chat/ChatStore.tsx.hbs +108 -27
  11. package/templates/client/src/chat/Message.tsx.hbs +8 -9
  12. package/templates/client/src/chat/MessageInput.tsx.hbs +7 -7
  13. package/templates/client/src/chat/Messages.tsx.hbs +5 -15
  14. package/templates/client/src/chat/SettingsStore.tsx.hbs +86 -9
  15. package/templates/client/src/chat/UsernameInput.tsx.hbs +6 -11
  16. package/templates/client/src/chat/app.ts.hbs +18 -18
  17. package/templates/client/src/chat/chatStore.ts.hbs +97 -35
  18. package/templates/client/src/chat/message.ts.hbs +4 -3
  19. package/templates/client/src/chat/messageInput.css.hbs +1 -1
  20. package/templates/client/src/chat/messageInput.ts.hbs +7 -8
  21. package/templates/client/src/chat/messages.ts.hbs +7 -12
  22. package/templates/client/src/chat/settingsStore.ts.hbs +65 -6
  23. package/templates/client/src/chat/usernameInput.css.hbs +1 -1
  24. package/templates/client/src/chat/usernameInput.ts.hbs +6 -6
  25. package/templates/client/src/chat/utils.ts.hbs +26 -0
  26. package/templates/client/src/drawing/App.tsx.hbs +26 -20
  27. package/templates/client/src/drawing/BrushSize.tsx.hbs +8 -11
  28. package/templates/client/src/drawing/Canvas.tsx.hbs +65 -73
  29. package/templates/client/src/drawing/CanvasStore.tsx.hbs +104 -18
  30. package/templates/client/src/drawing/ColorPicker.tsx.hbs +4 -11
  31. package/templates/client/src/drawing/DrawingControls.tsx.hbs +7 -7
  32. package/templates/client/src/drawing/SettingsStore.tsx.hbs +81 -8
  33. package/templates/client/src/drawing/app.ts.hbs +18 -8
  34. package/templates/client/src/drawing/brushSize.ts.hbs +12 -5
  35. package/templates/client/src/drawing/canvas.ts.hbs +84 -86
  36. package/templates/client/src/drawing/canvasStore.ts.hbs +93 -26
  37. package/templates/client/src/drawing/colorPicker.ts.hbs +3 -3
  38. package/templates/client/src/drawing/drawingControls.ts.hbs +7 -7
  39. package/templates/client/src/drawing/settingsStore.ts.hbs +63 -8
  40. package/templates/client/src/game/App.tsx.hbs +20 -16
  41. package/templates/client/src/game/Board.tsx.hbs +8 -8
  42. package/templates/client/src/game/Game.tsx.hbs +14 -21
  43. package/templates/client/src/game/GameStatus.tsx.hbs +5 -5
  44. package/templates/client/src/game/Square.tsx.hbs +6 -11
  45. package/templates/client/src/game/Store.tsx.hbs +106 -16
  46. package/templates/client/src/game/app.ts.hbs +17 -6
  47. package/templates/client/src/game/board.ts.hbs +7 -7
  48. package/templates/client/src/game/game.ts.hbs +12 -18
  49. package/templates/client/src/game/gameStatus.ts.hbs +3 -3
  50. package/templates/client/src/game/square.ts.hbs +4 -4
  51. package/templates/client/src/game/store.ts.hbs +95 -23
  52. package/templates/client/src/index.tsx.hbs +5 -7
  53. package/templates/client/src/shared/Button.tsx.hbs +3 -3
  54. package/templates/client/src/shared/Input.tsx.hbs +2 -2
  55. package/templates/client/src/shared/Loading.tsx.hbs +5 -0
  56. package/templates/client/src/shared/button.ts.hbs +2 -2
  57. package/templates/client/src/shared/config.ts.hbs +4 -6
  58. package/templates/client/src/shared/input.ts.hbs +2 -2
  59. package/templates/client/src/shared/loading.css.hbs +21 -0
  60. package/templates/client/src/shared/loading.ts.hbs +13 -0
  61. package/templates/client/src/shared/pglite.ts.hbs +10 -0
  62. package/templates/client/src/shared/sqlite.ts.hbs +17 -0
  63. package/templates/client/src/todos/App.tsx.hbs +22 -22
  64. package/templates/client/src/todos/Store.tsx.hbs +106 -23
  65. package/templates/client/src/todos/TodoInput.tsx.hbs +6 -8
  66. package/templates/client/src/todos/TodoItem.tsx.hbs +5 -6
  67. package/templates/client/src/todos/TodoList.tsx.hbs +5 -6
  68. package/templates/client/src/todos/app.ts.hbs +16 -10
  69. package/templates/client/src/todos/store.ts.hbs +94 -30
  70. package/templates/client/src/todos/todoInput.ts.hbs +5 -8
  71. package/templates/client/src/todos/todoItem.ts.hbs +3 -4
  72. package/templates/client/src/todos/todoList.ts.hbs +6 -8
  73. package/templates/client/vite-env.d.ts.hbs +4 -0
  74. package/templates/client/vite.config.js.hbs +53 -3
  75. package/templates/server/index-do.ts.hbs +10 -14
  76. package/templates/server/index-node.ts.hbs +3 -3
  77. package/templates/server/package.json.hbs +5 -5
  78. package/templates/server/wrangler.toml.hbs +1 -1
  79. /package/templates/client/{.prettierrc.hbs → .prettierrc.json.hbs} +0 -0
@@ -1,22 +1,18 @@
1
- import {Id, IdAddedOrRemoved} from 'tinybase';
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
- onPathId(pathId: Id, addedOrRemoved: IdAddedOrRemoved) {
9
- console.info((addedOrRemoved ? 'Added' : 'Removed') + ` path ${pathId}`);
10
- }
11
-
12
- onClientId(pathId: Id, clientId: Id, addedOrRemoved: IdAddedOrRemoved) {
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.1"
26
+ "tinybase": "^7.3.2"
27
27
  {{#if (eq serverType "node")}}
28
- "ws": "^8.18.3"
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.20250828.1"
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.19.3"
42
+ "tsx": "^4.21.0"
43
43
  {{/if}}
44
44
  {{/if}}
45
45
  {{#if (eq serverType "durable-objects")}}
46
- "wrangler": "^4.33.1"
46
+ "wrangler": "^4.59.2"
47
47
  {{/if}}
48
48
  {{/list}}
49
49
  }
@@ -9,4 +9,4 @@ class_name = "TinyBaseDurableObject"
9
9
 
10
10
  [[migrations]]
11
11
  tag = "v1"
12
- new_classes = ["TinyBaseDurableObject"]
12
+ new_sqlite_classes = ["TinyBaseDurableObject"]