summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-11-01 07:06:35 -0300
committerEuAndreh <eu@euandre.org>2024-11-01 07:06:35 -0300
commit6aab6760eec06bd789adf3cecc8678f28311c6a9 (patch)
treee560b09b0a491f6f0a2d68bc52e53f2bc5c52bb2 /Makefile
parentWIP: Init work on HTML (diff)
downloadchat.papo.im-6aab6760eec06bd789adf3cecc8678f28311c6a9.tar.gz
chat.papo.im-6aab6760eec06bd789adf3cecc8678f28311c6a9.tar.xz
Use importScripts() instead of generating the service-worker.js file
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 5 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index f1e01eb..11547c6 100644
--- a/Makefile
+++ b/Makefile
@@ -42,15 +42,16 @@ contents = \
src/content/papo.js \
src/content/style.css \
src/content/index.html \
+ src/content/sw.js \
+ src/content/images.js \
src/content/service-worker.js \
$(img.svg) \
derived-assets = \
- src/sw-pre.js \
+ src/content/images.js \
src/content/papo.exported.js \
src/content/sw.exported.js \
- src/content/service-worker.js \
side-assets = \
@@ -60,17 +61,10 @@ side-assets = \
## and installation.
all: $(derived-assets)
-src/sw-pre.js: Makefile deps.mk
+src/content/images.js: Makefile deps.mk
printf 'const IMG_PATHS = [\n' > $@
printf '\t"%s",\n' $(img.svg) >> $@
- printf '];\n\n' >> $@
-
-## The use of static `import` statements inside service workers
-## isn't supported. So in order to have tests for the code in
-## it, a "main()" function is included in the generated file
-## so that is can be ran as a standalone file.
-src/content/service-worker.js: src/sw-pre.js src/content/sw.js src/sw-main.js
- tail -n+2 src/content/sw.js | cat src/sw-pre.js - src/sw-main.js > $@
+ printf '];\n' >> $@
src/content/papo.exported.js src/content/sw.exported.js: \
Makefile src/exported.sh
@@ -88,11 +82,7 @@ tests/sw.js-check: src/content/sw.exported.js
tests/papo.js-check tests/sw.js-check:
node tests/node-driver.js $*.js
-src/content/service-worker.js-check: src/content/service-worker.js
- test "`grep -c '^const IMG_PATHS ' $*.js`" = 1
-
check-unit: tests/papo.js-check tests/sw.js-check
-check-unit: src/content/service-worker.js-check
integration-tests = \