Remove any configuration relative to sw.js
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Alessio Davoli 2023-07-19 17:17:32 +02:00
parent 4a98e88639
commit bb53698682
5 changed files with 14 additions and 2369 deletions

View file

@ -17,7 +17,6 @@
"@sveltejs/kit": "^1.22.3",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@vite-pwa/sveltekit": "^0.2.5",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte": "^2.30.0",
@ -27,8 +26,7 @@
"svelte-check": "^3.4.6",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.4.4",
"vite-plugin-pwa": "^0.16.4"
"vite": "^4.4.4"
},
"type": "module",
"dependencies": {

View file

@ -1,75 +0,0 @@
<script lang="ts">
import { useRegisterSW } from 'virtual:pwa-register/svelte'
const {
needRefresh,
updateServiceWorker,
offlineReady
} = useRegisterSW({
onRegistered(r) {
// uncomment following code if you want check for updates
// r && setInterval(() => {
// console.log('Checking for sw update')
// r.update()
// }, 20000 /* 20s for testing purposes */)
console.log(`SW Registered: ${r}`)
},
onRegisterError(error) {
console.log('SW registration error', error)
},
})
const close = () => {
offlineReady.set(false)
needRefresh.set(false)
}
$: toast = $offlineReady || $needRefresh
</script>
{#if toast}
<div class="pwa-toast" role="alert">
<div class="message">
{#if $offlineReady}
<span>
App ready to work offline
</span>
{:else}
<span>
New content available, click on reload button to update.
</span>
{/if}
</div>
{#if $needRefresh}
<button on:click={() => updateServiceWorker(true)}>
Reload
</button>
{/if}
<button on:click={close}>
Close
</button>
</div>
{/if}
<style>
.pwa-toast {
position: fixed;
right: 0;
bottom: 0;
margin: 16px;
padding: 12px;
border: 1px solid #8885;
border-radius: 4px;
z-index: 2;
text-align: left;
box-shadow: 3px 4px 5px 0 #8885;
background-color: white;
}
.pwa-toast .message {
margin-bottom: 8px;
}
.pwa-toast button {
border: 1px solid #8885;
outline: none;
margin-right: 5px;
border-radius: 2px;
padding: 3px 10px;
}
</style>

View file

@ -1,24 +1,5 @@
<script>
import { pwaInfo } from 'virtual:pwa-info';
import { onMount } from 'svelte'
import BottomAppBar from '$lib/components/BottomAppBar.svelte';
$: webManifestLink = pwaInfo ? pwaInfo.webManifest.linkTag : ''
onMount(async () => {
if (pwaInfo) {
const { registerSW } = await import('virtual:pwa-register')
registerSW({
immediate: true,
onRegistered(r) {
console.log(`SW Registered: ${r}`)
console.log(JSON.stringify(r));
},
onRegisterError(error) {
console.log('SW registration error', error)
}
})
}
})
</script>
<slot></slot>
@ -26,14 +7,6 @@
<BottomAppBar />
</footer>
{#await import('$lib/ReloadPrompt.svelte') then { default: ReloadPrompt}}
<ReloadPrompt />
{/await}
<svelte:head>
{@html webManifestLink}
</svelte:head>
<style>
footer {
background: white;

View file

@ -1,37 +1,9 @@
import { sveltekit } from "@sveltejs/kit/vite";
import adapter from "@sveltejs/adapter-node";
import { SvelteKitPWA } from '@vite-pwa/sveltekit'
const config = {
plugins: [
sveltekit(),
SvelteKitPWA({
workbox: {
globPatterns: ['**/*.{js,ts,css,html}'],
},
manifest: {
start_url: '/',
background_color: "#213c8b",
theme_color: "#de0e1b",
lang: 'it',
name: "PianelloExperience",
display: "fullscreen",
short_name: "PianelloExperience",
description: "Pianello Experience",
icons: [
{
src: "/images/app-icon-512x512.png",
sizes: "512x512",
type: "image/png",
},
{
src: "/images/app-icon-192x192.png",
sizes: "192x192",
type: "image/png",
},
],
},
})
],
test: {
include: ["src/**/*.{test,spec}.{js,ts}"],

File diff suppressed because it is too large Load diff