Skip to content

Commit ca1ef74

Browse files
committed
[svelte] Tidy up readme
1 parent ad8c973 commit ca1ef74

File tree

3 files changed

+233
-218
lines changed

3 files changed

+233
-218
lines changed

src/cli.ts

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,55 @@ const config = {
170170
const persistSqlite = normalizedPersistenceType === 'sqlite';
171171
const persistPglite = normalizedPersistenceType === 'pglite';
172172
const needsViteConfig = react || svelte || persistSqlite || persistPglite;
173+
const appSurface =
174+
appType === 'chat'
175+
? 'chat interface'
176+
: appType === 'drawing'
177+
? 'drawing canvas'
178+
: appType === 'game'
179+
? 'game'
180+
: 'todo list';
181+
const frameworkName = react ? 'React' : vanilla ? 'Vanilla JS' : 'Svelte';
182+
const clientFrameworkDescription = react
183+
? 'React-based'
184+
: vanilla
185+
? 'vanilla JavaScript'
186+
: 'Svelte-based';
187+
const entryFileDescription = react
188+
? 'Entry point that bootstraps and renders the React app'
189+
: svelte
190+
? 'Entry point that bootstraps and mounts the Svelte app'
191+
: 'Entry point that bootstraps the app';
192+
const appFileStem = vanilla ? 'app' : 'App';
193+
const appFileExt = vanilla ? scriptExt : componentExt;
194+
const appFileDescription = react
195+
? `Main React component that renders the ${appSurface}`
196+
: vanilla
197+
? 'Main application logic'
198+
: `Main Svelte component that renders the ${appSurface}`;
199+
const primaryStoreStem = react
200+
? appType === 'chat'
201+
? 'ChatStore'
202+
: appType === 'drawing'
203+
? 'CanvasStore'
204+
: 'Store'
205+
: appType === 'chat'
206+
? 'chatStore'
207+
: appType === 'drawing'
208+
? 'canvasStore'
209+
: 'store';
210+
const primaryStoreExt = react ? componentExt : scriptExt;
211+
const primaryStoreDescription = `TinyBase ${
212+
appType === 'chat'
213+
? 'chat messages'
214+
: appType === 'drawing'
215+
? 'drawing canvas'
216+
: 'main'
217+
} store configuration`;
218+
const needsSettingsStore = appType === 'chat' || appType === 'drawing';
219+
const settingsStoreStem = react ? 'SettingsStore' : 'settingsStore';
220+
const settingsStoreExt = react ? componentExt : scriptExt;
221+
const configExt = react ? componentExt : scriptExt;
173222

174223
return {
175224
projectName,
@@ -190,6 +239,19 @@ const config = {
190239
persistSqlite,
191240
persistPglite,
192241
needsViteConfig,
242+
frameworkName,
243+
clientFrameworkDescription,
244+
entryFileDescription,
245+
appFileStem,
246+
appFileExt,
247+
appFileDescription,
248+
primaryStoreStem,
249+
primaryStoreExt,
250+
primaryStoreDescription,
251+
needsSettingsStore,
252+
settingsStoreStem,
253+
settingsStoreExt,
254+
configExt,
193255
installAndRun: installAndRun === true || installAndRun === 'true',
194256
typescript,
195257
javascript,

templates/README.md.hbs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# {{projectName}}
77

8-
A TinyBase app built with {{#if typescript}}TypeScript{{else}}JavaScript{{/if}} and {{#if react}}React{{/if}}{{#if vanilla}}Vanilla JS{{/if}}{{#if svelte}}Svelte{{/if}}.
8+
A TinyBase app built with {{#if typescript}}TypeScript{{else}}JavaScript{{/if}} and {{frameworkName}}.
99

1010
## Getting Started
1111

@@ -43,26 +43,19 @@ This project is organized into {{#if server}}two main directories{{else}}a singl
4343

4444
### Client
4545

46-
The `client` directory contains your {{#if react}}React-based{{/if}}{{#if vanilla}}vanilla JavaScript{{/if}}{{#if svelte}}Svelte-based{{/if}} web application,
46+
The `client` directory contains your {{clientFrameworkDescription}} web application,
4747
built with Vite and {{#if typescript}}TypeScript{{else}}JavaScript{{/if}}.
4848

4949
#### Key Files
5050

51-
- **`index.html`** - The main HTML file that loads your app
52-
- **`src/index.{{entryExt}}`** - Entry point that bootstraps the application{{#if react}} and renders the React component tree{{/if}}{{#if svelte}} and mounts the Svelte app{{/if}}
53-
- **`src/{{#if react}}App{{/if}}{{#if vanilla}}app{{/if}}{{#if svelte}}App{{/if}}.{{#if vanilla}}{{scriptExt}}{{else}}{{componentExt}}{{/if}}`** - {{#if react}}Main React component that renders the {{#if (eq appType "todos")}}todo list{{else if (eq appType "chat")}}chat interface{{else if (eq appType "drawing")}}drawing
54-
canvas{{else if (eq appType "game")}}game{{/if}}
55-
{{/if}}{{#if vanilla}}Main application logic{{/if}}{{#if svelte}}Main Svelte component that renders the {{#if (eq appType "todos")}}todo list{{else if (eq appType "chat")}}chat interface{{else if (eq appType "drawing")}}drawing canvas{{else if (eq appType "game")}}game{{/if}}{{/if}}
56-
-
57-
**`src/{{#if react}}{{#if (eq appType "chat")}}ChatStore{{else if (eq appType "drawing")}}CanvasStore{{else}}Store{{/if}}{{/if}}{{#if vanilla}}{{#if (eq appType "chat")}}chatStore{{else if (eq appType "drawing")}}canvasStore{{else}}store{{/if}}{{/if}}{{#if svelte}}{{#if (eq appType "chat")}}chatStore{{else if (eq appType "drawing")}}canvasStore{{else}}store{{/if}}{{/if}}.{{#if react}}{{componentExt}}{{else}}{{scriptExt}}{{/if}}`**
58-
- TinyBase {{#if (eq appType "chat")}}chat messages{{else if (eq appType "drawing")}}drawing canvas{{else}}main{{/if}} store configuration
59-
{{#if (eq appType "chat")}}
60-
- **`src/{{#if react}}SettingsStore{{/if}}{{#if vanilla}}settingsStore{{/if}}{{#if svelte}}settingsStore{{/if}}.{{#if react}}{{componentExt}}{{else}}{{scriptExt}}{{/if}}`** - TinyBase settings store (not synchronized)
51+
- **`index.html`**: The main HTML file that loads your app
52+
- **`src/index.{{entryExt}}`**: {{entryFileDescription}}
53+
- **`src/{{appFileStem}}.{{appFileExt}}`**: {{appFileDescription}}
54+
- **`src/{{primaryStoreStem}}.{{primaryStoreExt}}`**: {{primaryStoreDescription}}
55+
{{#if needsSettingsStore}}
56+
- **`src/{{settingsStoreStem}}.{{settingsStoreExt}}`**: TinyBase settings store (not synchronized)
6157
{{/if}}
62-
{{#if (eq appType "drawing")}}
63-
- **`src/{{#if react}}SettingsStore{{/if}}{{#if vanilla}}settingsStore{{/if}}{{#if svelte}}settingsStore{{/if}}.{{#if react}}{{componentExt}}{{else}}{{scriptExt}}{{/if}}`** - TinyBase settings store (not synchronized)
64-
{{/if}}
65-
- **`src/config.{{#if react}}{{componentExt}}{{else}}{{scriptExt}}{{/if}}`** - Configuration settings{{#if server}} (including server connection URL){{/if}}
58+
- **`src/config.{{configExt}}`**: Configuration settings{{#if server}} (including server connection URL){{/if}}
6659

6760
#### How It Works
6861

@@ -101,7 +94,7 @@ The app uses **TinyBase** to manage application state in a reactive data store.
10194

10295
{{/if}}
10396
{{#if react}}
104-
**React Integration** - TinyBase provides React hooks that automatically subscribe
97+
**React Integration**: TinyBase provides React hooks that automatically subscribe
10598
to store changes and trigger re-renders when data updates. This means your UI
10699
stays in sync with your data with minimal boilerplate.
107100

@@ -114,7 +107,7 @@ The app uses **TinyBase** to manage application state in a reactive data store.
114107

115108
{{/if}}
116109
{{#if svelte}}
117-
**Svelte Integration** - TinyBase provides Svelte stores and helpers that keep the
110+
**Svelte Integration**: TinyBase provides Svelte stores and helpers that keep the
118111
UI reactive as data changes. Components subscribe declaratively so the interface
119112
stays synchronized with the underlying TinyBase store.
120113

@@ -126,7 +119,7 @@ The app uses **TinyBase** to manage application state in a reactive data store.
126119

127120
#### Key Files
128121

129-
- **`index.{{ext}}`** - Server entry point
122+
- **`index.{{ext}}`**: Server entry point
130123

131124
#### How It Works
132125

0 commit comments

Comments
 (0)