From 2a32828964b8f9b8496634ec6ca1ca79633402bf Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Fri, 13 Jan 2023 12:43:06 -0500 Subject: [PATCH] sky10: switch to pure svelte --- .gitignore | 1 + Taskfile.yaml | 15 +++++++++++++++ index.html | 16 ++++++++++++++++ package.json | 10 +++++++++- src/lib/components/App.svelte | 32 ++++++++++++++++++++++++++++++++ src/main.js | 8 ++++++++ svelte.config.js | 6 +++--- vite.config.js | 17 +++++++++++++---- 8 files changed, 97 insertions(+), 8 deletions(-) create mode 100644 Taskfile.yaml create mode 100644 index.html create mode 100644 src/lib/components/App.svelte create mode 100644 src/main.js diff --git a/.gitignore b/.gitignore index b8901d0..97e9358 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ node_modules vite.config.js.timestamp-* vite.config.ts.timestamp-* pnpm-lock.yaml +.npmrc diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..4bcceb1 --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,15 @@ +# https://taskfile.dev + +version: '3' + +vars: + GREETING: Hello, World! + +tasks: + build: vite build + dev: vite + test: vitest src + default: + cmds: + - echo "{{.GREETING}}" + silent: true diff --git a/index.html b/index.html new file mode 100644 index 0000000..29b7dbd --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + + + Vite + Svelte + + + +
+ + + diff --git a/package.json b/package.json index 79f1af8..a00c717 100644 --- a/package.json +++ b/package.json @@ -31,10 +31,18 @@ }, "type": "module", "dependencies": { + "@ernane/svelte-star-rating": "^1.1.2", + "@sveltejs/vite-plugin-svelte": "^2.0.2", + "@yanick/updeep-remeda": "^2.0.0", "beercss": "^3.0.4", "dexie": "^3.2.2", + "events": "^3.3.0", "fake-indexeddb": "^4.0.1", "material-dynamic-colors": "^0.1.5", - "remeda": "^1.3.0" + "pouchdb": "^8.0.0", + "pouchdb-adapter-memory": "^8.0.0", + "pouchdb-browser": "^8.0.0", + "remeda": "^1.3.0", + "svelte-spa-router": "^3.3.0" } } diff --git a/src/lib/components/App.svelte b/src/lib/components/App.svelte new file mode 100644 index 0000000..0b630f0 --- /dev/null +++ b/src/lib/components/App.svelte @@ -0,0 +1,32 @@ + +
+ +
+ + + + diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..7676196 --- /dev/null +++ b/src/main.js @@ -0,0 +1,8 @@ +//import './app.css' +import App from './lib/components/App.svelte'; + +const app = new App({ + target: document.getElementById('app'), +}); + +export default app; diff --git a/svelte.config.js b/svelte.config.js index 301e785..f6881d7 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -2,9 +2,9 @@ import adapter from '@sveltejs/adapter-auto'; /** @type {import('@sveltejs/kit').Config} */ const config = { - kit: { - adapter: adapter() - } + kit: { + adapter: adapter(), + }, }; export default config; diff --git a/vite.config.js b/vite.config.js index 652979f..5f67dfe 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,11 +1,20 @@ import { sveltekit } from '@sveltejs/kit/vite'; +import { svelte } from '@sveltejs/vite-plugin-svelte'; +console.log(import.meta); /** @type {import('vite').UserConfig} */ const config = { - plugins: [sveltekit()], - test: { - include: ['src/**/*.{test,spec}.{js,ts}'] - } + plugins: [svelte()], + test: { + include: ['src/**/*.{test,spec}.{js,ts}'], + }, + resolve: { + alias: { + $lib: + import.meta.url.replace('file://', '').replace(/[^/]+$/, '') + + 'src/lib', + }, + }, }; export default config;