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.
|
# 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"
|
export KEEP_PAGES="Math3200"
|
||||||
|
|
||||||
# check if environment variable is set
|
# 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."
|
echo "Please set environment variable KEEP_PAGES to the pages you want to keep for microsite building."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -13,26 +14,44 @@ echo "Currently compiling pages: ${KEEP_PAGES}"
|
|||||||
# Rewrite base _meta.js and next.config.js for export 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}"
|
||||||
|
|
||||||
cp ./${KEEP_PAGES}/_meta.js ../content/_meta.js
|
cp "./distribute/${KEEP_PAGES}/_meta.js" "./content/_meta.js"
|
||||||
|
|
||||||
# remove other subdirectories
|
# remove other subdirectories
|
||||||
for dir in ../content/; do
|
for dir in ./content/*/; do
|
||||||
if [ "$dir" != "${KEEP_PAGES}/" ]; then
|
# strip the leading path and trailing slash
|
||||||
rm -rf $dir
|
base_dir="$(basename "${dir%/}")"
|
||||||
fi
|
|
||||||
|
# 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
|
done
|
||||||
|
|
||||||
# remove public directory
|
# remove public directory
|
||||||
for dir in ../public/; do
|
for dir in ./public/*/; do
|
||||||
if [ "$dir" != "${KEEP_PAGES}/" ]; then
|
base_dir="$(basename "${dir%/}")"
|
||||||
rm -rf $dir
|
|
||||||
fi
|
case " $KEEP_PAGES " in
|
||||||
|
*" $base_dir "*)
|
||||||
|
echo "Keeping public dir: $dir"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Removing public dir: $dir"
|
||||||
|
rm -rf -- "$dir"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Done clearing up resources and compiling for ${KEEP_PAGES}"
|
echo "Done clearing up resources and compiling for ${KEEP_PAGES}"
|
||||||
|
|
||||||
echo "modify next.config.js"
|
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": {
|
"scripts": {
|
||||||
"dev": "next --turbopack",
|
"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: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",
|
"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",
|
"postbuild": "next-sitemap && pagefind --site .next/server/app --output-path out/_pagefind",
|
||||||
|
|||||||
Reference in New Issue
Block a user