fork of hey-api/openapi-ts because I need some additional things
at main 1.4 kB view raw
1#!/usr/bin/env bash 2 3# Check if generated client code for all examples is up-to-date 4# This script is used in CI to ensure examples are kept in sync with the codebase 5 6set -e 7 8# Get the directory of this script 9SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" 10ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" 11 12echo "Checking if generated code is up-to-date..." 13 14# Generate fresh code 15"$SCRIPT_DIR/examples-generate.sh" 16 17# Check if there are any changes 18if ! git diff --quiet; then 19 echo "" 20 echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" 21 echo "❌ ERROR: Generated code is out of sync!" 22 echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" 23 echo "" 24 echo "The following files have changed:" 25 git diff --name-only 26 echo "" 27 echo "To fix this, run:" 28 echo " pnpm examples:generate" 29 echo "" 30 echo "Then commit the changes." 31 exit 1 32fi 33 34echo "" 35echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" 36echo "✅ All generated code is up-to-date!" 37echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"