Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/vite pwa #43

Merged
merged 4 commits into from
Mar 29, 2022
Merged
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
Empty file added apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/favicon.ico">
<link rel="manifest" href="/manifest.json">
<title>Basegun</title>
<meta name="description" content="Basegun">
<link rel="alternate icon" href="/favicon.ico" type="image/png" sizes="16x16">
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180">
<link rel="mask-icon" href="/pwa-512x512.png" color="#FFFFFF">
<meta name="theme-color" content="#000091">
</head>
<body>
<noscript>
Expand Down
14,765 changes: 5,920 additions & 8,845 deletions frontend/package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
"@vue/compat": "^3.1.0",
"axios": "^0.21.4",
"bootstrap": "^5.1.0",
"register-service-worker": "^1.7.2",
"vite": "^2.5.4",
"vue": "^3.1.0",
"vue-router": "^4.0.5",
"vuex": "^3.6.2",
"vuex-persistedstate": "^4.0.0"
},
"devDependencies": {
"@vue/cli-plugin-pwa": "^4.5.15",
"eslint": "^8.10.0",
"eslint-plugin-vue": "^8.5.0"
"eslint-plugin-vue": "^8.5.0",
"vite-plugin-pwa": "^0.11.13"
},
"eslintConfig": {
"root": true,
Expand Down
Binary file added frontend/public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed frontend/public/img/icons/apple-touch-icon.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed frontend/public/img/icons/favicon-16x16.png
Binary file not shown.
Binary file removed frontend/public/img/icons/favicon-32x32.png
Binary file not shown.
Binary file removed frontend/public/img/icons/favicon.ico
Binary file not shown.
Binary file not shown.
Binary file removed frontend/public/img/icons/mstile-150x150.png
Binary file not shown.
3 changes: 0 additions & 3 deletions frontend/public/img/icons/safari-pinned-tab.svg

This file was deleted.

83 changes: 0 additions & 83 deletions frontend/public/manifest.json

This file was deleted.

Binary file added frontend/public/pwa-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/public/pwa-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
User-agent: *
Disallow:
Allow: /
6 changes: 5 additions & 1 deletion frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import axios from 'axios';
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import './registerServiceWorker.js'

import VueDsfr from '@laruiss/vue-dsfr'
import '@laruiss/vue-dsfr/dist/vue-dsfr.css'
import '@laruiss/vue-dsfr/dist/vue-dsfr-fonts.css'

import { registerSW } from 'virtual:pwa-register'


axios.defaults.withCredentials = true;

// the FastAPI backend
Expand All @@ -18,5 +20,7 @@ if (process.env.NODE_ENV == 'production') {
axios.defaults.baseURL = 'http://localhost:5000/';
}

registerSW({ immediate: true })

const app = createApp(App)
app.use(router).use(VueDsfr).mount('#app')
32 changes: 0 additions & 32 deletions frontend/src/registerServiceWorker.js

This file was deleted.

38 changes: 37 additions & 1 deletion frontend/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,47 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { VitePWA } from 'vite-plugin-pwa'

const path = require("path");

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
plugins: [
vue(),
VitePWA({
includeAssets: ['favicon.svg', 'favicon.ico', 'robots.txt', 'apple-touch-icon.png'],
base: "/",
srcDir: "src",
manifest: {
name: 'Basegun',
short_name: 'Basegun',
description: 'Identification des armes à feu',
theme_color: '#000091',
icons: [
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable',
}
]
},
registerType: 'autoUpdate',
devOptions: {
enabled: true
}
})
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
Expand Down
3 changes: 0 additions & 3 deletions frontend/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ module.exports = {
watchOptions: {
ignored: ['node_modules', /public/],
},
},

pwa: {
}

};