From b480d35cb1f7fe7010cea32fa22291e330df439a Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Sat, 27 Aug 2022 22:11:19 +0200 Subject: [PATCH] Changed build process --- .gitignore | 2 +- Makefile | 22 ++++++++++++++-------- tsconfig.json | 2 +- www/index.html | 8 ++++---- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 6cbfc0b..ce10006 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .idea/ -www/res/scripts/* +dest/ *.sh diff --git a/Makefile b/Makefile index 775df9c..6eb6d4a 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,21 @@ -.DEFAULT_GOAL := build +.DEFAULT_GOAL := build-www -OUT=www/res/scripts +build-www: + mkdir -p dest/ + rm -rf dest/www + cp -pr www dest/www -${OUT}/locutus.js ${OUT}/usimp.js: src/locutus.ts src/usimp.ts tsc -build: ${OUT}/locutus.js ${OUT}/usimp.js - perl -i -pE 's/(\?v=[0-9]+\.[0-9]+\.[0-9]+\+)([0-9]+)/($$1).($$2+1)/eg' www/index.html + sed -i 's:"\(/res/[^"]*\|/favicon.ico\|/app.webmanifest\)":"\1?v=$(shell date -u +%Y%m%d-%H%M%S)":g' dest/www/index.html perl -i -pE \ - "s/^(import .*)\"(.*?)(\.js)?(\?.*?)?\"/(\$$1).(\"\\\".\/\$$2.js$$(grep -oE '\?v=[0-9]+\.[0-9]+\.[0-9]+\+[0-9]+' www/index.html | tail -n 1)\\\"\")/ge" \ - www/res/scripts/*.js + "s/^(import .*)\"(.*?)(\.js)?(\?.*?)?\"/(\$$1).(\"\\\".\/\$$2.js?v=$(shell date -u +%Y%m%d-%H%M%S)\\\"\")/ge" \ + dest/www/res/scripts/*.js + + tools/minify-css.sh + sed -i 's|/res/styles/styles.css|/res/styles/min.css|g' dest/www/index.html + + #convert -background none dest/www/res/svgs/tucal.svg -alpha set -define icon:auto-resize=256,128,64,32,24,16 dest/www/favicon.ico clean: - rm -rf "${OUT}" + rm -rf dest/ diff --git a/tsconfig.json b/tsconfig.json index 1ba721e..d44da8e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ /* Visit https://aka.ms/tsconfig.json to read more about this file */ "target": "ES2020", "module": "ES2020", - "outDir": "www/res/scripts", + "outDir": "dest/www/res/scripts", "rootDir": "src", "strict": true, "noImplicitAny": true, diff --git a/www/index.html b/www/index.html index e823cd0..f87250c 100644 --- a/www/index.html +++ b/www/index.html @@ -26,10 +26,10 @@ Distributed, end-to-end encrypted instant messaging."/> img-src * blob: data:; connect-src *; media-src * blob: data:;"/> - - - - + + + +