Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2: Upgrade to Svelte 5 #1971

Merged
merged 4 commits into from
Nov 1, 2024
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
21 changes: 21 additions & 0 deletions svelte/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
test-results
node_modules

# Output
.output
.vercel
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

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

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
1 change: 1 addition & 0 deletions svelte/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
14 changes: 2 additions & 12 deletions svelte/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Eliza

This project was bootstrapped as a [Svelte](https://svelte.dev/) project with the command:

`npm create svelte eliza`
This project was bootstrapped as a [Svelte](https://svelte.dev/) 5 project.

All default tooling setup via the above command is used, which includes:

Expand All @@ -19,7 +17,7 @@ in action.

### `npm install`

### `npm start`
### `npm run dev`

Runs the app in development mode.

Expand Down Expand Up @@ -59,11 +57,3 @@ Runs check against files for TypeScript errors.
### `npm run check:watch`

Runs check and also watches for changes.

### `npm run lint`

Runs various lint tools (Prettier, eslint) against codebase.

## `npm run format`

Formats code via Prettier.
76 changes: 76 additions & 0 deletions svelte/e2e/demo.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { expect, test } from "@playwright/test";

test("home page has expected h1", async ({ page }) => {
await page.goto("/");
await expect(page.locator("h1")).toBeVisible();
});

test("visits the app root url", async ({ page }) => {
await page.goto("http://localhost:4173");

const title = page.locator("h1");
await expect(title).toHaveText("Eliza with Svelte");

const prompt = page.locator("p.resp-text").first();
await expect(prompt).toHaveText("What is your name?");

const statementInput = page.locator("#statement-input");
await statementInput.fill("Steve");

const sendButton = page.locator("#send-button");
await sendButton.click();

const name = page.locator("p.resp-text").nth(1);
await expect(name).toHaveText("Steve");

const response = page.locator("p.resp-text").nth(2);
await expect(response).toHaveText("Hi Steve. I'm Eliza.");
});

test("/universal-ssr", async ({ page }) => {
await page.route("https://demo.connectrpc.com/**", async (route) => {
// Prove that all API requests happen server side
await route.abort("accessdenied");
});

await page.goto("http://localhost:4173/universal-ssr");

const title = page.locator("h1");
await expect(title).toHaveText("Eliza with Svelte");

const subTitle = page.locator("h3");
await expect(subTitle).toHaveText("Universal SSR Rendered Data");

const data = page.locator(".pre-container pre");
const total = await data.count();

// Verify we show the expected 3 data items rendered via universal SSR
expect(total).toEqual(3);
await expect(data.first()).toHaveText("largeNumber: 123 (bigint)");
await expect(data.nth(1)).toHaveText("double: Infinity (number)");
await expect(data.nth(2)).toHaveText("bytes: 0,1,2 (Uint8Array)");
});

test("/server-only-ssr", async ({ page }) => {
await page.route("https://demo.connectrpc.com/**", async (route) => {
// Prove that all API requests happen server side
await route.abort("accessdenied");
});

await page.goto("http://localhost:4173/server-only-ssr");

const title = page.locator("h1");
await expect(title).toHaveText("Eliza with Svelte");

const subTitle = page.locator("h3");
await expect(subTitle).toHaveText("Server (only) Rendered Data");

const data = page.locator(".pre-container pre");
const total = await data.count();

// Verify we show the expected 3 data items rendered via universal SSR
expect(total).toEqual(3);
await expect(data.first()).toHaveText("largeNumber: 123 (bigint)");
await expect(data.nth(1)).toHaveText("double: Infinity (number)");
await expect(data.nth(2)).toHaveText("bytes: 0,1,2 (Uint8Array)");
});
65 changes: 0 additions & 65 deletions svelte/e2e/test.spec.ts

This file was deleted.

74 changes: 0 additions & 74 deletions svelte/eslint.config.mjs

This file was deleted.

Loading