sky10: switch to pure svelte
This commit is contained in:
parent
aac908afce
commit
2a32828964
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,3 +9,4 @@ node_modules
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
pnpm-lock.yaml
|
||||
.npmrc
|
||||
|
15
Taskfile.yaml
Normal file
15
Taskfile.yaml
Normal file
@ -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
|
16
index.html
Normal file
16
index.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + Svelte</title>
|
||||
<script>
|
||||
var global = global === undefined ? window : global;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
10
package.json
10
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"
|
||||
}
|
||||
}
|
||||
|
32
src/lib/components/App.svelte
Normal file
32
src/lib/components/App.svelte
Normal file
@ -0,0 +1,32 @@
|
||||
<Beer />
|
||||
<main class="center">
|
||||
<Router {routes} />
|
||||
</main>
|
||||
|
||||
<script>
|
||||
import { genApi } from '$lib/store/api.js';
|
||||
import { setContext } from 'svelte';
|
||||
import Beer from '$lib/components/Beer.svelte';
|
||||
import Router from 'svelte-spa-router';
|
||||
import Campaigns from '$lib/components/Campaigns.svelte';
|
||||
import Campaign from '$lib/components/Campaign.svelte';
|
||||
import Battle from '$lib/components/Battle.svelte';
|
||||
|
||||
const api = genApi();
|
||||
|
||||
setContext('api', api);
|
||||
|
||||
const routes = {
|
||||
// Exact path
|
||||
'/': Campaigns,
|
||||
'/campaign/:campaignId': Campaign,
|
||||
'/campaign/:campaignId/battle/:battleId': Battle,
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
main {
|
||||
max-width: 720px;
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
8
src/main.js
Normal file
8
src/main.js
Normal file
@ -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;
|
@ -3,8 +3,8 @@ import adapter from '@sveltejs/adapter-auto';
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
kit: {
|
||||
adapter: adapter()
|
||||
}
|
||||
adapter: adapter(),
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
@ -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()],
|
||||
plugins: [svelte()],
|
||||
test: {
|
||||
include: ['src/**/*.{test,spec}.{js,ts}']
|
||||
}
|
||||
include: ['src/**/*.{test,spec}.{js,ts}'],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
$lib:
|
||||
import.meta.url.replace('file://', '').replace(/[^/]+$/, '') +
|
||||
'src/lib',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
Loading…
Reference in New Issue
Block a user