1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

add dark variants to ts

janky but works, and should report if theres a situation its not ready
to handle.
This commit is contained in:
Harvey Tindall 2021-12-30 02:45:29 +00:00
parent 18ae03554f
commit a31f174375
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
3 changed files with 42 additions and 11 deletions

1
.gitignore vendored
View File

@ -18,4 +18,5 @@ instructions-debian.txt
cl.md
./telegram/
mautrix/
tempts/
matacc.txt

View File

@ -52,7 +52,7 @@ ifeq ($(DEBUG), on)
SOURCEMAP := --sourcemap
TYPECHECK := tsc -noEmit --project ts/tsconfig.json
# jank
COPYTS := rm -r $(DATA)/web/js/ts; cp -r ts $(DATA)/web/js
COPYTS := rm -r $(DATA)/web/js/ts; cp -r tempts $(DATA)/web/js
UNCSS := cp $(DATA)/web/css/bundle.css $(DATA)/bundle.css
else
LDFLAGS := -s -w $(LDFLAGS)
@ -91,13 +91,18 @@ email:
typescript:
$(TYPECHECK)
$(adding dark variants to typescript)
-rm -r tempts
cp -r ts tempts
scripts/dark-variant.sh ts tempts
scripts/dark-variant.sh ts tempts/modules
$(info compiling typescript)
-mkdir -p $(DATA)/web/js
-$(ESBUILD) --bundle ts/admin.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/admin.js --minify
-$(ESBUILD) --bundle ts/pwr.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/pwr.js --minify
-$(ESBUILD) --bundle ts/form.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/form.js --minify
-$(ESBUILD) --bundle ts/setup.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/setup.js --minify
-$(ESBUILD) --bundle ts/crash.ts --outfile=./$(DATA)/crash.js --minify
-$(ESBUILD) --bundle tempts/admin.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/admin.js --minify
-$(ESBUILD) --bundle tempts/pwr.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/pwr.js --minify
-$(ESBUILD) --bundle tempts/form.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/form.js --minify
-$(ESBUILD) --bundle tempts/setup.ts $(SOURCEMAP) --outfile=./$(DATA)/web/js/setup.js --minify
-$(ESBUILD) --bundle tempts/crash.ts --outfile=./$(DATA)/crash.js --minify
$(COPYTS)
swagger:
@ -130,7 +135,7 @@ variants-html:
$(info copying html)
cp -r html $(DATA)/
$(info adding dark variants to html)
scripts/dark-variant.sh $(DATA)/html
scripts/dark-variant.sh html $(DATA)/html
copy:
$(info copying fonts)

View File

@ -1,7 +1,32 @@
#!/bin/bash
for f in $1/*.html; do
if [[ "$1" == "html" ]]; then
for f in $2/*.html; do
for color in neutral positive urge warning info critical; do
sed -i "s/~${color}/~${color} dark:~d_${color}/g" $f
done
done
elif [[ "$1" == "ts" ]]; then
for f in $2/*.ts; do
# FIXME: inline html
for l in $(grep -n "~neutral\|~positive\|~urge\|~warning\|~info\|~critical" $f | sed -e 's/:.*//g'); do
# for l in $(sed -n '/classList/=' $f); do
line=$(sed -n "${l}p" $f)
echo $line | grep "classList" &> /dev/null
if [ $? -eq 0 ]; then
echo $line | sed 's/.*classList//; s/).*//' | grep "~neutral\|~positive\|~urge\|~warning\|~info\|~critical" &> /dev/null
if [ $? -eq 0 ]; then
echo "found classList @ " $l
for color in neutral positive urge warning info critical; do
sed -i "${l},${l}s/\"~${color}\"/\"~${color}\", \"dark:~d_${color}\"/g" $f
done
else
echo "FIX: classList found, but color tag wasn't in it"
fi
else
echo "found inline @ " $l ", " $(sed -n "${l}p" $f)
sed -i "${l},${l}s/~${color}/~${color} dark:~d_${color}/g" $f
fi
done
done
fi