-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-quick.sh
More file actions
executable file
·115 lines (93 loc) · 2.43 KB
/
test-quick.sh
File metadata and controls
executable file
·115 lines (93 loc) · 2.43 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
# Quick test script for CI/CD environments
# Tests basic build functionality without running servers
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m'
print_section() {
echo ""
echo "================================================"
echo -e "${BLUE}$1${NC}"
echo "================================================"
}
print_success() {
echo -e "${GREEN}✓${NC} $1"
}
print_error() {
echo -e "${RED}✗${NC} $1"
}
TEST_DIR=$(mktemp -d -t objectdocs-quick-test.XXXXXXXXXX)
# Cleanup on exit
cleanup() {
if [ -d "$TEST_DIR" ]; then
rm -rf "$TEST_DIR" 2>/dev/null || true
fi
}
trap cleanup EXIT
main() {
print_section "ObjectDocs Quick Build Test"
# Detect monorepo root BEFORE changing directories
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MONOREPO_ROOT="${SCRIPT_DIR}"
# Create test project
mkdir -p "$TEST_DIR"
cd "$TEST_DIR"
echo "{}" > package.json
print_success "Initialized project"
# Install CLI from workspace (detect monorepo root)
if [ -d "$MONOREPO_ROOT/packages/cli" ]; then
pnpm add -D "$MONOREPO_ROOT/packages/cli"
print_success "Installed @objectdocs/cli from local workspace"
else
# Fallback to npm if not in monorepo
pnpm add -D @objectdocs/cli
print_success "Installed @objectdocs/cli from npm"
fi
# Initialize ObjectDocs (this will create content/package.json)
pnpm objectdocs init
print_success "Initialized ObjectDocs"
# Create minimal content
mkdir -p content/docs
cat > content/docs.site.json << 'EOF'
{
"branding": {
"name": "Test Site"
}
}
EOF
cat > content/docs/meta.json << 'EOF'
{
"pages": ["index"]
}
EOF
cat > content/docs/index.mdx << 'EOF'
---
title: Test
description: Test page
---
# Test Page
EOF
print_success "Created content"
# Run build from content directory
print_section "Running Build"
cd content
if npm run build; then
print_success "Build completed successfully"
else
print_error "Build failed"
exit 1
fi
# Check build output
if [ -d ".fumadocs/.next" ]; then
print_success "Build output exists"
else
print_error "Build output not found"
exit 1
fi
print_section "Summary"
echo -e "${GREEN}✅ Quick build test passed!${NC}"
}
main "$@"