tangled
alpha
login
or
join now
mokkenstorm.dev
/
openapi-ts
0
fork
atom
fork of hey-api/openapi-ts because I need some additional things
0
fork
atom
overview
issues
pulls
pipelines
test: print logs
Lubos
4 months ago
0b773597
0a76a039
+6
-36
1 changed file
expand all
collapse all
unified
split
scripts
examples-generate.sh
+6
-36
scripts/examples-generate.sh
···
10
10
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
11
11
12
12
echo "⏳ Generating client code for all examples..."
13
13
-
# Build the CLI package so its bin is available to examples in the workspace.
14
14
-
echo "Building @hey-api/openapi-ts (required for example generation)..."
15
15
-
if pnpm -w -s --version >/dev/null 2>&1; then
16
16
-
pnpm -w -s --filter "@hey-api/openapi-ts" build
17
17
-
else
18
18
-
pnpm -s --filter "@hey-api/openapi-ts" build
19
19
-
fi
20
13
21
14
# Find all examples with openapi-ts script and generate code in parallel
22
15
# Concurrency control: adjust this number depending on CI machine resources
···
52
45
echo "Generating: $example_name"
53
46
set -e
54
47
cd "$dir"
55
55
-
echo "-> Debug: node $(node --version 2>/dev/null || echo 'node-not-found')"
56
56
-
echo "-> Debug: pnpm $(pnpm --version 2>/dev/null || echo 'pnpm-not-found')"
57
57
-
echo "-> Debug: pwd $(pwd)"
58
58
-
echo "-> Running pnpm run openapi-ts (invokes package script in example)"
59
59
-
# Run the example's package script so pnpm resolves the workspace binary correctly
60
60
-
# Use silent mode to keep logs concise but preserve errors
61
61
-
echo "--- begin openapi-ts output ---"
62
62
-
if pnpm -s --version >/dev/null 2>&1; then
63
63
-
pnpm -s run openapi-ts || rc=$?
64
64
-
else
65
65
-
pnpm run openapi-ts || rc=$?
66
66
-
fi
67
67
-
rc=${rc:-0}
68
68
-
echo "--- end openapi-ts output (rc=$rc) ---"
69
69
-
if [ "$rc" -ne 0 ]; then
70
70
-
echo "openapi-ts failed with exit code $rc"
71
71
-
exit $rc
72
72
-
fi
48
48
+
echo "-> Running openapi-ts"
49
49
+
pnpm run openapi-ts
73
50
74
51
# Format generated files in this example only to keep the step fast
75
52
if command -v pnpm >/dev/null 2>&1 && pnpm -w -s --version >/dev/null 2>&1; then
···
103
80
# Read the metadata file which contains the path to the real log
104
81
logpath=$(cat "$tmpdir/$pid.log" 2>/dev/null || echo "")
105
82
if [ -n "$logpath" ] && [ -f "$logpath" ]; then
106
106
-
echo "❌ $name failed — showing log excerpt ($logpath):"
107
107
-
echo "---- log excerpt (last 200 lines) ----"
108
108
-
tail -n 200 "$logpath" || true
109
109
-
echo "---- possible error lines (case-insensitive match: error|exception|failed) ----"
110
110
-
if grep -iE 'error|exception|failed' "$logpath" >/dev/null 2>&1; then
111
111
-
# show up to 200 matching lines to keep CI output bounded
112
112
-
grep -iE 'error|exception|failed' "$logpath" | sed -n '1,200p' || true
113
113
-
else
114
114
-
echo "(no obvious error lines found in log)"
115
115
-
fi
116
116
-
echo "Full log available at: $logpath"
83
83
+
echo "❌ $name failed — showing full log ($logpath):"
84
84
+
echo "---- full log start ----"
85
85
+
cat "$logpath" || true
86
86
+
echo "---- full log end ----"
117
87
else
118
88
echo "❌ $name failed — no log found (metadata: $tmpdir/$pid.log)"
119
89
fi