Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ _Pvt_Extensions
.paket/paket.exe
paket-files/

dev-dist

# FAKE - F# Make
.fake/

Expand Down
1 change: 0 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="initial-scale=1, width=device-width" />
<meta name="theme-color" content="#000000" />
<!-- Fonts to support Material Design -->
Expand Down
8 changes: 7 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@types/sass": "^1.45.0",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vite-pwa/assets-generator": "^0.2.4",
"@vitejs/plugin-react": "^4.3.1",
"eclint": "^2.8.1",
"eslint": "^8.57.0",
Expand All @@ -63,6 +64,11 @@
"stylelint-prettier": "^5.0.0",
"stylelint-scss": "^6.3.2",
"typescript": "^5.2.2",
"vite": "^5.3.1"
"vite": "^5.3.1",
"vite-plugin-pwa": "^0.20.0"
},
"resolutions": {
"sharp": "0.32.6",
"sharp-ico": "0.1.5"
}
}
12 changes: 12 additions & 0 deletions frontend/pwa-assets.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {
defineConfig,
minimal2023Preset as preset,
} from "@vite-pwa/assets-generator/config";

export default defineConfig({
headLinkOptions: {
preset: "2023",
},
preset,
images: ["public/vite.svg"],
});
1 change: 1 addition & 0 deletions frontend/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-pwa/react" />

declare const __ENV__: string;
declare const __API_URL__: string;
Expand Down
2 changes: 1 addition & 1 deletion frontend/tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["src", "vite.config.ts"],
"include": ["src", "vite.config.ts", "pwa-assets.config.ts"],
"exclude": ["node_modules"]
}
34 changes: 33 additions & 1 deletion frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
import { defineConfig, loadEnv } from "vite";
import { VitePWA } from "vite-plugin-pwa";
import react from "@vitejs/plugin-react";
import path from "path";

export default ({ mode }: { mode: string }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };

return defineConfig({
plugins: [react()],
plugins: [
react(),
VitePWA({
registerType: "autoUpdate",
injectRegister: false,

pwaAssets: {
disabled: false,
config: true,
},

manifest: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Que penses tu de sortir le manifest dans son propre file?

name: "react-template-demo",
short_name: "react-template-demo",
description: "Nventive React Template Demo",
theme_color: "#ffffff",
},

workbox: {
globPatterns: ["**/*.{js,css,html,svg,png,ico}"],
cleanupOutdatedCaches: true,
clientsClaim: true,
},

devOptions: {
enabled: true,
navigateFallback: "index.html",
suppressWarnings: true,
type: "module",
},
}),
],
css: {
preprocessorOptions: {
scss: {
Expand Down
Loading