chore(deps): re-init with latest svelte-kit

This commit is contained in:
Julian Tölle 2023-03-25 22:05:28 +01:00
parent 45e37e2038
commit db8d8e47ee
24 changed files with 553 additions and 1499 deletions

13
.eslintignore Normal file
View 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

View file

@ -1,7 +1,11 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
plugins: ["svelte3", "@typescript-eslint"],
ignorePatterns: ["*.cjs"],
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
@ -10,7 +14,7 @@ module.exports = {
},
parserOptions: {
sourceType: "module",
ecmaVersion: 2019,
ecmaVersion: 2020,
},
env: {
browser: true,

8
.gitignore vendored
View file

@ -1,6 +1,10 @@
.DS_Store
node_modules
/.svelte-kit
/build
/functions
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

View file

@ -1,4 +1,13 @@
.svelte-kit/**
static/**
build/**
node_modules/**
.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

View file

@ -1,3 +1,5 @@
{
"printWidth": 100
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

View file

@ -1,6 +1,6 @@
# 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/master/packages/create-svelte).
## Creating a project
@ -8,14 +8,12 @@ If you're seeing this, you've probably already done this step. Congrats!
```bash
# create a new project in the current directory
npm init svelte@next
npm create svelte@latest
# 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
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
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
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.

1766
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,32 +1,35 @@
{
"name": "website",
"version": "0.2.0",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build",
"preview": "svelte-kit preview",
"lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
"format": "prettier --write --plugin-search-dir=. ."
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write ."
},
"devDependencies": {
"@sveltejs/adapter-vercel": "2.4.1",
"@sveltejs/kit": "1.14.0",
"@typescript-eslint/eslint-plugin": "5.56.0",
"@typescript-eslint/parser": "5.56.0",
"autoprefixer": "10.4.14",
"cssnano": "5.1.15",
"eslint": "8.36.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-svelte3": "4.0.0",
"postcss": "8.4.21",
"postcss-load-config": "4.0.1",
"prettier": "2.8.7",
"prettier-plugin-svelte": "2.10.0",
"svelte": "3.57.0",
"svelte-preprocess": "5.0.3",
"tailwindcss": "3.2.7",
"tslib": "2.5.0",
"typescript": "5.0.2"
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-vercel": "^2.4.1",
"@sveltejs/kit": "^1.5.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"autoprefixer": "^10.4.14",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^4.0.0",
"postcss": "^8.4.21",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"svelte": "^3.54.0",
"svelte-check": "^3.0.1",
"tailwindcss": "^3.2.7",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.2.0"
},
"type": "module"
}

View file

@ -1,23 +1,6 @@
const tailwindcss = require("tailwindcss");
const autoprefixer = require("autoprefixer");
const cssnano = require("cssnano");
const mode = process.env.NODE_ENV;
const dev = mode === "development";
module.exports = {
plugins: [
// Some plugins, like postcss-nested, need to run before Tailwind
tailwindcss,
// But others, like autoprefixer, need to run after
autoprefixer,
!dev &&
cssnano({
preset: "default",
}),
],
};
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

12
src/app.d.ts vendored Normal file
View file

@ -0,0 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};

View file

@ -2,11 +2,11 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%svelte.head%
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body class="bg-gray-900">
<div id="svelte">%svelte.body%</div>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

3
src/global.d.ts vendored
View file

@ -1,3 +0,0 @@
/// <reference types="@sveltejs/kit" />
/// <reference types="svelte" />
/// <reference types="vite/client" />

View file

@ -5,7 +5,9 @@
export let mirrored: boolean = false;
</script>
<div class={`flex flex-col md:flex-row ${mirrored && "md:flex-row-reverse"} m-8`}>
<div
class={`flex flex-col md:flex-row ${mirrored && "md:flex-row-reverse"} m-8`}
>
<img src={image} alt={`Grafik vom Charakter ${name}`} class="p-4" />
<div>

View file

@ -1,5 +1,5 @@
<script>
import "../app.postcss";
import "../app.css";
import NavLink from "$lib/layout/NavLink.svelte";
</script>

View file

@ -4,15 +4,17 @@
<h1>Welcome to SvelteKit</h1>
<p>
Visit <a class="text-blue-600 underline" href="https://kit.svelte.dev">kit.svelte.dev</a> to read the
documentation
Visit <a class="text-blue-600 underline" href="https://kit.svelte.dev"
>kit.svelte.dev</a
> to read the documentation
</p>
<p id="intro">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in gravida sem. Fusce tincidunt
massa quis mauris posuere dictum. Aenean malesuada odio at congue luctus. Quisque rutrum, est at
maximus pretium, justo mi fringilla augue, vel dictum leo elit id arcu. Nullam lacus turpis,
sagittis quis egestas a, tincidunt in lectus. Cras porta libero mauris, et condimentum magna
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in gravida
sem. Fusce tincidunt massa quis mauris posuere dictum. Aenean malesuada odio
at congue luctus. Quisque rutrum, est at maximus pretium, justo mi fringilla
augue, vel dictum leo elit id arcu. Nullam lacus turpis, sagittis quis egestas
a, tincidunt in lectus. Cras porta libero mauris, et condimentum magna
venenatis id. Integer eu egestas lacus.
</p>
@ -36,10 +38,11 @@
</p>
<p id="listen">
Cras luctus commodo pharetra. Integer sollicitudin lectus non nibh congue egestas. Quisque
lobortis, magna vitae consectetur mollis, purus dui sollicitudin ligula, vel condimentum nunc
justo at tellus. Quisque ut ligula laoreet, pellentesque ligula nec, venenatis lacus. Quisque
magna nulla, mattis ac libero in, suscipit consectetur ex. Donec eget sem sollicitudin, varius
massa in, sodales neque. Vivamus fermentum tempus nunc, nec ultrices ante faucibus nec. Vivamus
vel sollicitudin velit.
Cras luctus commodo pharetra. Integer sollicitudin lectus non nibh congue
egestas. Quisque lobortis, magna vitae consectetur mollis, purus dui
sollicitudin ligula, vel condimentum nunc justo at tellus. Quisque ut ligula
laoreet, pellentesque ligula nec, venenatis lacus. Quisque magna nulla, mattis
ac libero in, suscipit consectetur ex. Donec eget sem sollicitudin, varius
massa in, sodales neque. Vivamus fermentum tempus nunc, nec ultrices ante
faucibus nec. Vivamus vel sollicitudin velit.
</p>

3
static/favicon.png Normal file
View file

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5146ed79b486cb9e1cdcdd7814cd22ae78e70ceb30fa06b4cd9a16cf121bc9e6
size 1571

View file

@ -1,20 +1,17 @@
import preprocess from "svelte-preprocess";
import vercel from "@sveltejs/adapter-vercel";
import adapter from "@sveltejs/adapter-vercel";
import { vitePreprocess } from "@sveltejs/kit/vite";
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors
preprocess: [
preprocess({
postcss: true,
}),
],
preprocess: vitePreprocess(),
kit: {
// hydrate the <div id="svelte"> element in src/app.html
target: "#svelte",
adapter: vercel(),
// 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(),
},
};

View file

@ -1,22 +1,7 @@
const { tailwindExtractor } = require("tailwindcss/lib/lib/purgeUnusedStyles");
const colors = require("tailwindcss/colors");
/** @type {import('tailwindcss').Config} */
module.exports = {
mode: "aot",
purge: {
content: ["./src/**/*.{html,js,svelte,ts}"],
options: {
defaultExtractor: (content) => [
// If this stops working, please open an issue at https://github.com/svelte-add/tailwindcss/issues rather than bothering Tailwind Labs about it
...tailwindExtractor(content),
// Match Svelte class: directives (https://github.com/tailwindlabs/tailwindcss/discussions/1731)
...[...content.matchAll(/(?:class:)*([\w\d-/:%.]+)/gm)].map(
([_match, group, ..._rest]) => group
),
],
},
safelist: [/^svelte-[\d\w]+$/],
},
theme: {
colors: {
transparent: "transparent",

View file

@ -1,30 +1,17 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"moduleResolution": "node",
"module": "es2020",
"lib": ["es2020"],
"target": "es2019",
/**
svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript
to enforce using \`import type\` instead of \`import\` for Types.
*/
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"resolveJsonModule": true,
/**
To have warnings/errors of the Svelte compiler at the correct position,
enable source maps by default.
*/
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"allowJs": true,
"checkJs": true,
"paths": {
"$lib/*": ["src/lib/*"]
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
},
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"]
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// 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
vite.config.ts Normal file
View file

@ -0,0 +1,6 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [sveltekit()],
});