Skip to content

Commit

Permalink
Add support for Svelte 5 (#1373)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
SeppahBaws and github-actions[bot] authored Oct 21, 2024
1 parent 449ba4c commit 45b9bb8
Show file tree
Hide file tree
Showing 98 changed files with 3,901 additions and 1,355 deletions.
4 changes: 2 additions & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "HoudiniGraphQL/houdini" }],
"commit": false,
"fixed": [["houdini*", "create-*"]],
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"updateInternalDependencies": "minor",
"ignore": ["e2e-api", "e2e-react", "e2e-kit", "e2e-svelte", "site"]
}
7 changes: 7 additions & 0 deletions .changeset/gorgeous-lions-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'houdini-plugin-svelte-global-stores': patch
'houdini-svelte': patch
'houdini': patch
---

Bump Svelte version to 5.0
7 changes: 7 additions & 0 deletions .changeset/new-comics-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'houdini-plugin-svelte-global-stores': minor
'houdini-svelte': major
'houdini': minor
---

Add support for Svelte 5 and Svelte Runes
25 changes: 25 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"mode": "exit",
"tag": "next",
"initialVersions": {
"e2e-api": "0.0.1",
"e2e-kit": "0.0.1",
"e2e-react": "0.0.0",
"e2e-svelte": "0.0.1",
"scripts": "1.0.0",
"houdini-adapter-auto": "1.2.64",
"houdini-adapter-cloudflare": "1.2.64",
"houdini-adapter-node": "1.2.64",
"houdini-adapter-static": "1.2.64",
"create-houdini": "1.2.64",
"houdini": "1.2.64",
"houdini-react": "1.2.64",
"houdini-svelte": "1.2.64",
"houdini-plugin-svelte-global-stores": "1.2.64",
"site": "0.0.1"
},
"changesets": [
"gorgeous-lions-nail",
"new-comics-happen"
]
}
6 changes: 3 additions & 3 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
branches:
- next
- error-memory-leak
- svelte-5

env:
CI: true
Expand Down Expand Up @@ -35,13 +35,13 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8

- name: Install dependencies
run: pnpm install
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Prerelease

# Trigger a prerelease on @next whenever we have a new push to the preview branch
# for more info: https://github.com/changesets/changesets/blob/main/docs/prereleases.md
on:
push:
branches:
- houdini-2.0

env:
CI: true
jobs:
publish:
name: Publish Prerelease Version
runs-on: ubuntu-22.04
steps:
- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
email=$NPM_EMAIL
name=$NPM_NAME
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
NPM_NAME: ${{ secrets.NPM_NAME }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Checkout source
uses: actions/checkout@master
with:
ref: ${{ github.ref }}

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 8

- name: Install dependencies
run: pnpm install

- name: Set Git Identity
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release Pull Request for Preview
uses: changesets/action@v1
with:
version: pnpm run version
publish: pnpm run release
title: '🚧 Prerelease Version Update'
commit: '🚧 v{VERSION}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8

- name: Install dependencies
run: pnpm install
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 21.7.3
node-version: 20.13.1

# pnpm

Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}

- run: pnpm playwright install
- run: pnpm playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'

