After each Package.json update app cannot load newly hashed index.js Vite PWA - progressive-web-apps

I have just installed the vite-plugin-pwa and followed the documentation and have the following in my config
VitePWA( {
injectRegister: 'auto',
registerType: 'autoUpdate',
devOptions: {
enabled: true
},
strategies: 'generateSW',
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,mp3}'],
sourcemap: true
},
includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'masked-icon.svg'],
manifest: {
name: 'Litreach',
short_name: 'Cluiche Litrithe',
start_url: "/",
display: "standalone",
lang: "ga",
description: 'Cluiche litrithe ina mbíonn ar an imreoir 5 fhocal a litriú gach lá. Cluintear na focail a rá sna 3 canúintí agus bíonn 5 iarracht agat an focal a litriú i gceart.',
theme_color: '#ffffff',
icons: [
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
"purpose": "maskable"
},
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
"purpose": "any"
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png'
}
],
dir: "ltr",
orientation: "portrait",
display_override: [
"standalone"
],
categories: [
"education",
"games"
]
}
})
However each time I bump the the package.json version number, the next time I go to load the app the application falls over. When I inspect the Network key I can see that the app is trying to load index.js?oldHashNumber and the only way I can get the app to load is manually pressing the refresh button on the browser.
I believe there is some problem with the Service Worker or my PWA configuration.
Should I try to destroy the Service Worker and all their caches and start again?
If so how should I do this?

Related

Nuxt.js static app is loading indefinitely

I just finished a Nuxt.js project, and I want to deploy it on a web server. So, I executed the command nuxt generate to have a static app. Before this, everything was working perfectly, but now nothing is working : the page is loading indefinitely with a rotating black and gray round in the center of the page.
Here is a picture
EDIT:
I am hosting my app on OVHcloud, and here is a public repo of my app : https://github.com/maximehamou/public.mh-info.fr.
Here is my nuxt.config.js
export default {
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
ssr: false,
target: "static",
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: "Accueil | MH info",
htmlAttrs: {
lang: "fr",
},
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ hid: "description", name: "description", content: "" },
{ name: "format-detection", content: "telephone=no" },
],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
script: [{ src: "https://kit.fontawesome.com/048c7a73f1.js/" }],
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: ["./css/general.css"],
server: {
port: 4000,
},
};
Here is my package.json
{
"name": "mh-info.fr",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"sass": "sass -w scss:css"
},
"dependencies": {
"buttercms": "^1.2.9",
"core-js": "^3.19.3",
"nuxt": "^2.15.8",
"sass": "^1.54.9",
"vue": "^2.6.14",
"vue-server-renderer": "^2.6.14",
"vue-template-compiler": "^2.6.14",
"webpack": "^4.46.0"
}
}
Update regarding my latest changes on a cloned version of your project.
I achieved to have something properly working here: https://kissu-makes-great-sites.netlify.app/fr/tous-les-articles
Main conclusion is that there is a LOT of things to fix/improve on.
You're not writing your app as you should with Vue (even less in a Nuxt way).
There is too much to cover into a single response, so I recommend that you ping me on Twitter, Discord or by email if you want a more in-depth explanation/mentoring on how to fix all of this.
PS: I speak french, lived there for 20 years. 🇫🇷

update kubernetes docker image after new image push with same or similar tag for renovate

I am using renovate to update my kubernetes manifest files. the process should be as follow:
build and push docker image with tag registery.com/nginx:qa-main
run renovate
renovate should be able to update image tag inside the helm values.yaml
I have tried these configuration and they sometimes work and sometimes do not:
# renovate.json
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"regexManagers": [
{
"fileMatch": ["clusters\/dev\/charts\/renovate\/values\.yaml"],
"description": "Update docker image references",
"matchStrings": ["image: (?<depName>.*?):(?<currentValue>.*?)#(?<currentDigest>sha256:[a-f0-9]+)s"],
"datasourceTemplate": "docker"
}
],
"packageRules": [
{
"matchDatasources": ["docker"],
"matchUpdateTypes": [
"major"
],
"enabled": false
}
]
}
#renovate-config.js
module.exports = {
token: 'mytoken',
platform: 'github',
logLevel: 'debug',
labels: ['renovate', 'dependencies', 'automated'],
onboarding: true,
onboardingConfig: {
extends: ['config:base', '":dependencyDashboard"'],
},
baseBranches: [],
repositories: ['mycompany/myrepo'],
renovateFork: true,
gitAuthor: "mark <a.mark#mycompany.com>",
username: "Fettah",
onboarding: false,
printConfig: true,
requireConfig: false,
logFile: "renovate.log.json",
};
# values.yaml
image: fettah/nginx:qa-main#sha256:bbd1281091831284e9488b713ee2a29b6a54494cf3519e352faa589c221c0898

503 The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. nuxt js

