Browse Source

fix PWA creation & service-worker registration, plus some commentary tweaks

pull/114/head
Trent Larson 8 months ago
parent
commit
7ae431a9e7
  1. 8
      .env.development
  2. 4
      README.md
  3. 2233
      package-lock.json
  4. 4
      package.json
  5. 3
      project.task.yaml
  6. 6
      src/views/AccountViewView.vue
  7. 4
      src/views/SearchAreaView.vue
  8. 22
      vite.config.mjs
  9. 17
      vue.config.js

8
.env.development

@ -1,7 +1,3 @@
# I tried setting values here and using `vue-cli-service build --mode development` # I tried and failed to set things here with vue-cli-service but
# but it didn't create some things in "dist": # things may be more reliable with vite so let's try again.
# - the "css" directory with the CSS extracted from Vue files
# - the sw_scripts-combined* files
#
# ¯\_(ツ)_/¯

4
README.md

@ -45,9 +45,9 @@ npm run lint
* Test * Test
``` ```
# (See .env.development for more details.) # (Let's replace this with a .env.development or .env.staging file.)
# The test BVC_MEETUPS_PROJECT_CLAIM_ID does not resolve as a URL because it's only in the test DB and the prod redirect won't redirect there. # The test BVC_MEETUPS_PROJECT_CLAIM_ID does not resolve as a URL because it's only in the test DB and the prod redirect won't redirect there.
VITE_TIME_SAFARI_APP_TITLE="TimeSafari_Test" VITE_BVC_MEETUPS_PROJECT_CLAIM_ID=https://endorser.ch/entity/01HNTZYJJXTGT0EZS3VEJGX7AK VITE_DEFAULT_ENDORSER_API_SERVER=https://test-api.endorser.ch VITE_DEFAULT_IMAGE_API_SERVER=https://test-image-api.timesafari.app npm run build TIME_SAFARI_APP_TITLE="TimeSafari_Test" VITE_BVC_MEETUPS_PROJECT_CLAIM_ID=https://endorser.ch/entity/01HNTZYJJXTGT0EZS3VEJGX7AK VITE_DEFAULT_ENDORSER_API_SERVER=https://test-api.endorser.ch VITE_DEFAULT_IMAGE_API_SERVER=https://test-image-api.timesafari.app npm run build
``` ```
* Production * Production

2233
package-lock.json

File diff suppressed because it is too large

4
package.json

@ -8,7 +8,6 @@
"build": "VITE_GIT_HASH=`git log -1 --pretty=format:%h` vite build", "build": "VITE_GIT_HASH=`git log -1 --pretty=format:%h` vite build",
"lint": "eslint --ext .js,.ts,.vue --ignore-path .gitignore src", "lint": "eslint --ext .js,.ts,.vue --ignore-path .gitignore src",
"lint-fix": "eslint --ext .js,.ts,.vue --ignore-path .gitignore --fix src", "lint-fix": "eslint --ext .js,.ts,.vue --ignore-path .gitignore --fix src",
"postbuild": "cp ./sw_scripts-combined.js dist/",
"prebuild": "eslint --ext .js,.ts,.vue --ignore-path .gitignore src && node sw_combine.js" "prebuild": "eslint --ext .js,.ts,.vue --ignore-path .gitignore src && node sw_combine.js"
}, },
"dependencies": { "dependencies": {
@ -87,6 +86,7 @@
"prettier": "^3.2.5", "prettier": "^3.2.5",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.1",
"typescript": "~5.2.2", "typescript": "~5.2.2",
"vite": "^5.2.0" "vite": "^5.2.0",
"vite-plugin-pwa": "^0.19.8"
} }
} }

3
project.task.yaml

@ -1,8 +1,7 @@
tasks : tasks :
- remove topics of interest - clickup vs linear
- clickup
- remove the loading of projects during feed load on the home screen (which slows down the feed) - remove the loading of projects during feed load on the home screen (which slows down the feed)
- fix the notification link to the app - fix the notification link to the app

6
src/views/AccountViewView.vue

@ -113,7 +113,7 @@
<div class="bg-slate-100 rounded-md overflow-hidden px-4 py-4 mt-8 mb-8"> <div class="bg-slate-100 rounded-md overflow-hidden px-4 py-4 mt-8 mb-8">
<!-- label --> <!-- label -->
<div class="mb-2 font-bold">Settings</div> <div class="mb-2 font-bold">Notifications</div>
<div <div
v-if="!notificationMaybeChanged" v-if="!notificationMaybeChanged"
class="flex items-center justify-between cursor-pointer" class="flex items-center justify-between cursor-pointer"
@ -145,7 +145,11 @@
<router-link class="pl-4 text-sm text-blue-500" to="/help-notifications"> <router-link class="pl-4 text-sm text-blue-500" to="/help-notifications">
Troubleshoot your notification setup. Troubleshoot your notification setup.
</router-link> </router-link>
</div>
<div class="bg-slate-100 rounded-md overflow-hidden px-4 py-4 mt-8 mb-8">
<!-- label -->
<div class="mb-2 font-bold">Location</div>
<router-link <router-link
:to="{ name: 'search-area' }" :to="{ name: 'search-area' }"
v-if="activeDid" v-if="activeDid"

4
src/views/SearchAreaView.vue

@ -22,8 +22,8 @@
</div> </div>
<div class="px-2 py-4"> <div class="px-2 py-4">
This location is only stored on your device. It is used to show you more This location is only stored on your device. It is sometimes sent from
appropriate projects but is not stored on any servers. your device to run searches but it is not stored on our servers.
</div> </div>
<div> <div>

22
vite.config.mjs

@ -1,16 +1,28 @@
import { defineConfig } from "vite"; import * as path from 'path';
import vue from "@vitejs/plugin-vue"; import { defineConfig } from 'vite';
import * as path from "path"; import { VitePWA } from 'vite-plugin-pwa';
import vue from '@vitejs/plugin-vue';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
server: { server: {
port: 8080 port: 8080
}, },
plugins: [ vue() ], plugins: [
vue(),
VitePWA({
registerType: 'autoUpdate',
strategies: 'injectManifest',
srcDir: '.',
filename: 'sw_scripts-combined.js',
manifest: {
name: process.env.TIME_SAFARI_APP_TITLE || require('./package.json').name,
},
}),
],
resolve: { resolve: {
alias: { alias: {
"@": path.resolve(__dirname, "./src"), '@': path.resolve(__dirname, './src'),
buffer: path.resolve(__dirname, 'node_modules', 'buffer'), buffer: path.resolve(__dirname, 'node_modules', 'buffer'),
'dexie-export-import/dist/import': 'dexie-export-import/dist/import/index.js', 'dexie-export-import/dist/import': 'dexie-export-import/dist/import/index.js',
}, },

17
vue.config.js

@ -1,17 +0,0 @@
const TIME_SAFARI_APP_TITLE =
import.meta.env.VITE_TIME_SAFARI_APP_TITLE || require("./package.json").name;
module.exports = defineConfig({
pwa: {
name: TIME_SAFARI_APP_TITLE,
iconPaths: {
faviconSVG: "img/icons/safari-pinned-tab.svg",
},
workboxPluginMode: "InjectManifest",
workboxOptions: {
// this script will be checked for linting (sw_scripts/* files generate about 1000 linting errors)
swSrc: "./sw_scripts-combined.js",
},
},
});
Loading…
Cancel
Save