Skip to content

Commit

Permalink
feat(js): upgrade to svelte v5
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimonemms committed Nov 22, 2024
1 parent 205721d commit fe60568
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 55 deletions.
3 changes: 1 addition & 2 deletions js/{{ cookiecutter.project_name }}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ coverage
.nyc_output

{%- if cookiecutter.type == "svelte" %}
.DS_Store
node_modules
/build
.vercel
/.svelte-kit
/package
.env
Expand Down
33 changes: 33 additions & 0 deletions js/{{ cookiecutter.project_name }}/svelte/.eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import prettier from 'eslint-config-prettier';
import js from '@eslint/js';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import ts from 'typescript-eslint';

export default ts.config(
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.svelte'],

languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
}
);
30 changes: 0 additions & 30 deletions js/{{ cookiecutter.project_name }}/svelte/.eslintrc.cjs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
touch build/.nojekyll
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: 'build/'

Expand All @@ -95,4 +95,4 @@ jobs:
steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
1 change: 0 additions & 1 deletion js/{{ cookiecutter.project_name }}/svelte/.npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
engine-strict=true
resolution-mode=highest
16 changes: 8 additions & 8 deletions js/{{ cookiecutter.project_name }}/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.10",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"eslint": "^8.57.0",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@types/eslint": "^9.6.0",
"eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.39.0",
"globals": "^15.0.0",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-svelte": "^3.2.3",
"svelte": "^4.2.17",
"svelte-check": "^3.7.1",
"tslib": "^2.6.2",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"typescript": "^5.4.5",
"typescript-eslint": "^8.0.0",
"vite": "^5.2.11",
"vitest": "^1.6.0"
"vitest": "^2.0.0"
},
"type": "module"
}
3 changes: 2 additions & 1 deletion js/{{ cookiecutter.project_name }}/svelte/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// 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 PageState {}
// interface Platform {}
}
}
Expand Down
21 changes: 12 additions & 9 deletions js/{{ cookiecutter.project_name }}/svelte/src/app.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<!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" />
%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" />
%sveltekit.head%
</head>

<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
8 changes: 7 additions & 1 deletion js/{{ cookiecutter.project_name }}/svelte/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": 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
//
// 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
}

0 comments on commit fe60568

Please sign in to comment.