Compare commits

...

2 Commits

Author SHA1 Message Date
ea0f71d151 fix: Update name and injectSW 2025-10-14 13:00:38 +02:00
Moritz Jörg
8f01280218 feat: Add Service Worker
It automatically generates the manifest.json and
adds the needed assets to it.
2025-10-14 13:00:38 +02:00
5 changed files with 908 additions and 245 deletions

1071
bun.lock

File diff suppressed because it is too large Load Diff

View File

@@ -8,13 +8,16 @@
"@semantic-release/git": "^10.0.1",
"@semantic-release/gitlab": "^13.2.8",
"@sentry/vite-plugin": "^4.3.0",
"@vite-pwa/assets-generator": "^1.0.1",
"@vitejs/plugin-react": "^5.0.0",
"rollup-plugin-scss": "^4.0.1",
"sass": "^1.93.0",
"semantic-release": "^24.2.9",
"semantic-release-dotnet": "^1.0.0",
"vite": "^7.1.9",
"vite-plugin-mkcert": "^1.17.8"
"vite": "^7.1.3",
"sharp": "^0.34.3",
"vite-plugin-mkcert": "^1.17.8",
"vite-plugin-pwa": "^1.0.3"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.7.2",

View File

@@ -0,0 +1,12 @@
import {
defineConfig,
minimal2023Preset as preset,
} from '@vite-pwa/assets-generator/config'
export default defineConfig({
headLinkOptions: {
preset: '2023',
},
preset,
images: ['src/Client/public/favicon.png'],
})

View File

@@ -6,9 +6,13 @@ let
port = 8000;
baseShell = import ./../../shell.nix { inherit pkgs; };
in
pkgs.mkShellNoCC {
pkgs.mkShell rec {
inputsFrom = [ baseShell ];
buildInputs = [
pkgs.stdenv.cc.cc
];
LOG_LEVEL = "verbose";
REDIS = "localhost:6379";
@@ -23,6 +27,7 @@ pkgs.mkShellNoCC {
DOCKER_BUILDKIT = 0;
# NOTE(mrtz): Needed for tilt podman compat.
# DOCKER_HOST = "unix:///run/user/1000/podman/podman.sock";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
shellHook = ''
export APP_ENV=$USER

View File

@@ -1,6 +1,7 @@
import react from "@vitejs/plugin-react"
import mkcert from "vite-plugin-mkcert"
import { sentryVitePlugin } from "@sentry/vite-plugin"
import { VitePWA } from 'vite-plugin-pwa'
import { defineConfig } from "vite"
import { resolve } from "path"
@@ -26,6 +27,61 @@ const plugins = [
],
savePath: `${certDir}/certs`,
mkcertPath: `${certDir}/mkcert`
}),
VitePWA({
strategies: 'generateSW',
// when using strategies 'injectManifest' you need to provide the srcDir
// srcDir: 'src',
// when using strategies 'injectManifest' use claims-sw.js or prompt-sw.js
// filename: 'prompt-sw.js',
registerType: 'autoUpdate',
injectRegister: 'auto',
pwaAssets: { disabled: false, config: true, htmlPreset: '2023', overrideManifestIcons: true },
manifest: {
name: 'Oceanbox Maps',
short_name: 'Maps',
theme_color: '#ffffff',
icons: [
{
src: 'pwa-64x64.png',
sizes: '64x64',
type: 'image/png',
},
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: 'maskable-icon-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
workbox: {
globPatterns: ['**/*.{js,css,html,svg,png,svg,ico}'],
cleanupOutdatedCaches: true,
maximumFileSizeToCacheInBytes: 6000000,
clientsClaim: true,
},
injectManifest: {
globPatterns: ['**/*.{js,css,html,svg,png,svg,ico}'],
maximumFileSizeToCacheInBytes: 6000000,
},
devOptions: {
enabled: true,
navigateFallback: 'src/Client/index.html',
suppressWarnings: true,
/* when using generateSW the PWA plugin will switch to classic */
type: 'module',
},
}),
!process.env.CREATE_SENTRY
? null