# Run tests
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
Expand Down
33 changes: 24 additions & 9 deletions e2e/kit/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
settings: {
'svelte3/typescript': () => require('typescript')
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:svelte/recommended'
],
plugins: ['@typescript-eslint'],
ignorePatterns: ['*.cjs', '$houdini/**'],
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
Expand All @@ -21,6 +32,10 @@ module.exports = {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off'
'@typescript-eslint/no-non-null-assertion': 'off',
// Disable svelte-check, as we already have that as a separate step
'svelte/valid-compile': 'off',
// With component queries, it is valid to have e.g. props that are only used through the _QueryVariables function.
'@typescript-eslint/no-unused-vars': 'off'
}
};
41 changes: 21 additions & 20 deletions e2e/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,42 @@
"build:generate": "pnpm build: && npx houdini generate",
"build:test": "pnpm build: && pnpm test",
"build:build": "pnpm build: && pnpm build",
"package": "svelte-kit package",
"previewWeb": "vite preview --port 3007",
"preview": "concurrently \"pnpm run previewWeb\" \"pnpm run api\" -n \"web,api\" -c \"green,magenta\"",
"tests": "playwright test ",
"tests": "playwright test",
"test": "npm run tests",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "pnpm run check -- --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
"lint": "prettier --ignore-path .gitignore --check . && eslint .",
"format": "prettier --ignore-path .gitignore --write ."
},
"devDependencies": {
"@kitql/helpers": "^0.8.2",
"@playwright/test": "1.30.0",
"@sveltejs/adapter-auto": "2.0.0",
"@sveltejs/kit": "1.9.3",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"@playwright/test": "1.48.0",
"@sveltejs/adapter-auto": "^3.2.1",
"@sveltejs/kit": "^2.5.10",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"concurrently": "7.1.0",
"cross-env": "^7.0.3",
"e2e-api": "workspace:^",
"eslint": "^8.3.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-svelte3": "^4.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.39.0",
"houdini": "workspace:^",
"houdini-plugin-svelte-global-stores": "workspace:^",
"houdini-svelte": "workspace:^",
"prettier": "^2.8.3",
"prettier-plugin-svelte": "^2.9.0",
"svelte": "^3.57.0",
"svelte-check": "^3.0.1",
"svelte-preprocess": "^5.0.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.3",
"svelte": "^5.0.0",
"svelte-check": "^3.8.0",
"svelte-eslint-parser": "^0.41.1",
"svelte-preprocess": "^5.1.4",
"tslib": "^2.3.1",
"typescript": "^4.9",
"vite": "^4.1.4",
"vite-plugin-lib-reporter": "^0.0.7"
"typescript": "^5.0.0",
"vite": "^5.2.12",
"vite-plugin-lib-reporter": "^0.1.0"
},
"dependencies": {
"@sveltejs/adapter-node": "^5.0.1",
Expand Down
32 changes: 12 additions & 20 deletions e2e/kit/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
// manual switch for now until replayio is fixed (currently breaking our tests)
const with_replayio = false;
import { ReporterDescription, defineConfig } from '@playwright/test';

const use = with_replayio
? {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...replayDevices['Replay Chromium'],
screenshot: 'only-on-failure'
}
: { screenshot: 'only-on-failure' };

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const reporter = [['list']];
const reporters: ReporterDescription[] = [['list'], ['html', { open: 'never' }]];
if (process.env.CI) {
reporter.push(['html', { open: 'never' }]);
reporter.push(['github']);
reporters.push(['github']);
}

const config = {
export default defineConfig({
testMatch: 'spec.ts',
use: {
headless: true,
trace: 'on-first-retry',
screenshot: 'only-on-failure'
},
retries: process.env.CI ? 3 : 0,
workers: 5,
reporter,
use,
reporter: reporters,
webServer: {
command: 'npm run build && npm run preview',
port: 3007,
timeout: 120 * 1000
}
};

export default config;
});
2 changes: 1 addition & 1 deletion e2e/kit/src/app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
1 change: 0 additions & 1 deletion e2e/kit/src/lib/QueryComponent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
};
};
// svelte-ignore unused-export-let
export let id = '';
$: result = graphql(`
Expand Down
6 changes: 4 additions & 2 deletions e2e/kit/src/lib/QueryExt.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script lang="ts">
import { browser } from '$app/environment';
import { GQL_usersListComp } from '$houdini';
import { onMount } from 'svelte';
$: browser && GQL_usersListComp.fetch();
onMount(() => {
GQL_usersListComp.fetch();
});
</script>

<p id="QueryExt-result">
Expand Down
Loading

0 comments on commit 45b9bb8

Please sign in to comment.