From b43af95cf87cd346354d2675e626250f2ea7090e Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Tue, 3 Sep 2024 12:11:14 +0200 Subject: [PATCH] Dependency upgrades --- .eslintignore | 14 - .eslintrc.cjs | 33 -- eslint.config.js | 33 ++ package.json | 23 +- ....30.4.patch => @sveltejs+kit+2.5.25.patch} | 4 +- src/routes/+layout.svelte | 2 +- src/routes/+page.svelte | 2 +- src/routes/Control.svelte | 2 +- src/routes/FirmwareUpdater.svelte | 21 +- src/routes/Settings.svelte | 2 +- src/routes/Status.svelte | 2 +- src/routes/api/+page.svelte | 2 +- tests/test.ts | 7 +- tsconfig.json | 1 + vite.config.ts | 12 +- yarn.lock | 360 ++++++++---------- 16 files changed, 244 insertions(+), 276 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.cjs create mode 100644 eslint.config.js rename patches/{@sveltejs+kit+1.30.4.patch => @sveltejs+kit+2.5.25.patch} (90%) diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index a42df6d..0000000 --- a/.eslintignore +++ /dev/null @@ -1,14 +0,0 @@ -.DS_Store -node_modules -/build -/.svelte-kit -/package -.env -.env.* -!.env.example -dist -build_gz -# Ignore files for PNPM, NPM and YARN -pnpm-lock.yaml -package-lock.json -yarn.lock diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 1105b14..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = { - root: true, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:svelte/recommended', - 'prettier' - ], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - parserOptions: { - sourceType: 'module', - ecmaVersion: 2020, - extraFileExtensions: ['.svelte'] - }, - env: { - browser: true, - es2017: true, - node: true - }, - rules: { - 'no-empty': ['error', { allowEmptyCatch: true }] - }, - overrides: [ - { - files: ['*.svelte'], - parser: 'svelte-eslint-parser', - parserOptions: { - parser: '@typescript-eslint/parser' - } - } - ] -}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..62dbd03 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,33 @@ +import js from '@eslint/js'; +import ts from 'typescript-eslint'; +import svelte from 'eslint-plugin-svelte'; +import prettier from 'eslint-config-prettier'; +import globals from 'globals'; + +/** @type {import('eslint').Linter.Config[]} */ +export default [ + 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/'] + } +]; diff --git a/package.json b/package.json index b09337b..b84537e 100644 --- a/package.json +++ b/package.json @@ -17,27 +17,28 @@ }, "devDependencies": { "@rollup/plugin-json": "^6.0.1", - "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/adapter-static": "^2.0.3", - "@sveltejs/kit": "^1.27.4", + "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/adapter-static": "^3.0.0", + "@sveltejs/kit": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.1", "@testing-library/svelte": "^5.2.1", "@types/swagger-ui": "^3.52.4", "@typescript-eslint/eslint-plugin": "^8.4.0", "@typescript-eslint/parser": "^8.4.0", "@vitest/ui": "^0.34.6", - "eslint": "^8.28.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-svelte": "^2.30.0", + "eslint": "^9.0.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-svelte": "^2.36.0", "jsdom": "^25.0.0", - "prettier": "^3.0.0", - "prettier-plugin-svelte": "^3.0.0", + "prettier": "^3.1.1", + "prettier-plugin-svelte": "^3.1.2", "sass": "^1.69.5", - "svelte": "^4.0.5", + "svelte": "^4.2.7", "svelte-check": "^3.6.0", "svelte-preprocess": "^5.1.1", "tslib": "^2.4.1", - "typescript": "^5.0.0", + "typescript": "^5.5.4", + "typescript-eslint": "^8.0.0", "vite": "^5.4.2", "vitest": "^2.0.5", "vitest-github-actions-reporter": "^0.11.0" @@ -49,13 +50,13 @@ "@fontsource/ubuntu": "^5.0.8", "@noble/secp256k1": "^2.1.0", "@playwright/test": "^1.46.0", + "@sveltestrap/sveltestrap": "^6.2.7", "@testing-library/jest-dom": "^6.5.0", "bootstrap": "^5.3.2", "bootstrap-icons": "^1.11.3", "nostr-tools": "^2.7.1", "patch-package": "^8.0.0", "svelte-i18n": "^4.0.0", - "sveltestrap": "^5.11.2", "swagger-ui": "^5.10.0" }, "resolutions": { diff --git a/patches/@sveltejs+kit+1.30.4.patch b/patches/@sveltejs+kit+2.5.25.patch similarity index 90% rename from patches/@sveltejs+kit+1.30.4.patch rename to patches/@sveltejs+kit+2.5.25.patch index a008413..190b51f 100644 --- a/patches/@sveltejs+kit+1.30.4.patch +++ b/patches/@sveltejs+kit+2.5.25.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/@sveltejs/kit/src/exports/vite/index.js b/node_modules/@sveltejs/kit/src/exports/vite/index.js -index a7a886d..d3433b5 100644 +index 2280025..cfbcfa9 100644 --- a/node_modules/@sveltejs/kit/src/exports/vite/index.js +++ b/node_modules/@sveltejs/kit/src/exports/vite/index.js -@@ -561,9 +561,9 @@ function kit({ svelte_config }) { +@@ -621,9 +621,9 @@ async function kit({ svelte_config }) { input, output: { format: 'esm', diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index ac940e7..ef187a5 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -10,7 +10,7 @@ NavLink, Navbar, NavbarBrand - } from 'sveltestrap'; + } from '@sveltestrap/sveltestrap'; import { page } from '$app/stores'; import { locale, locales, isLoading } from 'svelte-i18n'; diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index af0fc9e..4100d86 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -2,7 +2,7 @@ import { PUBLIC_BASE_URL } from '$lib/config'; import { screenSize, updateScreenSize } from '$lib/screen'; - import { Container, Row, Toast, ToastBody } from 'sveltestrap'; + import { Container, Row, Toast, ToastBody } from '@sveltestrap/sveltestrap'; import { onMount } from 'svelte'; import { writable } from 'svelte/store'; diff --git a/src/routes/Control.svelte b/src/routes/Control.svelte index 9874b11..b62c7ed 100644 --- a/src/routes/Control.svelte +++ b/src/routes/Control.svelte @@ -14,7 +14,7 @@ Input, Label, Row - } from 'sveltestrap'; + } from '@sveltestrap/sveltestrap'; import FirmwareUpdater from './FirmwareUpdater.svelte'; import { uiSettings } from '$lib/uiSettings'; diff --git a/src/routes/FirmwareUpdater.svelte b/src/routes/FirmwareUpdater.svelte index 74839a3..6c64667 100644 --- a/src/routes/FirmwareUpdater.svelte +++ b/src/routes/FirmwareUpdater.svelte @@ -3,7 +3,7 @@ import { onMount } from 'svelte'; import { _ } from 'svelte-i18n'; import { writable } from 'svelte/store'; - import { Progress, Alert, Button } from 'sveltestrap'; + import { Progress, Alert, Button } from '@sveltestrap/sveltestrap'; export let settings = { hwRev: '' }; @@ -112,12 +112,17 @@ const response = await fetch( 'https://api.github.com/repos/btclock/btclock_v3/releases/latest' ); - const data = await response.json(); - latestVersion = data.tag_name; - releaseDate = new Date(data.created_at).toLocaleString(); - releaseUrl = data.html_url; - isNewerVersionAvailable = compareVersions(latestVersion, currentVersion) === 1; + if (!response.ok) { + latestVersion = 'error'; + } else { + const data = await response.json(); + latestVersion = data.tag_name; + releaseDate = new Date(data.created_at).toLocaleString(); + releaseUrl = data.html_url; + + isNewerVersionAvailable = compareVersions(latestVersion, currentVersion) === 1; + } } catch (error) { console.error('Error fetching latest version:', error); } @@ -141,7 +146,7 @@ } -{#if latestVersion} +{#if latestVersion && latestVersion != 'error'}

