-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathgenerate-docs.sh
More file actions
executable file
·59 lines (48 loc) · 1.47 KB
/
generate-docs.sh
File metadata and controls
executable file
·59 lines (48 loc) · 1.47 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
#!/bin/bash
# Set error handling
set -e
# Enable debug mode if DEBUG env var is set
if [ ! -z "$DEBUG" ]; then
set -x
echo "Debug mode enabled"
fi
# Get script directories
SCRIPTS_DIR=$(dirname "$0")
ROOT_DIR=$(cd "$SCRIPTS_DIR/.." && pwd)
echo "Scripts directory: $SCRIPTS_DIR"
echo "Root directory: $ROOT_DIR"
# Check if dependencies are installed in scripts directory
if [ ! -d "$SCRIPTS_DIR/node_modules" ]; then
echo "Required dependencies not found. Installing now..."
bash "$SCRIPTS_DIR/setup-doc-generator.sh"
fi
# Generate documentation
echo "Generating block documentation..."
# Check if necessary files exist
if [ ! -f "$SCRIPTS_DIR/generate-block-docs.ts" ]; then
echo "Error: Could not find generate-block-docs.ts script"
ls -la "$SCRIPTS_DIR"
exit 1
fi
if [ ! -f "$SCRIPTS_DIR/tsconfig.json" ]; then
echo "Error: Could not find tsconfig.json in scripts directory"
exit 1
fi
# Check if npx is available
if ! command -v npx &> /dev/null; then
echo "Error: npx is not installed. Please install Node.js first."
exit 1
fi
# Change to scripts directory to use local dependencies
cd "$SCRIPTS_DIR"
echo "Executing: npx tsx ./generate-block-docs.ts"
# Run the generator with tsx using local dependencies
if ! npx tsx ./generate-block-docs.ts; then
echo ""
echo "Error running documentation generator."
echo ""
echo "For more detailed debugging, run with DEBUG=1:"
echo "DEBUG=1 ./scripts/generate-docs.sh"
exit 1
fi
echo "Documentation generation complete!"