mirror of
https://github.com/pinry/pinry.git
synced 2025-11-17 18:30:39 +01:00
Feature: Add PWA settings
This commit is contained in:
@@ -11,7 +11,7 @@ module.exports = {
|
|||||||
// 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
// 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||||
'max-len': 'off',
|
'max-len': 'off',
|
||||||
"no-console": "off",
|
'no-console': 'off',
|
||||||
},
|
},
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: 'babel-eslint',
|
parser: 'babel-eslint',
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
"buefy": "^0.8.8",
|
"buefy": "^0.8.8",
|
||||||
"core-js": "^3.3.2",
|
"core-js": "^3.3.2",
|
||||||
|
"register-service-worker": "^1.6.2",
|
||||||
"vue": "^2.6.10",
|
"vue": "^2.6.10",
|
||||||
"vue-masonry": "^0.11.8",
|
"vue-masonry": "^0.11.8",
|
||||||
"vue-router": "^3.1.3"
|
"vue-router": "^3.1.3"
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "^4.0.0",
|
"@vue/cli-plugin-babel": "^4.0.0",
|
||||||
"@vue/cli-plugin-eslint": "^4.0.0",
|
"@vue/cli-plugin-eslint": "^4.0.0",
|
||||||
|
"@vue/cli-plugin-pwa": "^4.1.1",
|
||||||
"@vue/cli-plugin-router": "^4.0.5",
|
"@vue/cli-plugin-router": "^4.0.5",
|
||||||
"@vue/cli-service": "^4.0.0",
|
"@vue/cli-service": "^4.0.0",
|
||||||
"@vue/eslint-config-airbnb": "^4.0.0",
|
"@vue/eslint-config-airbnb": "^4.0.0",
|
||||||
|
|||||||
2
pinry-spa/public/robots.txt
Normal file
2
pinry-spa/public/robots.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
@@ -4,6 +4,7 @@ import { VueMasonryPlugin } from 'vue-masonry';
|
|||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
import router from './router';
|
import router from './router';
|
||||||
import setUpAxiosCsrfConfig from './components/utils/csrf';
|
import setUpAxiosCsrfConfig from './components/utils/csrf';
|
||||||
|
import './registerServiceWorker';
|
||||||
|
|
||||||
Vue.config.productionTip = false;
|
Vue.config.productionTip = false;
|
||||||
Vue.use(Buefy);
|
Vue.use(Buefy);
|
||||||
|
|||||||
32
pinry-spa/src/registerServiceWorker.js
Normal file
32
pinry-spa/src/registerServiceWorker.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
|
import { register } from 'register-service-worker';
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
register(`${process.env.BASE_URL}service-worker.js`, {
|
||||||
|
ready() {
|
||||||
|
console.log(
|
||||||
|
'App is being served from cache by a service worker.\n'
|
||||||
|
+ 'For more details, visit https://goo.gl/AFskqB',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
registered() {
|
||||||
|
console.log('Service worker has been registered.');
|
||||||
|
},
|
||||||
|
cached() {
|
||||||
|
console.log('Content has been cached for offline use.');
|
||||||
|
},
|
||||||
|
updatefound() {
|
||||||
|
console.log('New content is downloading.');
|
||||||
|
},
|
||||||
|
updated() {
|
||||||
|
console.log('New content is available; please refresh.');
|
||||||
|
},
|
||||||
|
offline() {
|
||||||
|
console.log('No internet connection found. App is running in offline mode.');
|
||||||
|
},
|
||||||
|
error(error) {
|
||||||
|
console.error('Error during service worker registration:', error);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -16,4 +16,19 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
pwa: {
|
||||||
|
name: 'Pinry Mobile',
|
||||||
|
appleMobileWebAppCapable: 'yes',
|
||||||
|
appleMobileWebAppStatusBarStyle: 'black',
|
||||||
|
// configure the workbox plugin
|
||||||
|
workboxPluginMode: 'GenerateSW',
|
||||||
|
iconPaths: {
|
||||||
|
favicon32: 'favicon.png',
|
||||||
|
favicon16: 'favicon.png',
|
||||||
|
appleTouchIcon: 'favicon.png',
|
||||||
|
// FIXME(winkidney): Add svg file for safari
|
||||||
|
// maskIcon: 'img/icons/safari-pinned-tab.svg',
|
||||||
|
msTileImage: 'favicon.png',
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
4060
pinry-spa/yarn.lock
4060
pinry-spa/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user