-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
118 lines (103 loc) · 2.73 KB
/
Copy pathsetup.sh
File metadata and controls
118 lines (103 loc) · 2.73 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
#!/bin/bash
# Exit on error
set -e
# Print commands
set -x
echo "Setting up SCode Analyzer..."
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "Node.js is not installed. Please install Node.js and npm."
exit 1
fi
# Check if npm is installed
if ! command -v npm &> /dev/null; then
echo "npm is not installed. Please install npm."
exit 1
fi
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "Python 3 is not installed. Please install Python 3."
exit 1
fi
# Create directories if they don't exist
mkdir -p media/shaders
mkdir -p media/components
mkdir -p media/utils
mkdir -p dist
# Install dependencies
echo "Installing Node.js dependencies..."
npm install
npm install --save-dev copy-webpack-plugin raw-loader
# Install required Python packages for the backend
echo "Setting up Python backend..."
if [ -d "backend" ]; then
cd backend
python3 -m venv .venv || echo "Virtual environment already exists."
source .venv/bin/activate || source .venv/Scripts/activate
pip install -r requirements.txt
cd ..
fi
# Build the extension
echo "Building the extension..."
npm run build
# Create .vscode directory if it doesn't exist
mkdir -p .vscode
# Create launch.json if it doesn't exist
if [ ! -f ".vscode/launch.json" ]; then
echo "Creating launch.json..."
cat > .vscode/launch.json << 'EOL'
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: build"
}
]
}
EOL
fi
# Create tasks.json if it doesn't exist
if [ ! -f ".vscode/tasks.json" ]; then
echo "Creating tasks.json..."
cat > .vscode/tasks.json << 'EOL'
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$tsc-watch"
},
{
"type": "npm",
"script": "watch",
"isBackground": true,
"group": "build",
"problemMatcher": "$tsc-watch"
}
]
}
EOL
fi
# Make the script executable
chmod +x setup.sh
echo ""
echo "Setup complete! To run the extension:"
echo "1. Open this folder in VSCode: code ."
echo "2. Press F5 to start debugging"
echo "3. In the new VSCode window that opens, open a project folder"
echo "4. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac) and type 'SCode: Analyze Code'"
echo ""