From c7c6d1e6b5409d467eeb017ab5a121800ae78672 Mon Sep 17 00:00:00 2001 From: Yuri Tatishchev Date: Mon, 13 Apr 2026 00:32:23 -0700 Subject: [PATCH] format --- .prettierignore | 6 +++++ .prettierrc | 9 +++----- .vscode/extensions.json | 6 +---- package.json | 2 +- spacetime.json | 6 ++--- spacetime.local.json | 4 ++-- spacetimedb/package.json | 34 ++++++++++++++-------------- spacetimedb/src/index.ts | 47 ++++++++++++++++++--------------------- spacetimedb/tsconfig.json | 30 ++++++++++++------------- src/app.d.ts | 14 ++++++------ src/routes/+layout.svelte | 24 ++++++++++---------- src/routes/+page.svelte | 10 ++++----- src/routes/layout.css | 2 +- svelte.config.js | 6 ++--- tsconfig.json | 5 +---- vite.config.ts | 8 +++---- wrangler.jsonc | 13 +++++------ 17 files changed, 108 insertions(+), 118 deletions(-) diff --git a/.prettierignore b/.prettierignore index 7d74fe2..39e16e7 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,3 +7,9 @@ bun.lockb # Miscellaneous /static/ + +# Cloudflare +worker-configuration.d.ts + +# SpacetimeDB generated bindings +src/lib/st-bindings/* diff --git a/.prettierrc b/.prettierrc index 6255599..8929e91 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,12 +1,9 @@ { "useTabs": true, - "singleQuote": true, - "trailingComma": "none", + "singleQuote": false, + "trailingComma": "all", "printWidth": 100, - "plugins": [ - "prettier-plugin-svelte", - "prettier-plugin-tailwindcss" - ], + "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], "tailwindStylesheet": "./src/routes/layout.css", "overrides": [ { diff --git a/.vscode/extensions.json b/.vscode/extensions.json index cdab7df..11efe25 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,3 @@ { - "recommendations": [ - "svelte.svelte-vscode", - "bradlc.vscode-tailwindcss", - "esbenp.prettier-vscode" - ] + "recommendations": ["svelte.svelte-vscode", "bradlc.vscode-tailwindcss", "esbenp.prettier-vscode"] } diff --git a/package.json b/package.json index 3561d01..29d936f 100644 --- a/package.json +++ b/package.json @@ -37,4 +37,4 @@ "vite-plugin-devtools-json": "^1.0.0", "wrangler": "^4.81.1" } -} \ No newline at end of file +} diff --git a/spacetime.json b/spacetime.json index 14681d9..552f131 100644 --- a/spacetime.json +++ b/spacetime.json @@ -1,4 +1,4 @@ { - "module-path": "./spacetimedb", - "server": "maincloud" -} \ No newline at end of file + "module-path": "./spacetimedb", + "server": "maincloud" +} diff --git a/spacetime.local.json b/spacetime.local.json index 4518195..b5a5d60 100644 --- a/spacetime.local.json +++ b/spacetime.local.json @@ -1,3 +1,3 @@ { - "database": "space-stream-b8trs" -} \ No newline at end of file + "database": "space-stream-b8trs" +} diff --git a/spacetimedb/package.json b/spacetimedb/package.json index c677ade..d2213dd 100644 --- a/spacetimedb/package.json +++ b/spacetimedb/package.json @@ -1,18 +1,18 @@ { - "name": "space-stream", - "version": "1.0.0", - "description": "", - "scripts": { - "build": "spacetime build", - "publish": "spacetime publish" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "spacetimedb": "^2.1.0" - }, - "devDependencies": { - "typescript": "~5.6.2" - } -} \ No newline at end of file + "name": "space-stream", + "version": "1.0.0", + "description": "", + "scripts": { + "build": "spacetime build", + "publish": "spacetime publish" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "spacetimedb": "^2.1.0" + }, + "devDependencies": { + "typescript": "~5.6.2" + } +} diff --git a/spacetimedb/src/index.ts b/spacetimedb/src/index.ts index ac6004b..f3238d4 100644 --- a/spacetimedb/src/index.ts +++ b/spacetimedb/src/index.ts @@ -1,37 +1,34 @@ -import { schema, table, t } from 'spacetimedb/server'; +import { schema, table, t } from "spacetimedb/server"; const spacetimedb = schema({ - person: table( - { public: true }, - { - name: t.string(), - } - ), + person: table( + { public: true }, + { + name: t.string(), + }, + ), }); export default spacetimedb; -export const init = spacetimedb.init(_ctx => { - // Called when the module is initially published +export const init = spacetimedb.init((_ctx) => { + // Called when the module is initially published }); -export const onConnect = spacetimedb.clientConnected(_ctx => { - // Called every time a new client connects +export const onConnect = spacetimedb.clientConnected((_ctx) => { + // Called every time a new client connects }); -export const onDisconnect = spacetimedb.clientDisconnected(_ctx => { - // Called every time a client disconnects +export const onDisconnect = spacetimedb.clientDisconnected((_ctx) => { + // Called every time a client disconnects }); -export const add = spacetimedb.reducer( - { name: t.string() }, - (ctx, { name }) => { - ctx.db.person.insert({ name }); - } -); - -export const sayHello = spacetimedb.reducer(ctx => { - for (const person of ctx.db.person.iter()) { - console.info(`Hello, ${person.name}!`); - } - console.info('Hello, World!'); +export const add = spacetimedb.reducer({ name: t.string() }, (ctx, { name }) => { + ctx.db.person.insert({ name }); +}); + +export const sayHello = spacetimedb.reducer((ctx) => { + for (const person of ctx.db.person.iter()) { + console.info(`Hello, ${person.name}!`); + } + console.info("Hello, World!"); }); diff --git a/spacetimedb/tsconfig.json b/spacetimedb/tsconfig.json index b6f79b9..524168f 100644 --- a/spacetimedb/tsconfig.json +++ b/spacetimedb/tsconfig.json @@ -4,20 +4,20 @@ * some options are required by SpacetimeDB. */ { - "compilerOptions": { - "strict": true, - "skipLibCheck": true, - "moduleResolution": "bundler", - "jsx": "react-jsx", + "compilerOptions": { + "strict": true, + "skipLibCheck": true, + "moduleResolution": "bundler", + "jsx": "react-jsx", - /* The following options are required by SpacetimeDB - * and should not be modified - */ - "target": "ESNext", - "lib": ["ES2021", "dom"], - "module": "ESNext", - "isolatedModules": true, - "noEmit": true - }, - "include": ["./**/*"] + /* The following options are required by SpacetimeDB + * and should not be modified + */ + "target": "ESNext", + "lib": ["ES2021", "dom"], + "module": "ESNext", + "isolatedModules": true, + "noEmit": true + }, + "include": ["./**/*"] } diff --git a/src/app.d.ts b/src/app.d.ts index 1d8cb5b..3329955 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -2,12 +2,12 @@ // for information about these interfaces declare global { namespace App { - interface Platform { - env: Env; - cf: CfProperties; - ctx: ExecutionContext; - } - } + interface Platform { + env: Env; + cf: CfProperties; + ctx: ExecutionContext; + } + } } -export {}; \ No newline at end of file +export {}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index ebf364a..cf60de3 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,31 +1,31 @@ @@ -27,7 +27,7 @@
Status: - {$conn.isActive ? 'Connected' : 'Disconnected'} + {$conn.isActive ? "Connected" : "Disconnected"}
diff --git a/src/routes/layout.css b/src/routes/layout.css index d4b5078..f1d8c73 100644 --- a/src/routes/layout.css +++ b/src/routes/layout.css @@ -1 +1 @@ -@import 'tailwindcss'; +@import "tailwindcss"; diff --git a/svelte.config.js b/svelte.config.js index 734728c..057c6d4 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -6,8 +6,8 @@ const config = { // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. // If your environment is not supported, or you settled on a specific environment, switch out the adapter. // See https://svelte.dev/docs/kit/adapters for more information about adapters. - adapter: adapter() - } + adapter: adapter(), + }, }; -export default config; \ No newline at end of file +export default config; diff --git a/tsconfig.json b/tsconfig.json index 367abfa..57ccebd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,10 +11,7 @@ "sourceMap": true, "strict": true, "moduleResolution": "bundler", - "types": [ - "./src/worker-configuration.d.ts", - "node" - ] + "types": ["./src/worker-configuration.d.ts", "node"] } // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files diff --git a/vite.config.ts b/vite.config.ts index 16d8608..230cc30 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,6 @@ -import devtoolsJson from 'vite-plugin-devtools-json'; -import tailwindcss from '@tailwindcss/vite'; -import { sveltekit } from '@sveltejs/kit/vite'; -import { defineConfig } from 'vite'; +import devtoolsJson from "vite-plugin-devtools-json"; +import tailwindcss from "@tailwindcss/vite"; +import { sveltekit } from "@sveltejs/kit/vite"; +import { defineConfig } from "vite"; export default defineConfig({ plugins: [tailwindcss(), sveltekit(), devtoolsJson()] }); diff --git a/wrangler.jsonc b/wrangler.jsonc index a2171d1..32cb4c3 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -7,18 +7,15 @@ "name": "space-stream", "main": ".svelte-kit/cloudflare/_worker.js", "compatibility_date": "2026-04-11", - "compatibility_flags": [ - "nodejs_compat", - "nodejs_als" - ], + "compatibility_flags": ["nodejs_compat", "nodejs_als"], "assets": { "binding": "ASSETS", - "directory": ".svelte-kit/cloudflare" + "directory": ".svelte-kit/cloudflare", }, "observability": { - "enabled": true + "enabled": true, }, - "upload_source_maps": true + "upload_source_maps": true, /** * Smart Placement * https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement @@ -42,4 +39,4 @@ * https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings */ // "services": [ { "binding": "MY_SERVICE", "service": "my-service" } ] -} \ No newline at end of file +}