-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·108 lines (92 loc) · 2.57 KB
/
install.sh
File metadata and controls
executable file
·108 lines (92 loc) · 2.57 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
#!/bin/sh
# Praxis-Docs Installer Script
# This script installs praxisdoc using the best available method
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Helper functions
info() {
printf "${BLUE}ℹ${NC} %s\n" "$1"
}
success() {
printf "${GREEN}✓${NC} %s\n" "$1"
}
warning() {
printf "${YELLOW}⚠${NC} %s\n" "$1"
}
error() {
printf "${RED}✗${NC} %s\n" "$1"
exit 1
}
# Check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Detect operating system
detect_os() {
case "$(uname -s)" in
Linux*) echo "linux";;
Darwin*) echo "macos";;
MINGW*|MSYS*|CYGWIN*) echo "windows";;
*) echo "unknown";;
esac
}
info "Praxis-Docs Installer (v2.0)"
echo ""
OS=$(detect_os)
info "Detected OS: $OS"
# Check for Deno
if command_exists deno; then
info "Found Deno: $(deno --version | head -n1)"
echo ""
info "Installing praxisdoc via Deno JSR..."
# Install from JSR
if deno install -A -f -n praxisdoc jsr:@plures/praxisdoc/cli; then
success "Successfully installed praxisdoc via Deno!"
echo ""
info "You can now run: praxisdoc gen --config=.praxisDoc.json"
info "Or use legacy command: statedoc gen --config=.stateDoc.json"
exit 0
else
warning "Failed to install via Deno JSR, trying alternative methods..."
fi
fi
# Check for npm/npx
if command_exists npm; then
info "Found npm: $(npm --version)"
echo ""
info "Installing praxisdoc via npm..."
if npm install -g @plures/praxisdoc; then
success "Successfully installed praxisdoc via npm!"
echo ""
info "You can now run: praxisdoc gen --config=.praxisDoc.json"
info "Or use legacy command: statedoc gen --config=.stateDoc.json"
exit 0
else
warning "Failed to install via npm globally"
fi
fi
# Check for npx (can be used without global install)
if command_exists npx; then
success "Found npx! You can use praxisdoc without installation:"
echo ""
info "Run: npx @plures/praxisdoc gen --config=.praxisDoc.json"
echo ""
warning "Note: This will download and run the latest version each time."
exit 0
fi
# No suitable runtime found
echo ""
printf "${RED}✗${NC} Could not find Deno or Node.js/npm.\n"
echo ""
echo "Please install one of the following:"
echo ""
echo " • Deno: curl -fsSL https://deno.land/install.sh | sh"
echo " • Node.js: https://nodejs.org/"
echo ""
echo "Then run this installer again."
exit 1