From 2451a6a322af7113d068da3d7119875ca64d517c Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 29 Aug 2025 10:00:43 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=EF=B8=8F(mail)=20make=20DIR=5FMAIL?= =?UTF-8?q?S=20variable=20configurable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That allows downstream packages to e.g. split the builds of frontend/backend/mail, as it's the case in nixpkgs: https://github.com/NixOS/nixpkgs/commit/5597a4f8f9f82e6a4829f3527728016c07838f4f --- src/mail/bin/html-to-plain-text | 18 +++++++++--------- src/mail/bin/mjml-to-html | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/mail/bin/html-to-plain-text b/src/mail/bin/html-to-plain-text index ced0c13d..68e2a350 100755 --- a/src/mail/bin/html-to-plain-text +++ b/src/mail/bin/html-to-plain-text @@ -1,22 +1,22 @@ #!/usr/bin/env bash set -eo pipefail # Run html-to-text to convert all html files to text files -DIR_MAILS="../backend/core/templates/mail/" +DOCS_DIR_MAILS="${DOCS_DIR_MAILS:-../backend/core/templates/mail}/" -if [ ! -d "${DIR_MAILS}" ]; then - mkdir -p "${DIR_MAILS}"; +if [ ! -d "${DOCS_DIR_MAILS}" ]; then + mkdir -p "${DOCS_DIR_MAILS}"; fi -if [ ! -d "${DIR_MAILS}"html/ ]; then - mkdir -p "${DIR_MAILS}"html/; +if [ ! -d "${DOCS_DIR_MAILS}"html/ ]; then + mkdir -p "${DOCS_DIR_MAILS}"html/; exit; fi -for file in "${DIR_MAILS}"html/*.html; +for file in "${DOCS_DIR_MAILS}"html/*.html; do html-to-text -j ./html-to-text.config.json < "$file" > "${file%.html}".txt; done; -if [ ! -d "${DIR_MAILS}"text/ ]; then - mkdir -p "${DIR_MAILS}"text/; +if [ ! -d "${DOCS_DIR_MAILS}"text/ ]; then + mkdir -p "${DOCS_DIR_MAILS}"text/; fi -mv "${DIR_MAILS}"html/*.txt "${DIR_MAILS}"text/; +mv "${DOCS_DIR_MAILS}"html/*.txt "${DOCS_DIR_MAILS}"text/; diff --git a/src/mail/bin/mjml-to-html b/src/mail/bin/mjml-to-html index fb5710b0..27db1a70 100755 --- a/src/mail/bin/mjml-to-html +++ b/src/mail/bin/mjml-to-html @@ -1,9 +1,9 @@ #!/usr/bin/env bash # Run mjml command to convert all mjml templates to html files -DIR_MAILS="../backend/core/templates/mail/html/" +DOCS_DIR_MAILS="${DOCS_DIR_MAILS:-../backend/core/templates/mail}/html/" -if [ ! -d "${DIR_MAILS}" ]; then - mkdir -p "${DIR_MAILS}"; +if [ ! -d "${DOCS_DIR_MAILS}" ]; then + mkdir -p "${DOCS_DIR_MAILS}"; fi -mjml mjml/*.mjml -o "${DIR_MAILS}"; +mjml mjml/*.mjml -o "${DOCS_DIR_MAILS}";