Browse Source

not working: update imba and import service worker

main
familyfriendlymikey 2 years ago
parent
commit
a4dc1c4ea5
  1. 3
      app/client.imba
  2. 7
      app/index.html
  3. 7
      app/sw.imba
  4. 14
      package-lock.json
  5. 6
      package.json

3
app/client.imba

@ -1,5 +1,8 @@
let p = console.log let p = console.log
import sw from './sw.imba?serviceworker'
navigator..serviceWorker..register(sw).then! do |reg| reg.update!
import { orderBy, omit } from 'lodash' import { orderBy, omit } from 'lodash'
import pkg from '../package.json' import pkg from '../package.json'
let version = pkg.version let version = pkg.version

7
app/index.html

@ -7,13 +7,6 @@
<style src='*'></style> <style src='*'></style>
</head> </head>
<body> <body>
<script type="module">
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./sw.js').then(function(reg){
reg.update()
})
}
</script>
<script type="module" src="./client.imba"></script> <script type="module" src="./client.imba"></script>
</body> </body>
</html> </html>

7
sw.imba → app/sw.imba

@ -1,15 +1,12 @@
const app_name = "fuzzyhome" const app_name = "fuzzyhome"
import { version } from './package.json' import { version } from '../package.json'
const app_prefix = "{app_name}_cache" const app_prefix = "{app_name}_cache"
const cache_name = "sw-{app_prefix}-{version}" const cache_name = "sw-{app_prefix}-{version}"
let p = do |s| console.log "{cache_name} {s}" let p = do |s| console.log "{cache_name} {s}"
p "loaded" p "loaded"
let urls = [ let urls = [
'./', './'
'./__assets__/all.css'
'./__assets__/app/client.js'
'./__assets__/app/client.css'
] ]
self.addEventListener('fetch') do |e| self.addEventListener('fetch') do |e|

14
package-lock.json

@ -12,7 +12,7 @@
"dexie-export-import": "^1.0.3", "dexie-export-import": "^1.0.3",
"downloadjs": "^1.4.7", "downloadjs": "^1.4.7",
"fzi": "^1.0.0", "fzi": "^1.0.0",
"imba": "^2.0.0-alpha.218", "imba": "^2.0.0-alpha.219",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mathjs": "^11.1.0", "mathjs": "^11.1.0",
"nanoid": "^4.0.0" "nanoid": "^4.0.0"
@ -532,9 +532,9 @@
} }
}, },
"node_modules/imba": { "node_modules/imba": {
"version": "2.0.0-alpha.218", "version": "2.0.0-alpha.219",
"resolved": "https://registry.npmjs.org/imba/-/imba-2.0.0-alpha.218.tgz", "resolved": "https://registry.npmjs.org/imba/-/imba-2.0.0-alpha.219.tgz",
"integrity": "sha512-qWu5mcTYbZH7eVs8UY4OVYoWgm0m3L3NTPEDdOeDSkxvBQG2AFxgQDIAIQjodH46pDFDTvkVm2L8SQ7Do8lHNQ==", "integrity": "sha512-5BIUK9DBNDvprJ/hPezfg4dk6w96j/yOCWU35O/CKpLx8ce+k/u534HYrdQNGZqfTY7ImSA5uRduVbp1zKi9Wg==",
"dependencies": { "dependencies": {
"chokidar": "^3.4.3", "chokidar": "^3.4.3",
"esbuild": "^0.15.2" "esbuild": "^0.15.2"
@ -958,9 +958,9 @@
} }
}, },
"imba": { "imba": {
"version": "2.0.0-alpha.218", "version": "2.0.0-alpha.219",
"resolved": "https://registry.npmjs.org/imba/-/imba-2.0.0-alpha.218.tgz", "resolved": "https://registry.npmjs.org/imba/-/imba-2.0.0-alpha.219.tgz",
"integrity": "sha512-qWu5mcTYbZH7eVs8UY4OVYoWgm0m3L3NTPEDdOeDSkxvBQG2AFxgQDIAIQjodH46pDFDTvkVm2L8SQ7Do8lHNQ==", "integrity": "sha512-5BIUK9DBNDvprJ/hPezfg4dk6w96j/yOCWU35O/CKpLx8ce+k/u534HYrdQNGZqfTY7ImSA5uRduVbp1zKi9Wg==",
"requires": { "requires": {
"chokidar": "^3.4.3", "chokidar": "^3.4.3",
"esbuild": "^0.15.2" "esbuild": "^0.15.2"

6
package.json

@ -2,9 +2,7 @@
"name": "fuzzyhome", "name": "fuzzyhome",
"version": "0.1.42", "version": "0.1.42",
"scripts": { "scripts": {
"build-app": "imba build app/index.html", "build": "imba build app/index.html",
"build-sw": "imba build -k sw.imba -o dist",
"build": "npm run build-app && npm run build-sw",
"publish-preview": "npx gh-pages --no-history --dotfiles --dist dist/ --branch preview", "publish-preview": "npx gh-pages --no-history --dotfiles --dist dist/ --branch preview",
"publish-release": "npx gh-pages --no-history --dotfiles --dist dist/ --branch release", "publish-release": "npx gh-pages --no-history --dotfiles --dist dist/ --branch release",
"start": "imba -w app/index.html", "start": "imba -w app/index.html",
@ -17,7 +15,7 @@
"dexie-export-import": "^1.0.3", "dexie-export-import": "^1.0.3",
"downloadjs": "^1.4.7", "downloadjs": "^1.4.7",
"fzi": "^1.0.0", "fzi": "^1.0.0",
"imba": "^2.0.0-alpha.218", "imba": "^2.0.0-alpha.219",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mathjs": "^11.1.0", "mathjs": "^11.1.0",
"nanoid": "^4.0.0" "nanoid": "^4.0.0"

Loading…
Cancel
Save