commit
7a51fb4014
27 changed files with 3745 additions and 0 deletions
@ -0,0 +1 @@ |
|||
*.glb filter=lfs diff=lfs merge=lfs -text |
|||
@ -0,0 +1,25 @@ |
|||
node_modules |
|||
|
|||
# Output |
|||
.output |
|||
.vercel |
|||
.netlify |
|||
.wrangler |
|||
/.svelte-kit |
|||
/build |
|||
|
|||
# OS |
|||
.DS_Store |
|||
Thumbs.db |
|||
|
|||
# Env |
|||
.env |
|||
.env.* |
|||
!.env.example |
|||
!.env.test |
|||
|
|||
# Vite |
|||
vite.config.js.timestamp-* |
|||
vite.config.ts.timestamp-* |
|||
# Playwright |
|||
test-results |
|||
@ -0,0 +1 @@ |
|||
engine-strict=true |
|||
@ -0,0 +1,9 @@ |
|||
# Package Managers |
|||
package-lock.json |
|||
pnpm-lock.yaml |
|||
yarn.lock |
|||
bun.lock |
|||
bun.lockb |
|||
|
|||
# Miscellaneous |
|||
/static/ |
|||
@ -0,0 +1,3 @@ |
|||
{ |
|||
"recommendations": ["svelte.svelte-vscode", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
# sv |
|||
|
|||
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). |
|||
|
|||
## Creating a project |
|||
|
|||
If you're seeing this, you've probably already done this step. Congrats! |
|||
|
|||
```sh |
|||
# create a new project |
|||
npx sv create my-app |
|||
``` |
|||
|
|||
To recreate this project with the same configuration: |
|||
|
|||
```sh |
|||
# recreate this project |
|||
npx sv@0.17.0 create --template minimal --types ts --add prettier eslint vitest="usages:component,unit" playwright --install npm webavatar-base |
|||
``` |
|||
|
|||
## Developing |
|||
|
|||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: |
|||
|
|||
```sh |
|||
npm run dev |
|||
|
|||
# or start the server and open the app in a new browser tab |
|||
npm run dev -- --open |
|||
``` |
|||
|
|||
## Building |
|||
|
|||
To create a production version of your app: |
|||
|
|||
```sh |
|||
npm run build |
|||
``` |
|||
|
|||
You can preview the production build with `npm run preview`. |
|||
|
|||
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. |
|||
@ -0,0 +1,41 @@ |
|||
import prettier from 'eslint-config-prettier'; |
|||
import path from 'node:path'; |
|||
import js from '@eslint/js'; |
|||
import svelte from 'eslint-plugin-svelte'; |
|||
import { defineConfig, includeIgnoreFile } from 'eslint/config'; |
|||
import globals from 'globals'; |
|||
import ts from 'typescript-eslint'; |
|||
|
|||
const gitignorePath = path.resolve(import.meta.dirname, '.gitignore'); |
|||
|
|||
export default defineConfig( |
|||
includeIgnoreFile(gitignorePath), |
|||
js.configs.recommended, |
|||
ts.configs.recommended, |
|||
svelte.configs.recommended, |
|||
prettier, |
|||
svelte.configs.prettier, |
|||
{ |
|||
languageOptions: { globals: { ...globals.browser, ...globals.node } }, |
|||
rules: { |
|||
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
|
|||
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
|||
'no-undef': 'off' |
|||
} |
|||
}, |
|||
{ |
|||
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'], |
|||
languageOptions: { |
|||
parserOptions: { |
|||
projectService: true, |
|||
extraFileExtensions: ['.svelte'], |
|||
parser: ts.parser |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
// Override or add rule settings here, such as:
|
|||
// 'svelte/button-has-type': 'error'
|
|||
rules: {} |
|||
} |
|||
); |
|||
File diff suppressed because it is too large
@ -0,0 +1,42 @@ |
|||
{ |
|||
"name": "webavatar-base", |
|||
"private": true, |
|||
"version": "0.0.1", |
|||
"type": "module", |
|||
"scripts": { |
|||
"dev": "vite dev", |
|||
"build": "vite build", |
|||
"preview": "vite preview", |
|||
"prepare": "svelte-kit sync || echo ''", |
|||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", |
|||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", |
|||
"lint": "prettier --check . && eslint .", |
|||
"format": "prettier --write .", |
|||
"test:unit": "vitest", |
|||
"test": "npm run test:unit -- --run && npm run test:e2e", |
|||
"test:e2e": "playwright install && playwright test" |
|||
}, |
|||
"devDependencies": { |
|||
"@eslint/js": "^10.0.1", |
|||
"@playwright/test": "^1.60.0", |
|||
"@sveltejs/adapter-auto": "^7.0.1", |
|||
"@sveltejs/kit": "^2.63.0", |
|||
"@sveltejs/vite-plugin-svelte": "^7.1.2", |
|||
"@types/node": "^24", |
|||
"@vitest/browser-playwright": "^4.1.8", |
|||
"eslint": "^10.4.1", |
|||
"eslint-config-prettier": "^10.1.8", |
|||
"eslint-plugin-svelte": "^3.19.0", |
|||
"globals": "^17.6.0", |
|||
"playwright": "^1.60.0", |
|||
"prettier": "^3.8.3", |
|||
"prettier-plugin-svelte": "^4.1.0", |
|||
"svelte": "^5.56.1", |
|||
"svelte-check": "^4.6.0", |
|||
"typescript": "^6.0.3", |
|||
"typescript-eslint": "^8.60.1", |
|||
"vite": "^8.0.16", |
|||
"vitest": "^4.1.8", |
|||
"vitest-browser-svelte": "^2.1.1" |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
import { defineConfig } from '@playwright/test'; |
|||
|
|||
export default defineConfig({ |
|||
webServer: { command: 'npm run build && npm run preview', port: 4173 }, |
|||
testMatch: '**/*.e2e.{ts,js}' |
|||
}); |
|||
@ -0,0 +1,11 @@ |
|||
/** @type {import("prettier").Config} */ |
|||
const config = { |
|||
useTabs: true, |
|||
singleQuote: true, |
|||
trailingComma: 'none', |
|||
printWidth: 100, |
|||
plugins: ['prettier-plugin-svelte'], |
|||
overrides: [{ files: '*.svelte', options: { parser: 'svelte' } }] |
|||
}; |
|||
|
|||
export default config; |
|||
@ -0,0 +1,13 @@ |
|||
// See https://svelte.dev/docs/kit/types#app.d.ts
|
|||
// for information about these interfaces
|
|||
declare global { |
|||
namespace App { |
|||
// interface Error {}
|
|||
// interface Locals {}
|
|||
// interface PageData {}
|
|||
// interface PageState {}
|
|||
// interface Platform {}
|
|||
} |
|||
} |
|||
|
|||
export {}; |
|||
@ -0,0 +1,12 @@ |
|||
<!doctype html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
|||
<meta name="text-scale" content="scale" /> |
|||
%sveltekit.head% |
|||
</head> |
|||
<body data-sveltekit-preload-data="hover"> |
|||
<div style="display: contents">%sveltekit.body%</div> |
|||
</body> |
|||
</html> |
|||
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1 @@ |
|||
// place files you want to import through the `$lib` alias in this folder.
|
|||
@ -0,0 +1,8 @@ |
|||
<script> |
|||
import { greet } from './greet'; |
|||
|
|||
let { host = 'SvelteKit', guest = 'Vitest' } = $props(); |
|||
</script> |
|||
|
|||
<h1>{greet(host)}</h1> |
|||
<p>{greet(guest)}</p> |
|||
@ -0,0 +1,15 @@ |
|||
import { page } from 'vitest/browser'; |
|||
import { describe, expect, it } from 'vitest'; |
|||
import { render } from 'vitest-browser-svelte'; |
|||
import Welcome from './Welcome.svelte'; |
|||
|
|||
describe('Welcome.svelte', () => { |
|||
it('renders greetings for host and guest', async () => { |
|||
render(Welcome, { host: 'SvelteKit', guest: 'Vitest' }); |
|||
|
|||
await expect |
|||
.element(page.getByRole('heading', { level: 1 })) |
|||
.toHaveTextContent('Hello, SvelteKit!'); |
|||
await expect.element(page.getByText('Hello, Vitest!')).toBeInTheDocument(); |
|||
}); |
|||
}); |
|||
@ -0,0 +1,8 @@ |
|||
import { describe, it, expect } from 'vitest'; |
|||
import { greet } from './greet'; |
|||
|
|||
describe('greet', () => { |
|||
it('returns a greeting', () => { |
|||
expect(greet('Svelte')).toBe('Hello, Svelte!'); |
|||
}); |
|||
}); |
|||
@ -0,0 +1,3 @@ |
|||
export function greet(name: string): string { |
|||
return 'Hello, ' + name + '!'; |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
<script lang="ts"> |
|||
import favicon from '$lib/assets/favicon.svg'; |
|||
|
|||
let { children } = $props(); |
|||
</script> |
|||
|
|||
<svelte:head> |
|||
<link rel="icon" href={favicon} /> |
|||
</svelte:head> |
|||
|
|||
{@render children()} |
|||
@ -0,0 +1,2 @@ |
|||
<h1>Welcome to SvelteKit</h1> |
|||
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p> |
|||
@ -0,0 +1,5 @@ |
|||
<script lang="ts"> |
|||
import { resolve } from '$app/paths'; |
|||
</script> |
|||
|
|||
<a href={resolve('/demo/playwright')}>playwright</a> |
|||
@ -0,0 +1 @@ |
|||
<h1>Playwright e2e test demo</h1> |
|||
@ -0,0 +1,6 @@ |
|||
import { expect, test } from '@playwright/test'; |
|||
|
|||
test('has expected h1', async ({ page }) => { |
|||
await page.goto('/demo/playwright'); |
|||
await expect(page.locator('h1')).toBeVisible(); |
|||
}); |
|||
@ -0,0 +1,3 @@ |
|||
# allow crawling everything by default |
|||
User-agent: * |
|||
Disallow: |
|||
@ -0,0 +1,20 @@ |
|||
{ |
|||
"extends": "./.svelte-kit/tsconfig.json", |
|||
"compilerOptions": { |
|||
"rewriteRelativeImportExtensions": true, |
|||
"allowJs": true, |
|||
"checkJs": true, |
|||
"esModuleInterop": true, |
|||
"forceConsistentCasingInFileNames": true, |
|||
"resolveJsonModule": true, |
|||
"skipLibCheck": true, |
|||
"sourceMap": true, |
|||
"strict": true, |
|||
"moduleResolution": "bundler" |
|||
} |
|||
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias |
|||
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files |
|||
// |
|||
// To make changes to top-level options such as include and exclude, we recommend extending |
|||
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
import { defineConfig } from 'vitest/config'; |
|||
import { playwright } from '@vitest/browser-playwright'; |
|||
import adapter from '@sveltejs/adapter-auto'; |
|||
import { sveltekit } from '@sveltejs/kit/vite'; |
|||
|
|||
export default defineConfig({ |
|||
plugins: [ |
|||
sveltekit({ |
|||
compilerOptions: { |
|||
// Force runes mode for the project, except for libraries. Can be removed in svelte 6.
|
|||
runes: ({ filename }) => |
|||
filename.split(/[/\\]/).includes('node_modules') ? undefined : true |
|||
}, |
|||
|
|||
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
|||
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
|||
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
|||
adapter: adapter() |
|||
}) |
|||
], |
|||
test: { |
|||
expect: { requireAssertions: true }, |
|||
projects: [ |
|||
{ |
|||
extends: './vite.config.ts', |
|||
test: { |
|||
name: 'client', |
|||
browser: { |
|||
enabled: true, |
|||
provider: playwright(), |
|||
instances: [{ browser: 'chromium', headless: true }] |
|||
}, |
|||
include: ['src/**/*.svelte.{test,spec}.{js,ts}'], |
|||
exclude: ['src/lib/server/**'] |
|||
} |
|||
}, |
|||
|
|||
{ |
|||
extends: './vite.config.ts', |
|||
test: { |
|||
name: 'server', |
|||
environment: 'node', |
|||
include: ['src/**/*.{test,spec}.{js,ts}'], |
|||
exclude: ['src/**/*.svelte.{test,spec}.{js,ts}'] |
|||
} |
|||
} |
|||
] |
|||
} |
|||
}); |
|||
Loading…
Reference in new issue