Skip to content

Commit

Permalink
fix path in PWA npm script for cachebust hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Jieiku committed Aug 25, 2023
1 parent 98ad16f commit 0f32d16
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"nonbundles": "npm run theme && npm run theme-light && npm run pwa-minify && npm run katex-bundle && npm run search-elasticlunr && npm run search-stork && npm run search-tinysearch",
"theme": "uglifyjs static/js/theme.js -c -m -o static/js/theme.min.js",
"theme-light": "uglifyjs static/js/theme_light.js -c -m -o static/js/theme_light.min.js",
"pwa-cache": "h_abridge_css=$(shasum -a256 'public/abridge.css'|cut -d' ' -f1|cut -c1-20) && h_abridge=$(shasum -a256 'static/js/abridge.min.js'|cut -d' ' -f1|cut -c1-20) && h_abridge_nosearch=$(shasum -a256 'static/js/abridge_nosearch.min.js'|cut -d' ' -f1|cut -c1-20) && h_katexbundle=$(shasum -a256 'static/js/katexbundle.min.js'|cut -d' ' -f1|cut -c1-20) && CACHEFILES=$(find public -type f | sed 's/^public//' | sed 's/^\\/sw\\..*//' | sed 's/.*sw_load.*//' | sed 's/index.html//' | sort | uniq | sed '/^$/d' | sed \"s/\\(.*\\)/'\\1'/\" | tr '\\n' ',' | uniq | sed 's/.$//' | sed \"s/\\(.*\\)/\\[\\1\\]/\") && CACHEFILES=$(echo $CACHEFILES | sed \"s|abridge\\.css|abridge\\.css\\?h=$h_abridge_css|\") && CACHEFILES=$(echo $CACHEFILES | sed \"s|abridge\\.min\\.js|abridge\\.min\\.js\\?h=$h_abridge|\") && CACHEFILES=$(echo $CACHEFILES | sed \"s|abridge_nosearch\\.min\\.js|abridge_nosearch\\.min\\.js\\?h=$h_abridge_nosearch|\") && CACHEFILES=$(echo $CACHEFILES | sed \"s|katexbundle\\.min\\.js|katexbundle\\.min\\.js\\?h=$h_katexbundle|\") && sed -i \"s|BASE_CACHE_FILES =.*|BASE_CACHE_FILES = $CACHEFILES\\;|\" 'static/sw.js'",
"pwa-cache": "h_abridge_css=$(shasum -a256 'public/abridge.css'|cut -d' ' -f1|cut -c1-20) && h_abridge=$(shasum -a256 'public/js/abridge.min.js'|cut -d' ' -f1|cut -c1-20) && h_abridge_nosearch=$(shasum -a256 'public/js/abridge_nosearch.min.js'|cut -d' ' -f1|cut -c1-20) && h_katexbundle=$(shasum -a256 'public/js/katexbundle.min.js'|cut -d' ' -f1|cut -c1-20) && CACHEFILES=$(find public -type f | sed 's/^public//' | sed 's/^\\/sw\\..*//' | sed 's/.*sw_load.*//' | sed 's/index.html//' | sort | uniq | sed '/^$/d' | sed \"s/\\(.*\\)/'\\1'/\" | tr '\\n' ',' | uniq | sed 's/.$//' | sed \"s/\\(.*\\)/\\[\\1\\]/\") && CACHEFILES=$(echo $CACHEFILES | sed \"s|abridge\\.css|abridge\\.css\\?h=$h_abridge_css|\") && CACHEFILES=$(echo $CACHEFILES | sed \"s|abridge\\.min\\.js|abridge\\.min\\.js\\?h=$h_abridge|\") && CACHEFILES=$(echo $CACHEFILES | sed \"s|abridge_nosearch\\.min\\.js|abridge_nosearch\\.min\\.js\\?h=$h_abridge_nosearch|\") && CACHEFILES=$(echo $CACHEFILES | sed \"s|katexbundle\\.min\\.js|katexbundle\\.min\\.js\\?h=$h_katexbundle|\") && sed -i \"s|BASE_CACHE_FILES =.*|BASE_CACHE_FILES = $CACHEFILES\\;|\" 'static/sw.js'",
"pwa-minify": "uglifyjs static/js/sw_load.js -c -m -o static/js/sw_load.min.js && uglifyjs static/sw.js -c -m -o static/sw.min.js",
"pwa": "npm run pwa-cache && npm run pwa-minify",
"katex-bundle": "uglifyjs static/js/katex.min.js static/js/mathtex-script-type.min.js static/js/katex-auto-render.min.js static/js/katexoptions.js -c -m -o static/js/katexbundle.min.js",
Expand Down
2 changes: 1 addition & 1 deletion static/js/sw_load.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if ("serviceWorker" in navigator) {
navigator.serviceWorker
.register("/sw.min.js?v=3.8.0", { scope: "/" })
.register("/sw.min.js?v=3.8.1", { scope: "/" })
.then(() => {
//console.info("SW Loaded");
}, err => console.error("SW error: ", err));
Expand Down
2 changes: 1 addition & 1 deletion static/js/sw_load.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0f32d16

Please sign in to comment.