Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ jobs:
- run: npm install -g --force corepack@latest
- run: corepack enable
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: pnpm run lint
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- run: corepack enable
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- run: pnpm test
- run: pnpm run test
13 changes: 0 additions & 13 deletions apps/demo/.eslintignore

This file was deleted.

31 changes: 0 additions & 31 deletions apps/demo/.eslintrc.cjs

This file was deleted.

21 changes: 17 additions & 4 deletions apps/demo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
.DS_Store
test-results
node_modules
/build

# Output
.output
.vercel
.netlify
.wrangler
/.svelte-kit
/package
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
/test-results
1 change: 1 addition & 0 deletions apps/demo/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
15 changes: 4 additions & 11 deletions apps/demo/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock
bun.lock
bun.lockb
20 changes: 13 additions & 7 deletions apps/demo/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"useTabs": false,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
38 changes: 38 additions & 0 deletions apps/demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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!

```bash
# create a new project in the current directory
npx sv create

# create a new project in my-app
npx sv create my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
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:

```bash
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.
33 changes: 33 additions & 0 deletions apps/demo/e2e/demo.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { expect, test } from '@playwright/test';

test('tags work', async ({ page }) => {
await page.goto('http://localhost:4173/playground/tags');

expect(await page.content()).toContain('Addition');
expect(await page.content()).toContain('Multiply');
expect(await page.content()).toContain('Types');
});

test('tags work with types', async ({ page }) => {
await page.goto('http://localhost:4173/playground/tags');

expect(await page.content()).toContain('Types');
expect(await page.content()).toContain('<b>lorem ipsum</b> is typeof <b>string</b>');
expect(await page.content()).toContain('<b>123</b> is typeof <b>number</b>');
expect(await page.content()).toContain('<b>true</b> is typeof <b>boolean</b>');
});

test('partials work', async ({ page }) => {
await page.goto('http://localhost:4173/playground/partials');

expect(await page.content()).toContain('I am a partial.');
expect(await page.content()).toContain('I am a nested partial.');
expect(await page.content()).toContain('I am passed to a variable.');
});

test('named layouts work', async ({ page }) => {
await page.goto('http://localhost:4173/playground/layout');

expect(await page.content()).toContain('I am on an alternative layout');
expect(await page.content()).toContain('And it works!');
});
37 changes: 37 additions & 0 deletions apps/demo/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import prettier from 'eslint-config-prettier';
import js from '@eslint/js';
import { includeIgnoreFile } from '@eslint/compat';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import { fileURLToPath } from 'node:url';
import ts from 'typescript-eslint';
import svelteConfig from './svelte.config.js';

const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));

export default ts.config(
includeIgnoreFile(gitignorePath),
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs.recommended,
prettier,
...svelte.configs.prettier,
{
languageOptions: {
globals: { ...globals.browser, ...globals.node }
},
rules: { 'no-undef': 'off' }
},
{
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
ignores: ['eslint.config.js', 'svelte.config.js'],
languageOptions: {
parserOptions: {
projectService: true,
extraFileExtensions: ['.svelte'],
parser: ts.parser,
svelteConfig
}
}
}
);
75 changes: 39 additions & 36 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
{
"name": "demo",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"test": "playwright install --with-deps && playwright test",
"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 ."
},
"devDependencies": {
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-cloudflare": "^4.4.0",
"@sveltejs/kit": "catalog:default",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "catalog:default",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"prettier": "catalog:default",
"prettier-plugin-svelte": "^3.0.3",
"svelte": "catalog:default",
"svelte-check": "^3.6.2",
"svelte-markdoc-preprocess": "workspace:*",
"tslib": "^2.4.1",
"typescript": "^5.5.2",
"vite": "^5.0.0"
},
"type": "module",
"dependencies": {
"highlight.js": "^11.8.0"
}
"name": "demo-5",
"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",
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"test:e2e": "playwright install --with-deps && playwright test",
"test": "npm run test:e2e"
},
"devDependencies": {
"@eslint/compat": "^1.2.7",
"@eslint/js": "^9.23.0",
"@playwright/test": "^1.51.1",
"@sveltejs/adapter-auto": "^5.0.0",
"@sveltejs/kit": "^2.20.2",
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"eslint": "^9.23.0",
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-svelte": "^3.4.1",
"globals": "^16.0.0",
"prettier": "^3.5.3",
"prettier-plugin-svelte": "^3.3.3",
"svelte": "^5.25.5",
"svelte-check": "^4.1.5",
"svelte-markdoc-preprocess": "workspace:*",
"typescript": "^5.8.2",
"typescript-eslint": "^8.29.0",
"vite": "^6.2.4"
},
"dependencies": {
"highlight.js": "^11.11.1"
}
}
19 changes: 8 additions & 11 deletions apps/demo/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import type { PlaywrightTestConfig } from '@playwright/test';
import { defineConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run build && npm run preview',
port: 4173,
},
testDir: 'tests',
testMatch: /(.+\.)?(test|spec)\.[jt]s/,
};

export default config;
export default defineConfig({
webServer: {
command: 'npm run build && npm run preview',
port: 4173
},
testDir: 'e2e'
});
15 changes: 8 additions & 7 deletions apps/demo/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// See https://kit.svelte.dev/docs/types#app
// 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 Platform {}
}
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
26 changes: 13 additions & 13 deletions apps/demo/src/app.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
<link
rel="stylesheet"
href="https://assets.ubuntu.com/v1/vanilla-framework-version-4.2.0.min.css"
/>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://assets.ubuntu.com/v1/vanilla-framework-version-4.2.0.min.css"
/>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
6 changes: 3 additions & 3 deletions apps/demo/src/lib/Nodes.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script context="module">
export { default as Heading } from './nodes/Heading.svelte';
export { default as Fence } from './nodes/Fence.svelte';
<script module>
export { default as Heading } from './nodes/Heading.svelte';
export { default as Fence } from './nodes/Fence.svelte';
</script>
Loading