-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·144 lines (125 loc) · 3.96 KB
/
install.sh
File metadata and controls
executable file
·144 lines (125 loc) · 3.96 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
# =============================================================================
# SQLite Explorer - Install Script
# =============================================================================
# This script builds and installs the SQLite Explorer extension to VS Code.
#
# Usage:
# ./install.sh # Build and install
# ./install.sh --clean # Clean, build, and install
# ./install.sh --skip-build # Install existing .vsix without rebuilding
#
# Requirements:
# - Node.js (v18+)
# - npm or bun
# - VS Code CLI (code command)
# =============================================================================
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Get script directory (works even if called from another directory)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
# Extension info
EXT_NAME="sqlite-explorer"
EXT_VERSION=$(node -p "require('./package.json').version")
RELEASE_DIR="release"
VSIX_FILE="${RELEASE_DIR}/${EXT_NAME}-${EXT_VERSION}.vsix"
echo -e "${BLUE}=================================${NC}"
echo -e "${BLUE} SQLite Explorer Installer${NC}"
echo -e "${BLUE} Version: ${EXT_VERSION}${NC}"
echo -e "${BLUE}=================================${NC}"
echo ""
# Parse arguments
CLEAN=false
SKIP_BUILD=false
for arg in "$@"; do
case $arg in
--clean)
CLEAN=true
;;
--skip-build)
SKIP_BUILD=true
;;
--help|-h)
echo "Usage: ./install.sh [OPTIONS]"
echo ""
echo "Options:"
echo " --clean Clean build artifacts before building"
echo " --skip-build Skip build step, install existing .vsix"
echo " --help, -h Show this help message"
exit 0
;;
esac
done
# Check requirements
check_command() {
if ! command -v $1 &> /dev/null; then
echo -e "${RED}Error: $1 is not installed${NC}"
exit 1
fi
}
echo -e "${YELLOW}Checking requirements...${NC}"
check_command node
check_command npm
# Check for VS Code CLI
if command -v code &> /dev/null; then
VSCODE_CMD="code"
elif command -v code-insiders &> /dev/null; then
VSCODE_CMD="code-insiders"
elif command -v codium &> /dev/null; then
VSCODE_CMD="codium"
else
echo -e "${RED}Error: VS Code CLI not found (code, code-insiders, or codium)${NC}"
echo "Make sure VS Code is installed and 'code' is in your PATH"
exit 1
fi
echo -e "${GREEN}✓ Using: $VSCODE_CMD${NC}"
# Clean if requested
if [ "$CLEAN" = true ]; then
echo ""
echo -e "${YELLOW}Cleaning build artifacts...${NC}"
rm -rf out
rm -rf assets
rm -f *.vsix
rm -rf "$RELEASE_DIR"
echo -e "${GREEN}✓ Clean complete${NC}"
fi
# Ensure release directory exists
mkdir -p "$RELEASE_DIR"
# Build unless skipped
if [ "$SKIP_BUILD" = false ]; then
echo ""
echo -e "${YELLOW}Building extension...${NC}"
# Run the build script
node scripts/build.mjs
echo -e "${GREEN}✓ Build complete${NC}"
echo ""
echo -e "${YELLOW}Packaging extension...${NC}"
# Package the extension
npx vsce package --skip-license --out "$VSIX_FILE"
echo -e "${GREEN}✓ Package complete: ${VSIX_FILE}${NC}"
else
# Check if .vsix exists
if [ ! -f "$VSIX_FILE" ]; then
echo -e "${RED}Error: ${VSIX_FILE} not found. Run without --skip-build first.${NC}"
exit 1
fi
echo -e "${YELLOW}Using existing package: ${VSIX_FILE}${NC}"
fi
# Install the extension
echo ""
echo -e "${YELLOW}Installing extension to VS Code...${NC}"
$VSCODE_CMD --install-extension "$VSIX_FILE" --force
echo ""
echo -e "${GREEN}=================================${NC}"
echo -e "${GREEN} Installation Complete!${NC}"
echo -e "${GREEN}=================================${NC}"
echo ""
echo -e "Reload VS Code to activate the extension:"
echo -e " ${BLUE}Ctrl+Shift+P${NC} → ${BLUE}Developer: Reload Window${NC}"
echo ""