My site was running fine and then I updated nuxt.config.js. Then after that, the site starts to show Service Unavailable.
I am using pm2 to start / deploy the app. Its vps server with apache in it.
Its showing:
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
But, if I run npm run dev the site loads fine without any issue. Also, I checked the status with pm2 list, it showing the app is online.
My package.json
{
"name": "nuxtjs",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt --hostname domain.link --port 49000",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"deploy": "pm2 start npm --name nuxtjs -- start"
},
"dependencies": {
"#nuxtjs/axios": "^5.13.6",
"#yeger/vue-masonry-wall": "^3.0.16",
"core-js": "^3.19.3",
"nuxt": "^2.15.8",
"pm2": "^5.1.2",
"vue": "^2.6.14",
"vue-server-renderer": "^2.6.14",
"vue-template-compiler": "^2.6.14",
"webpack": "^4.46.0"
},
"devDependencies": {},
"config": {
"nuxt": {
"host": "0.0.0.0",
"port": "49000"
}
}
}
My nuxt.config:
import { join } from "path";
export default {
target: "static",
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: "Project Title",
htmlAttrs: {
lang: "en",
},
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ hid: "description", name: "description", content: "" },
{ name: "format-detection", content: "telephone=no" },
{ property: "og:title", content: "Project Title" },
{
property: "og:image",
content: "https://lovealabradoodle.com/images/two.jpg",
},
{
property: "og:description",
content:
"Content here",
},
],
link: [
{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" },
{
rel: "stylesheet",
href: "https://fonts.googleapis.com/css?family=Roboto:400,600,700%7CMontserrat:400,500,600,700",
},
{
rel: "stylesheet",
href: "https://use.fontawesome.com/releases/v5.15.4/css/all.css",
},
{
rel: "stylesheet",
href: join("/", `fonts/flaticon/flaticon.css`),
},
{
rel: "stylesheet",
href: join("/", `css/bootstrap.min.css`),
},
{
rel: "stylesheet",
href: join("/", `css/plugins.css`),
},
{
rel: "stylesheet",
href: join("/", `css/magnific-popup.css`),
},
{
rel: "stylesheet",
href: join("/", `css/aos.css`),
},
{
rel: "stylesheet",
href: join("/", `css/style.css`),
},
{
rel: "stylesheet",
href: join("/", `css/styles/maincolors.css`),
},
],
script: [
// {
// src: "js/jquery.min.js",
// body: true,
// },
{
src: join("/", `js/bootstrap.bundle.min.js`),
body: true,
},
{
src: join("/", `js/imagesloaded.pkgd.min.js`),
body: true,
},
{
src: join("/", `js/isotope.pkgd.min.js`),
body: true,
},
{
src: join("/", `js/jquery.magnific-popup.min.js`),
body: true,
},
{
src: join("/", `js/easing.min.js`),
body: true,
},
{
src: join("/", `js/aos.js`),
body: true,
},
{
src: join("/", `js/custom-nuxt.js`),
body: true,
},
],
bodyAttrs: {
id: "top",
},
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
// "~/static/css/bootstrap.min.css",
// "~/static/css/plugins.css",
// "~/static/css/magnific-popup.css",
// "~/static/css/aos.css",
// "~/static/css/style.css",
// "~/static/css/styles/maincolors.css",
],
//Global JS
// script: [
// "~assets/js/custom.js"
// ],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [],
// Auto import components: https://go.nuxtjs.dev/config-components
components: {
path: "~/components", // will get any components nested in let's say /components/test too
pathPrefix: false,
},
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/axios
"#nuxtjs/axios",
],
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {
// Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
baseURL: "http://api.domain.link/api",
retry: { retries: 3 },
},
publicRuntimeConfig: {
axios: {
baseURL: "http://api.domain.link/api",
},
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
extractCSS: true,
},
};
I ran yarn/npm install and it worked for me

How to download image in iOS?

When trying to download an image with the library am charts in ionic, it works in the browser but not when I put it in iOS.
It shows me this error
This is the code of the export method:
"export": {
"enabled": true,
"menu": [{
"class": "export-main",
"menu": [{
"label": "Descargar",
"menu": ["PNG", "JPG", "PDF"]
}]
}]
}

I am using log4js for logging the information. Want to print system logs. So how to do it?

I want to print the systems logs as its get printed using java and log4j.
However, i am not getting the way to write the system logs in protractor using log4js.
log4js.configure({
appenders: [
{
type: "clustered",
appenders: [
{
type: "dateFile",
filename: "log/access.log",
pattern: "-yyyy-MM-dd",
category: "http"
},
{
type: "file",
filename: "log/app.log",
maxLogSize: 10485760,
numBackups: 3
},
{
type: "logLevelFilter",
level: "ERROR",
appender: {
type: "file",
filename: "log/errors.log"
}
}
]
}
]