{$_('section.firmwareUpdater.latestVersion')}: {latestVersion} - {$_( 'section.firmwareUpdater.releaseDate' @@ -153,6 +158,8 @@ {$_('section.firmwareUpdater.swUpToDate')} {/if}

+{:else if latestVersion == 'error'} +

Error loading version, try again later.

{:else}

Loading...

{/if} diff --git a/src/routes/Settings.svelte b/src/routes/Settings.svelte index a607883..87d1866 100644 --- a/src/routes/Settings.svelte +++ b/src/routes/Settings.svelte @@ -19,7 +19,7 @@ InputGroupText, Label, Row - } from 'sveltestrap'; + } from '@sveltestrap/sveltestrap'; import EyeIcon from '../icons/EyeIcon.svelte'; import EyeSlashIcon from '../icons/EyeSlashIcon.svelte'; diff --git a/src/routes/Status.svelte b/src/routes/Status.svelte index b34f33b..42d2041 100644 --- a/src/routes/Status.svelte +++ b/src/routes/Status.svelte @@ -15,7 +15,7 @@ Progress, Tooltip, Row - } from 'sveltestrap'; + } from '@sveltestrap/sveltestrap'; import Rendered from './Rendered.svelte'; export let settings; diff --git a/src/routes/api/+page.svelte b/src/routes/api/+page.svelte index 70ef4b3..05286b2 100644 --- a/src/routes/api/+page.svelte +++ b/src/routes/api/+page.svelte @@ -1,5 +1,5 @@