-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·78 lines (64 loc) · 2.01 KB
/
build.sh
File metadata and controls
executable file
·78 lines (64 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Check for required tools
MISSING_TOOLS=()
for cmd in curl jq yq; do
if ! command -v "$cmd" &> /dev/null; then
MISSING_TOOLS+=("$cmd")
fi
done
if ! command -v java &> /dev/null; then
MISSING_TOOLS+=("java")
fi
if ! command -v pnpm &> /dev/null && ! command -v npx &> /dev/null; then
MISSING_TOOLS+=("pnpm or npm")
fi
if [ ${#MISSING_TOOLS[@]} -ne 0 ]; then
echo "Error: Missing required tools: ${MISSING_TOOLS[*]}"
echo ""
echo "You can install them using asdf (https://asdf-vm.com/):"
echo ""
echo " 1. Install asdf: https://asdf-vm.com/guide/getting-started.html"
echo ""
echo " 2. Add the required plugins:"
echo " asdf plugin add nodejs"
echo " asdf plugin add java"
echo " asdf plugin add jq"
echo " asdf plugin add yq"
echo ""
echo " 3. Install tools from .tool-versions:"
echo " asdf install"
echo ""
echo " 4. Install pnpm (if not available):"
echo " npm install -g pnpm"
echo ""
echo " Note: curl is typically available on most systems."
echo " On Debian/Ubuntu: sudo apt install curl"
echo " On macOS: brew install curl"
exit 1
fi
# Step 1: Fetch OpenAPI spec
echo "Fetching OpenAPI specification..."
"$SCRIPT_DIR/scripts/fetch-openapi-spec.sh"
# Step 2: Fix OpenAPI spec compatibility issues
echo ""
"$SCRIPT_DIR/scripts/fix-openapi-spec.sh"
# Step 3: Clean up previous generated code
echo ""
echo "Cleaning up previous generated code..."
rm -rf docs src test
# Step 4: Generate client using openapi-generator-cli
echo ""
echo "Generating client code..."
if command -v pnpm &> /dev/null; then
pnpm dlx @openapitools/openapi-generator-cli generate
else
npx @openapitools/openapi-generator-cli generate
fi
# Step 5: Upgrade PHP syntax with Rector
echo ""
echo "Upgrading PHP syntax with Rector..."
./vendor/bin/rector process --no-progress-bar
echo ""
echo "Build complete!"