From d6c79b3fd6d5241f91ac761f772d276d9ddb518c Mon Sep 17 00:00:00 2001 From: ShabibMahamood Date: Thu, 14 Nov 2024 19:20:15 +0530 Subject: [PATCH] Update build-cloudflare-pages.sh Enhanced some lines --- scripts/build-cloudflare-pages.sh | 40 +++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/scripts/build-cloudflare-pages.sh b/scripts/build-cloudflare-pages.sh index a97f6d2f..dc77c30d 100755 --- a/scripts/build-cloudflare-pages.sh +++ b/scripts/build-cloudflare-pages.sh @@ -1,13 +1,39 @@ #!/bin/bash + +# Exit on any error set -e -npm ci -npm link -npm run build +# Functions for better readability +install_dependencies() { + echo "Installing main dependencies..." + npm ci +} + +link_package() { + echo "Linking package..." + if ! npm link &> /dev/null; then + echo "Failed to link package. Exiting." + exit 1 + fi +} + +build_package() { + echo "Building main package..." + npm run build +} + +setup_demo() { + echo "Setting up demo environment..." + cd demo + npm install + npm link dynamic-marquee # Link the main package in the demo environment + npm run build +} -cd demo -npm install -npm link dynamic-marquee -npm run build +# Run the functions in sequence +install_dependencies +link_package +build_package +setup_demo echo "Done!"