From d5d6fe3bbea68d937633bf816094f5a545199210 Mon Sep 17 00:00:00 2001 From: Pascal Syma Date: Fri, 2 Oct 2020 20:49:20 +0200 Subject: [PATCH] updated manifest and added jenkinsfile Signed-off-by: Pascal Syma --- Jenkinsfile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/index.js | 10 ++++++++-- webpack/prod.js | 8 ++++---- 3 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..406102f --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,48 @@ +pipeline { + agent { + label 'node&&windows' + } + + stages { + stage ('Initialize') { + steps { + echo 'Initializing..' + } + } + stage('Build') { + steps { + echo 'Building..' + bat 'npm install' + bat 'npm run build' + } + } + stage('Test') { + steps { + echo 'Testing..' + } + } + stage('Archive') { + when { + branch 'master' + expression { + currentBuild.result == null || currentBuild.result == 'SUCCESS' + } + } + steps { + echo 'Deploying....' + dir("dist") { + bat 'git init' + bat 'git add .' + bat 'git config --global user.email "jenkins@bosym.de"' + bat 'git config --global user.name "Jenkins"' + bat 'git commit -m "Deploy by Jenkins"' + withCredentials([usernamePassword(credentialsId: 'e3d97a6f-476f-489f-a207-4766a1c420cf', usernameVariable: 'username', passwordVariable: 'password')]) + { + bat "git push --force --quiet \"https://$username:$password@git.bosym.de/Pascal/realtime-oepnv-tracker.git\" master:gh-pages" + } + } + deleteDir() + } + } + } +} \ No newline at end of file diff --git a/src/index.js b/src/index.js index 38368f0..df28d15 100644 --- a/src/index.js +++ b/src/index.js @@ -10,7 +10,6 @@ Number.prototype.mod = function (n) { }; import * as L from 'leaflet'; -import mapSrc from "../map.png"; import Bus from "./Bus"; import Line from "./Line"; import stops201 from './lines/201.csv'; @@ -151,5 +150,12 @@ btnShowStops.addEventListener('click', () => { btnShowStops.innerText = showStops ? 'Hide Stops' : 'Show Stops' }) - +if (process.env.NODE_ENV === 'production') { + if ('serviceWorker' in navigator) { + window.addEventListener('load', () => { + navigator.serviceWorker.register('./service-worker.js').catch(() => { + }).then(); + }); + } +} diff --git a/webpack/prod.js b/webpack/prod.js index 2061472..3735fc4 100644 --- a/webpack/prod.js +++ b/webpack/prod.js @@ -42,10 +42,10 @@ module.exports = merge(base, { favicons: { manifestRelativePaths: true, start_url: "../", - appName: 'RT Delbus', - appDescription: 'Real-Time Delbus', - appShortName: "rt-delbus", - developerName: 'Syma.Dev', + appName: 'RealTime Delbus', + appDescription: 'Real-Time Delbus Map', + appShortName: "RealTime Delbus", + developerName: 'syma.dev', developerURL: "https://syma.dev", background: '#000', theme_color: '#333',