diff --git a/tools/deploy/admin/config.sh b/tools/deploy/admin/config.sh index 61b0170..89bf36e 100644 --- a/tools/deploy/admin/config.sh +++ b/tools/deploy/admin/config.sh @@ -146,9 +146,20 @@ print_info() { # Function to check if running from correct directory check_project_root() { + # If we're not in the React project root, try to navigate there if [ ! -f "package.json" ]; then - print_error "Please run this script from the React project root directory (mnemo_cards_admin/web)" - exit 1 + # Assume we're running from tools/deploy/admin, navigate to mnemo_cards_admin/web + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../mnemo_cards_admin/web" && pwd)" + + if [ -f "$PROJECT_ROOT/package.json" ]; then + print_info "Navigating to React project root: $PROJECT_ROOT" + cd "$PROJECT_ROOT" + else + print_error "Please run this script from the React project root directory (mnemo_cards_admin/web) or from tools/deploy/admin/" + print_error "Could not find package.json at: $PROJECT_ROOT" + exit 1 + fi fi }