Move to new Svelte release
This commit is contained in:
commit
2c87b8dde1
13
webapp/.eslintignore
Normal file
13
webapp/.eslintignore
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/build
|
||||||
|
/.svelte-kit
|
||||||
|
/package
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
# Ignore files for PNPM, NPM and YARN
|
||||||
|
pnpm-lock.yaml
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
@ -1,15 +1,31 @@
|
|||||||
|
/** @type { import("eslint").Linter.Config } */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: ['eslint:recommended', 'prettier'],
|
extends: [
|
||||||
plugins: ['svelte3'],
|
'eslint:recommended',
|
||||||
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:svelte/recommended',
|
||||||
|
'prettier'
|
||||||
|
],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
plugins: ['@typescript-eslint'],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
ecmaVersion: 2020
|
ecmaVersion: 2020,
|
||||||
|
extraFileExtensions: ['.svelte']
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
es2017: true,
|
es2017: true,
|
||||||
node: true
|
node: true
|
||||||
}
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['*.svelte'],
|
||||||
|
parser: 'svelte-eslint-parser',
|
||||||
|
parserOptions: {
|
||||||
|
parser: '@typescript-eslint/parser'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
6
webapp/.gitignore
vendored
6
webapp/.gitignore
vendored
@ -1,8 +1,10 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules
|
node_modules
|
||||||
build/
|
/build
|
||||||
/.svelte-kit
|
/.svelte-kit
|
||||||
/package
|
/package
|
||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
vite.config.js.timestamp-*
|
||||||
|
vite.config.ts.timestamp-*
|
||||||
|
|||||||
4
webapp/.prettierignore
Normal file
4
webapp/.prettierignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Ignore files for PNPM, NPM and YARN
|
||||||
|
pnpm-lock.yaml
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
@ -2,5 +2,16 @@
|
|||||||
"useTabs": true,
|
"useTabs": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"printWidth": 100
|
"printWidth": 100,
|
||||||
}
|
"plugins": [
|
||||||
|
"prettier-plugin-svelte"
|
||||||
|
],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "*.svelte",
|
||||||
|
"options": {
|
||||||
|
"parser": "svelte"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
# create-svelte
|
# create-svelte
|
||||||
|
|
||||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte);
|
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
|
||||||
|
|
||||||
## Creating a project
|
## Creating a project
|
||||||
|
|
||||||
@ -8,14 +8,12 @@ If you're seeing this, you've probably already done this step. Congrats!
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# create a new project in the current directory
|
# create a new project in the current directory
|
||||||
npm init svelte@next
|
npm create svelte@latest
|
||||||
|
|
||||||
# create a new project in my-app
|
# create a new project in my-app
|
||||||
npm init svelte@next my-app
|
npm create svelte@latest my-app
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: the `@next` is temporary
|
|
||||||
|
|
||||||
## Developing
|
## Developing
|
||||||
|
|
||||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||||
@ -29,10 +27,12 @@ npm run dev -- --open
|
|||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
Before creating a production version of your app, install an [adapter](https://kit.svelte.dev/docs#adapters) for your target environment. Then:
|
To create a production version of your app:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|
You can preview the production build with `npm run preview`.
|
||||||
|
|
||||||
|
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
||||||
|
|||||||
11506
webapp/package-lock.json
generated
11506
webapp/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,29 +1,39 @@
|
|||||||
{
|
{
|
||||||
"name": "webapp",
|
"name": "webapp",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"scripts": {
|
"private": true,
|
||||||
"dev": "svelte-kit dev",
|
"scripts": {
|
||||||
"build": "svelte-kit build",
|
"dev": "vite dev",
|
||||||
"package": "svelte-kit package",
|
"build": "vite build",
|
||||||
"preview": "svelte-kit preview",
|
"preview": "vite preview",
|
||||||
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||||
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||||
},
|
"lint": "prettier --check . && eslint .",
|
||||||
"devDependencies": {
|
"format": "prettier --write ."
|
||||||
"@sveltejs/adapter-auto": "next",
|
},
|
||||||
"@sveltejs/adapter-static": "^1.0.0-next.26",
|
"devDependencies": {
|
||||||
"@sveltejs/kit": "next",
|
"@sveltejs/adapter-static": "^3.0.1",
|
||||||
"autoprefixer": "^10.4.2",
|
"@sveltejs/kit": "^2.0.0",
|
||||||
"cssnano": "^5.0.15",
|
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||||
"eslint": "^7.32.0",
|
"@types/eslint": "^8.56.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||||
"eslint-plugin-svelte3": "^3.2.1",
|
"@typescript-eslint/parser": "^7.0.0",
|
||||||
"postcss": "^8.4.5",
|
"eslint": "^8.56.0",
|
||||||
"prettier": "^2.4.1",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"prettier-plugin-svelte": "^2.4.0",
|
"eslint-plugin-svelte": "^2.35.1",
|
||||||
"svelte": "^3.44.0",
|
"prettier": "^3.1.1",
|
||||||
"svelte-preprocess": "^4.10.1",
|
"prettier-plugin-svelte": "^3.1.2",
|
||||||
"tailwindcss": "^3.0.13"
|
"svelte": "^4.2.7",
|
||||||
},
|
"svelte-check": "^3.6.0",
|
||||||
"type": "module"
|
"tailwindcss": "^3.4.3",
|
||||||
|
"tslib": "^2.4.1",
|
||||||
|
"typescript": "^5.0.0",
|
||||||
|
"vite": "^5.0.3"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"autoprefixer": "^10.4.19",
|
||||||
|
"cssnano": "^7.0.1",
|
||||||
|
"postcss": "^8.4.38"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
webapp/src/app.d.ts
vendored
Normal file
13
webapp/src/app.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// See https://kit.svelte.dev/docs/types#app
|
||||||
|
// for information about these interfaces
|
||||||
|
declare global {
|
||||||
|
namespace App {
|
||||||
|
// interface Error {}
|
||||||
|
// interface Locals {}
|
||||||
|
// interface PageData {}
|
||||||
|
// interface PageState {}
|
||||||
|
// interface Platform {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
||||||
@ -1,13 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
<head>
|
||||||
<meta name="description" content="" />
|
<meta charset="utf-8" />
|
||||||
<link rel="icon" href="%svelte.assets%/favicon.png" />
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
%svelte.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
<div id="svelte">%svelte.body%</div>
|
<body data-sveltekit-preload-data="hover">
|
||||||
</body>
|
<div style="display: contents">%sveltekit.body%</div>
|
||||||
</html>
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
1
webapp/src/lib/index.ts
Normal file
1
webapp/src/lib/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
// place files you want to import through the `$lib` alias in this folder.
|
||||||
|
Before Width: | Height: | Size: 111 B After Width: | Height: | Size: 111 B |
16
webapp/src/lib/menu/Navbar.svelte
Normal file
16
webapp/src/lib/menu/Navbar.svelte
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
import Logo from './Logo.svelte';
|
||||||
|
import Hamburger from './Hamburger.svelte';
|
||||||
|
import Menu from './Menu.svelte';
|
||||||
|
|
||||||
|
export let sidebar = false;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<header class="flex justify-between bg-gray-200 p-2 items-center text-gray-600 border-b-2">
|
||||||
|
<nav class="flex">
|
||||||
|
<Hamburger bind:open={sidebar} />
|
||||||
|
<Logo />
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<Menu />
|
||||||
|
</header>
|
||||||
26
webapp/src/routes/+layout.svelte
Normal file
26
webapp/src/routes/+layout.svelte
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<script>
|
||||||
|
import Navbar from '$lib/menu/Navbar.svelte';
|
||||||
|
import Sidebar from '$lib/menu/Sidebar.svelte';
|
||||||
|
import '../app.css';
|
||||||
|
|
||||||
|
let open = false;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<main class="w-full h-full">
|
||||||
|
<Sidebar bind:open />
|
||||||
|
<Navbar bind:sidebar={open} />
|
||||||
|
|
||||||
|
<slot></slot>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:global(body) {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 640px) {
|
||||||
|
main {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1
webapp/src/routes/+layout.ts
Normal file
1
webapp/src/routes/+layout.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export const prerender = true;
|
||||||
4
webapp/src/routes/+page.svelte
Normal file
4
webapp/src/routes/+page.svelte
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<main class="w-full h-full">
|
||||||
|
<h1>Welcome to SvelteKit</h1>
|
||||||
|
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
|
||||||
|
</main>
|
||||||
@ -1,15 +0,0 @@
|
|||||||
<main class="p-4 text-gray-300">
|
|
||||||
<svg height="100%" width="100%">
|
|
||||||
<line x1=0 y1=4 x2=400 y2=4/>
|
|
||||||
<line x1=0 y1=34 x2=200 y2=34/>
|
|
||||||
<line x1=0 y1=64 x2=300 y2=64/>
|
|
||||||
<line x1=0 y1=94 x2=280 y2=94/>
|
|
||||||
</svg>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
svg line {
|
|
||||||
stroke: currentColor;
|
|
||||||
stroke-width: 12;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
<script>
|
|
||||||
import Navbar from "./menu/_Navbar.svelte";
|
|
||||||
import Sidebar from "./menu/_Sidebar.svelte";
|
|
||||||
import "../app.css";
|
|
||||||
|
|
||||||
let open = false;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<main class="w-full h-full">
|
|
||||||
<Sidebar bind:open/>
|
|
||||||
<Navbar bind:sidebar={open}/>
|
|
||||||
|
|
||||||
<slot></slot>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
:global(body) {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 640px) {
|
|
||||||
main {
|
|
||||||
max-width: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
<script>
|
|
||||||
import Main from "./_Main.svelte";
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<main class="w-full h-full">
|
|
||||||
<h1>Welcome to SvelteKit</h1>
|
|
||||||
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
|
|
||||||
|
|
||||||
<Main/>
|
|
||||||
</main>
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
<script>
|
|
||||||
import Logo from './_Logo.svelte';
|
|
||||||
import Hamburger from './_Hamburger.svelte';
|
|
||||||
import Menu from './_Menu.svelte';
|
|
||||||
|
|
||||||
export let sidebar = false;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<header class="flex justify-between bg-gray-200 p-2 items-center text-gray-600 border-b-2">
|
|
||||||
<nav class="flex">
|
|
||||||
<Hamburger bind:open={sidebar}/>
|
|
||||||
<Logo/>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<Menu/>
|
|
||||||
</header>
|
|
||||||
@ -1,18 +1,17 @@
|
|||||||
import adapter from "@sveltejs/adapter-static";
|
import adapter from '@sveltejs/adapter-static';
|
||||||
import preprocess from "svelte-preprocess";
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
preprocess: [
|
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
||||||
preprocess({
|
// for more information about preprocessors
|
||||||
postcss: true,
|
preprocess: vitePreprocess(),
|
||||||
}),
|
|
||||||
],
|
|
||||||
kit: {
|
|
||||||
adapter: adapter(),
|
|
||||||
|
|
||||||
// hydrate the <div id="svelte"> element in src/app.html
|
kit: {
|
||||||
target: '#svelte'
|
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||||
|
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
||||||
|
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||||
|
adapter: adapter(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
19
webapp/tsconfig.json
Normal file
19
webapp/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"extends": "./.svelte-kit/tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"checkJs": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"strict": true,
|
||||||
|
"moduleResolution": "bundler"
|
||||||
|
}
|
||||||
|
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
||||||
|
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
|
||||||
|
//
|
||||||
|
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||||
|
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||||
|
}
|
||||||
6
webapp/vite.config.ts
Normal file
6
webapp/vite.config.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [sveltekit()]
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user