backup
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
# 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.
|
||||
# double check you are using LF instead of CRLF
|
||||
|
||||
export KEEP_PAGES="Math3200"
|
||||
|
||||
# check if environment variable is set
|
||||
if $KEEP_PAGES == ""; then
|
||||
if [ -z "$KEEP_PAGES" ]; then
|
||||
echo "Please set environment variable KEEP_PAGES to the pages you want to keep for microsite building."
|
||||
exit 1
|
||||
fi
|
||||
@@ -13,26 +14,44 @@ 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
|
||||
cp "./distribute/${KEEP_PAGES}/_meta.js" "./content/_meta.js"
|
||||
|
||||
# remove other subdirectories
|
||||
for dir in ../content/; do
|
||||
if [ "$dir" != "${KEEP_PAGES}/" ]; then
|
||||
rm -rf $dir
|
||||
fi
|
||||
for dir in ./content/*/; do
|
||||
# strip the leading path and trailing slash
|
||||
base_dir="$(basename "${dir%/}")"
|
||||
|
||||
# check if base_dir is in KEEP_PAGES (space-separated list)
|
||||
case " $KEEP_PAGES " in
|
||||
*" $base_dir "*)
|
||||
echo "Keeping content dir: $dir"
|
||||
;;
|
||||
*)
|
||||
echo "Removing content dir: $dir"
|
||||
rm -rf -- "$dir"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# remove public directory
|
||||
for dir in ../public/; do
|
||||
if [ "$dir" != "${KEEP_PAGES}/" ]; then
|
||||
rm -rf $dir
|
||||
fi
|
||||
for dir in ./public/*/; do
|
||||
base_dir="$(basename "${dir%/}")"
|
||||
|
||||
case " $KEEP_PAGES " in
|
||||
*" $base_dir "*)
|
||||
echo "Keeping public dir: $dir"
|
||||
;;
|
||||
*)
|
||||
echo "Removing public dir: $dir"
|
||||
rm -rf -- "$dir"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "Done clearing up resources and compiling for ${KEEP_PAGES}"
|
||||
|
||||
echo "modify next.config.js"
|
||||
|
||||
cp ./next.config.js ../next.config.js
|
||||
cp "./distribute/next.config.js" "./next.config.js"
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"scripts": {
|
||||
"dev": "next --turbopack",
|
||||
"build": "cross-env VERCEL_FORCE_NO_BUILD_CACHE=1 NODE_OPTIONS='--max-old-space-size=16384' next build",
|
||||
"build": "bash ./distribute/prebuild.sh && cross-env VERCEL_FORCE_NO_BUILD_CACHE=1 NODE_OPTIONS='--max-old-space-size=16384' next build",
|
||||
"build:test": "cross-env ANALYZE=true NODE_OPTIONS='--inspect --max-old-space-size=4096' next build",
|
||||
"build:analyze": "cross-env ANALYZE=true NODE_OPTIONS='--max-old-space-size=16384' next build",
|
||||
"postbuild": "next-sitemap && pagefind --site .next/server/app --output-path out/_pagefind",
|
||||
|
||||
Reference in New Issue
Block a user