generated from AnKing-VIP/anking_addon_template
-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathbuild
More file actions
executable file
·29 lines (21 loc) · 881 Bytes
/
build
File metadata and controls
executable file
·29 lines (21 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Extended glob pattern: !(*.ejs)
shopt -s extglob
# When no file matches glob, don't treat the pattern as literal string
shopt -s nullglob
commit_hash=`git rev-parse --short HEAD`
for dir in ./src/notetypes/*/ ; do
NOTETYPE_DIR="./Note Types/$(basename "${dir}")"
for file in "${NOTETYPE_DIR}"/* ; do
rm "$file"
done
front_file="${NOTETYPE_DIR}/Front Template.html"
back_file="${NOTETYPE_DIR}/Back Template.html"
npx ejs "$dir"/front.ejs -o "$front_file"
npx ejs "$dir"/back.ejs -o "$back_file"
echo "<!-- version ${commit_hash} -->" | cat - "${front_file}" > /tmp/out && mv /tmp/out "${front_file}"
echo "<!-- version ${commit_hash} -->" | cat - "${back_file}" > /tmp/out && mv /tmp/out "${back_file}"
for file in "${dir}"!(*.ejs) ; do
cp "$file" "${NOTETYPE_DIR}/$(basename "$file")"
done
done