diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-05-11 23:42:35 +0200 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-05-12 02:20:50 +0200 |
commit | 8b5b3dd00cc16c351670a25933f4b37a604abaf8 (patch) | |
tree | aa5b32286ed880440c697e3b7cb251d74ad30029 /client |
Diffstat (limited to 'client')
-rw-r--r-- | client/.gitignore | 23 | ||||
-rw-r--r-- | client/index.html | 12 | ||||
-rw-r--r-- | client/package.json | 27 | ||||
-rw-r--r-- | client/src/App.svelte | 33 | ||||
-rw-r--r-- | client/src/main.ts | 9 | ||||
-rw-r--r-- | client/src/pages/Home.svelte | 3 | ||||
-rw-r--r-- | client/src/style.css | 1 | ||||
-rw-r--r-- | client/src/vite-env.d.ts | 2 | ||||
-rw-r--r-- | client/svelte.config.js | 8 | ||||
-rw-r--r-- | client/tailwind.config.ts | 4 | ||||
-rw-r--r-- | client/tsconfig.app.json | 20 | ||||
-rw-r--r-- | client/tsconfig.json | 7 | ||||
-rw-r--r-- | client/tsconfig.node.json | 25 | ||||
-rw-r--r-- | client/vite.config.ts | 10 |
14 files changed, 184 insertions, 0 deletions
diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000..7cc02db --- /dev/null +++ b/client/.gitignore @@ -0,0 +1,23 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/client/index.html b/client/index.html new file mode 100644 index 0000000..9073fad --- /dev/null +++ b/client/index.html @@ -0,0 +1,12 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>Vite + Svelte + TS</title> + </head> + <body> + <div id="app"></div> + <script type="module" src="/src/main.ts"></script> + </body> +</html> diff --git a/client/package.json b/client/package.json new file mode 100644 index 0000000..5343ae4 --- /dev/null +++ b/client/package.json @@ -0,0 +1,27 @@ +{ + "name": "todo-client", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-check --tsconfig ./tsconfig.app.json && tsc -p tsconfig.node.json" + }, + "devDependencies": { + "@sveltejs/vite-plugin-svelte": "^5.0.3", + "@tsconfig/svelte": "^5.0.4", + "svelte": "^5.28.1", + "svelte-check": "^4.1.6", + "typescript": "~5.8.3", + "vite": "^6.3.5" + }, + "dependencies": { + "@tailwindcss/vite": "^4.1.6", + "@types/page": "^1.11.9", + "page": "1.3.7", + "tailwindcss": "^4.1.6", + "todo-protocol": "workspace:*" + } +} diff --git a/client/src/App.svelte b/client/src/App.svelte new file mode 100644 index 0000000..488312f --- /dev/null +++ b/client/src/App.svelte @@ -0,0 +1,33 @@ +<script lang="ts">
+ import page from "page";
+ import { onMount } from "svelte";
+ import type { Component, ComponentProps } from "svelte";
+ import Home from "./pages/Home.svelte";
+
+ let CurrentPage: Component<any> | null = $state(null);
+ let currentPageProps: any = $state({});
+
+ function bindComponent<T extends Component<any>>(
+ component: T,
+ props: ComponentProps<T>,
+ ) {
+ CurrentPage = component;
+ currentPageProps = props;
+ }
+
+ onMount(() => {
+ page("/", () => {
+ bindComponent(Home, {});
+ });
+
+ page.start();
+ });
+</script>
+
+<main>
+ {#if CurrentPage}
+ <CurrentPage {...currentPageProps}></CurrentPage>
+ {:else}
+ <p>No page bound</p>
+ {/if}
+</main>
diff --git a/client/src/main.ts b/client/src/main.ts new file mode 100644 index 0000000..aa59c8a --- /dev/null +++ b/client/src/main.ts @@ -0,0 +1,9 @@ +import { mount } from "svelte"; +import App from "./App.svelte"; +import "./style.css"; + +const app = mount(App, { + target: document.getElementById('app')!, +}) + +export default app diff --git a/client/src/pages/Home.svelte b/client/src/pages/Home.svelte new file mode 100644 index 0000000..2ac8c1a --- /dev/null +++ b/client/src/pages/Home.svelte @@ -0,0 +1,3 @@ +<main> + <p>Hello, world!</p> +</main> diff --git a/client/src/style.css b/client/src/style.css new file mode 100644 index 0000000..a461c50 --- /dev/null +++ b/client/src/style.css @@ -0,0 +1 @@ +@import "tailwindcss";
\ No newline at end of file diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts new file mode 100644 index 0000000..4078e74 --- /dev/null +++ b/client/src/vite-env.d.ts @@ -0,0 +1,2 @@ +/// <reference types="svelte" /> +/// <reference types="vite/client" /> diff --git a/client/svelte.config.js b/client/svelte.config.js new file mode 100644 index 0000000..09db9ff --- /dev/null +++ b/client/svelte.config.js @@ -0,0 +1,8 @@ +import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; + +export default { + preprocess: vitePreprocess(), + compilerOptions: { + warningFilter: (warning) => !warning.code.startsWith("css_unused_selector") + } +} diff --git a/client/tailwind.config.ts b/client/tailwind.config.ts new file mode 100644 index 0000000..1f2a064 --- /dev/null +++ b/client/tailwind.config.ts @@ -0,0 +1,4 @@ +import type { Config } from "tailwindcss";
+
+export default {
+} as Config;
\ No newline at end of file diff --git a/client/tsconfig.app.json b/client/tsconfig.app.json new file mode 100644 index 0000000..55a2f9b --- /dev/null +++ b/client/tsconfig.app.json @@ -0,0 +1,20 @@ +{ + "extends": "@tsconfig/svelte/tsconfig.json", + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "resolveJsonModule": true, + /** + * Typecheck JS in `.svelte` and `.js` files by default. + * Disable checkJs if you'd like to use dynamic types in JS. + * Note that setting allowJs false does not prevent the use + * of JS in `.svelte` files. + */ + "allowJs": true, + "checkJs": true, + "isolatedModules": true, + "moduleDetection": "force" + }, + "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.svelte"] +} diff --git a/client/tsconfig.json b/client/tsconfig.json new file mode 100644 index 0000000..1ffef60 --- /dev/null +++ b/client/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/client/tsconfig.node.json b/client/tsconfig.node.json new file mode 100644 index 0000000..9728af2 --- /dev/null +++ b/client/tsconfig.node.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/client/vite.config.ts b/client/vite.config.ts new file mode 100644 index 0000000..da139ed --- /dev/null +++ b/client/vite.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from "vite"; +import { svelte } from "@sveltejs/vite-plugin-svelte"; +import tailwindcss from "@tailwindcss/vite"; + +export default defineConfig({ + plugins: [ + svelte(), + tailwindcss(), + ], +}) |