Skip to content

Commit 1c436d5

Browse files
feat: added PWA support
* Added PWA plugin * Added PWA plugin * Added custom app icons * Added Pwa custom parameters in vue.config.js Closes InternetHealthReport#33
1 parent 2a2fb7b commit 1c436d5

20 files changed

+79
-2
lines changed

Diff for: package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"scripts": {
66
"serve": "vue-cli-service serve",
77
"build": "vue-cli-service build",
8+
"test:unit": "vue-cli-service test:unit",
89
"lint": "vue-cli-service lint",
9-
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'",
10-
"test:unit": "vue-cli-service test:unit"
10+
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
1111
},
1212
"dependencies": {
1313
"@quasar/extras": "^1.5.2",
@@ -23,6 +23,7 @@
2323
"plotly.js-dist": "^1.52.3",
2424
"postcss-plugins": "^1.13.1",
2525
"quasar": "^1.15.22",
26+
"register-service-worker": "^1.7.2",
2627
"swagger-ui": "^3.25.0",
2728
"timeline-vuejs": "^1.1.1",
2829
"vue": "^2.6.11",
@@ -39,6 +40,7 @@
3940
"@kazupon/vue-i18n-loader": "^0.5.0",
4041
"@vue/cli-plugin-babel": "^3.12.1",
4142
"@vue/cli-plugin-eslint": "^3.12.1",
43+
"@vue/cli-plugin-pwa": "^4.5.17",
4244
"@vue/cli-plugin-unit-jest": "^3.12.1",
4345
"@vue/cli-service": "^3.12.1",
4446
"@vue/composition-api": "^1.1.5",

Diff for: public/img/icons/android-chrome-192x192.png

11.5 KB
Loading

Diff for: public/img/icons/android-chrome-512x512.png

41.4 KB
Loading

Diff for: public/img/icons/android-chrome-maskable-192x192.png

11.5 KB
Loading

Diff for: public/img/icons/android-chrome-maskable-512x512.png

41.4 KB
Loading

Diff for: public/img/icons/apple-touch-icon-120x120.png

6.49 KB
Loading

Diff for: public/img/icons/apple-touch-icon-152x152.png

8.73 KB
Loading

Diff for: public/img/icons/apple-touch-icon-180x180.png

10.7 KB
Loading

Diff for: public/img/icons/apple-touch-icon-60x60.png

2.8 KB
Loading

Diff for: public/img/icons/apple-touch-icon-76x76.png

3.7 KB
Loading

Diff for: public/img/icons/apple-touch-icon.png

11.3 KB
Loading

Diff for: public/img/icons/favicon-16x16.png

585 Bytes
Loading

Diff for: public/img/icons/favicon-32x32.png

1.27 KB
Loading

Diff for: public/img/icons/msapplication-icon-144x144.png

8.05 KB
Loading

Diff for: public/img/icons/mstile-150x150.png

8.7 KB
Loading

Diff for: public/img/icons/safari-pinned-tab.svg

+31
Loading

Diff for: public/robots.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow:

Diff for: src/main.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import '@/styles/main.styl'
1010
import '@/styles/ihr.style.styl'
1111
import IhrStyle from './plugins/IhrStyle'
1212
import Fragment from 'vue-fragment'
13+
import './registerServiceWorker'
1314
//import LoadScript from 'vue-plugin-load-script';
1415

1516
//external plugin

Diff for: src/registerServiceWorker.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* eslint-disable no-console */
2+
3+
import { register } from 'register-service-worker'
4+
5+
if (process.env.NODE_ENV === 'production') {
6+
register(`${process.env.BASE_URL}service-worker.js`, {
7+
ready () {
8+
console.log(
9+
'App is being served from cache by a service worker.\n' +
10+
'For more details, visit https://goo.gl/AFskqB'
11+
)
12+
},
13+
registered () {
14+
console.log('Service worker has been registered.')
15+
},
16+
cached () {
17+
console.log('Content has been cached for offline use.')
18+
},
19+
updatefound () {
20+
console.log('New content is downloading.')
21+
},
22+
updated () {
23+
console.log('New content is available; please refresh.')
24+
},
25+
offline () {
26+
console.log('No internet connection found. App is running in offline mode.')
27+
},
28+
error (error) {
29+
console.error('Error during service worker registration:', error)
30+
}
31+
})
32+
}

Diff for: vue.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ module.exports = {
99
},
1010
open: 'Google Chrome',
1111
},
12+
pwa: {
13+
name : 'Internet Health Report',
14+
shortName : 'IHR',
15+
themeColor : '#343434',
16+
workboxOptions: {
17+
skipWaiting: true,
18+
clientsClaim: true,
19+
}
20+
},
1221
chainWebpack: webpackConfig => {
1322
webpackConfig.module
1423
.rule('ify-loader')

0 commit comments

Comments
 (0)