39 lines
989 B
Bash
39 lines
989 B
Bash
# 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.
|
|
|
|
export KEEP_PAGES="Math3200"
|
|
|
|
# check if environment variable is set
|
|
if $KEEP_PAGES == ""; then
|
|
echo "Please set environment variable KEEP_PAGES to the pages you want to keep for microsite building."
|
|
exit 1
|
|
fi
|
|
|
|
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}"
|
|
|
|
cp ./${KEEP_PAGES}/_meta.js ../content/_meta.js
|
|
|
|
# remove other subdirectories
|
|
for dir in ../content/; do
|
|
if [ "$dir" != "${KEEP_PAGES}/" ]; then
|
|
rm -rf $dir
|
|
fi
|
|
done
|
|
|
|
# remove public directory
|
|
for dir in ../public/; do
|
|
if [ "$dir" != "${KEEP_PAGES}/" ]; then
|
|
rm -rf $dir
|
|
fi
|
|
done
|
|
|
|
echo "Done clearing up resources and compiling for ${KEEP_PAGES}"
|
|
|
|
echo "modify next.config.js"
|
|
|
|
cp ./next.config.js ../next.config.js
|
|
|
|
|