chore: bump to v0.9.19-rc.1 and add local OpenAPI build support
- Add release candidate (rc) support to release.sh with latestRC tagging - Bump VERSION, backend pyproject.toml, and frontend package.json to 0.9.19-rc.1 - Add local frontend/openapi.json so build no longer needs running backend - Update generate:types and validate-types.sh to use local openapi.json - Fix frontend tests: remove unused imports/variables and update mock data
This commit is contained in:
@@ -17,17 +17,23 @@ GENERATED_FILE="${TYPES_DIR}/generated.ts"
|
||||
TEMP_FILE=$(mktemp)
|
||||
trap "rm -f $TEMP_FILE" EXIT
|
||||
|
||||
# Check if backend is accessible
|
||||
# Determine OpenAPI source: local file or backend URL
|
||||
BACKEND_URL="${BANGUI_BACKEND_URL:-http://localhost:8000}"
|
||||
if ! curl -sf "${BACKEND_URL}/api/openapi.json" > /dev/null 2>&1; then
|
||||
echo "❌ Backend not accessible at ${BACKEND_URL}/api/openapi.json" >&2
|
||||
OPENAPI_SOURCE=""
|
||||
|
||||
if [[ -f "${FRONTEND_DIR}/openapi.json" ]]; then
|
||||
OPENAPI_SOURCE="${FRONTEND_DIR}/openapi.json"
|
||||
echo "📋 Validating OpenAPI schema types (local openapi.json)..."
|
||||
elif curl -sf "${BACKEND_URL}/api/openapi.json" > /dev/null 2>&1; then
|
||||
OPENAPI_SOURCE="${BACKEND_URL}/api/openapi.json"
|
||||
echo "📋 Validating OpenAPI schema types (backend ${BACKEND_URL})..."
|
||||
else
|
||||
echo "❌ Backend not accessible at ${BACKEND_URL}/api/openapi.json and no local openapi.json found" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "📋 Validating OpenAPI schema types..."
|
||||
|
||||
# Generate types to a temporary file
|
||||
if ! npx openapi-typescript "${BACKEND_URL}/api/openapi.json" -o "$TEMP_FILE" 2>&1; then
|
||||
if ! npx openapi-typescript "${OPENAPI_SOURCE}" -o "$TEMP_FILE" 2>&1; then
|
||||
echo "❌ Failed to generate types from OpenAPI schema" >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user