Skip to content

Commit 2451a6a

Browse files
authored
📦️(mail) make DIR_MAILS variable configurable
That allows downstream packages to e.g. split the builds of frontend/backend/mail, as it's the case in nixpkgs: NixOS/nixpkgs@5597a4f
1 parent d5c9eac commit 2451a6a

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/mail/bin/html-to-plain-text

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#!/usr/bin/env bash
22
set -eo pipefail
33
# Run html-to-text to convert all html files to text files
4-
DIR_MAILS="../backend/core/templates/mail/"
4+
DOCS_DIR_MAILS="${DOCS_DIR_MAILS:-../backend/core/templates/mail}/"
55

6-
if [ ! -d "${DIR_MAILS}" ]; then
7-
mkdir -p "${DIR_MAILS}";
6+
if [ ! -d "${DOCS_DIR_MAILS}" ]; then
7+
mkdir -p "${DOCS_DIR_MAILS}";
88
fi
99

10-
if [ ! -d "${DIR_MAILS}"html/ ]; then
11-
mkdir -p "${DIR_MAILS}"html/;
10+
if [ ! -d "${DOCS_DIR_MAILS}"html/ ]; then
11+
mkdir -p "${DOCS_DIR_MAILS}"html/;
1212
exit;
1313
fi
1414

15-
for file in "${DIR_MAILS}"html/*.html;
15+
for file in "${DOCS_DIR_MAILS}"html/*.html;
1616
do html-to-text -j ./html-to-text.config.json < "$file" > "${file%.html}".txt; done;
1717

18-
if [ ! -d "${DIR_MAILS}"text/ ]; then
19-
mkdir -p "${DIR_MAILS}"text/;
18+
if [ ! -d "${DOCS_DIR_MAILS}"text/ ]; then
19+
mkdir -p "${DOCS_DIR_MAILS}"text/;
2020
fi
2121

22-
mv "${DIR_MAILS}"html/*.txt "${DIR_MAILS}"text/;
22+
mv "${DOCS_DIR_MAILS}"html/*.txt "${DOCS_DIR_MAILS}"text/;

src/mail/bin/mjml-to-html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env bash
22

33
# Run mjml command to convert all mjml templates to html files
4-
DIR_MAILS="../backend/core/templates/mail/html/"
4+
DOCS_DIR_MAILS="${DOCS_DIR_MAILS:-../backend/core/templates/mail}/html/"
55

6-
if [ ! -d "${DIR_MAILS}" ]; then
7-
mkdir -p "${DIR_MAILS}";
6+
if [ ! -d "${DOCS_DIR_MAILS}" ]; then
7+
mkdir -p "${DOCS_DIR_MAILS}";
88
fi
9-
mjml mjml/*.mjml -o "${DIR_MAILS}";
9+
mjml mjml/*.mjml -o "${DOCS_DIR_MAILS}";

0 commit comments

Comments
 (0)