From 6e52c2af58eb92f1aa1ef1dc42f1f2b776d3c65d Mon Sep 17 00:00:00 2001 From: anabellabuckvar <41971124+anabellabuckvar@users.noreply.github.com> Date: Thu, 20 Feb 2025 17:31:22 -0500 Subject: [PATCH] Update build.sh --- build.sh | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index b62b677..d7252b9 100644 --- a/build.sh +++ b/build.sh @@ -1,8 +1,43 @@ # ensures that we always use the latest version of the script -if [ -f build-site.sh ]; then - rm build-site.sh -fi +PARSER_VERSION=0.18.16 +# This make command curls the examples for certain repos. +# If the rule doesn't exist, the error doesn't interrupt the build process. +echo "ls everything" +ls -curl https://raw.githubusercontent.com/mongodb/docs-worker-pool/netlify-poc/scripts/build-site.sh -o build-site.sh -sh build-site.sh \ No newline at end of file +make examples + +if [ ! -d "snooty-parser" ]; then + echo "Snooty parser not installed, downloading..." + curl -L -o snooty-parser.zip https://github.com/mongodb/snooty-parser/releases/download/v${PARSER_VERSION}/snooty-v${PARSER_VERSION}-linux_x86_64.zip + unzip -d ./snooty-parser snooty-parser.zip + chmod +x ./snooty-parser/snooty +fi + +echo "=======================================================================================================================================================================" +echo "========================================================================== Running parser... ==========================================================================" +./snooty-parser/snooty/snooty build . --no-caching --output=./bundle.zip --branch=${BRANCH_NAME} +echo "========================================================================== Parser complete ============================================================================" +echo "=======================================================================================================================================================================" + +if [ ! -d "snooty" ]; then + echo "Snooty frontend not installed, downloading" + git clone -b netlify-poc --depth 1 https://github.com/mongodb/snooty.git + echo GATSBY_MANIFEST_PATH=$(pwd)/bundle.zip >> ./snooty/.env.production + cd snooty + npm ci --legacy-peer-deps + git clone --depth 1 https://github.com/mongodb/docs-tools.git ./snooty/docs-tools + mkdir -p ./snooty/static/images + mv ./snooty/docs-tools/themes/mongodb/static ./static/docs-tools + mv ./snooty/docs-tools/themes/guides/static/images/bg-accent.svg ./static/docs-tools/images/bg-accent.svg +fi + + +if [ -d "docs-worker-pool" ]; then + echo "Running persistence module" + node --unhandled-rejections=strict docs-worker-pool/modules/persistence/dist/index.js --path bundle.zip --githubUser netlify +fi + + +cd snooty && npm run build:no-prefix