trying prebuild scripts

This commit is contained in:
Trance-0
2025-11-19 16:08:36 -06:00
parent aca1e0698b
commit b9f761d256
2 changed files with 86 additions and 5 deletions

View File

@@ -1,11 +1,19 @@
# This is pre-build script that cleans up resources and compiles for selected pages, then finally you may combine those subdirectories into one via nginx.
echo 'Currently compiling pages: $KEEP_PAGES'
export KEEP_PAGES="Math3200"
echo "Currently compiling pages: ${KEEP_PAGES}"
# Rewrite base _meta.js and next.config.js for export pages
echo 'Rewrite base _meta.js and keeping $KEEP_PAGES'
echo "Rewrite base _meta.js and keeping ${KEEP_PAGES}"
sed 's/(\w+\d+.):(\s*{\n.+\n.+)\n.+\n.+\n.+(\n.+},)/$1_link:$2\n href:'/$1'$3/g' -i ../content/_meta.js
$first =~ s@(\w+\d+.*)\s*:\s*(\{\s+.+\s+.+)\s+.+\s+.+\s+.+\s+(\},)@$1_link:$2\n href: \x27/$1\x27\n $3@gmx
perl -0777 -pe first -i ./content/_meta.js
$second =~ s@(\$KEEP_PAGES\{_link})\s*:\s*(\{\s+.+\s+.+)\s+.+\s+.+\s+.+\s+(\},)@${KEEP_PAGES}:$2\n theme:{\n timestamp: true,\n }\n $3@gmx
# Write saved pages back
perl -0777 -pe '' -i ./content/_meta.js
# cat ./content/_meta.js
echo 'First step replaced file:'
cat ../content/_meta.js