Skip to content

Commit 53fa89b

Browse files
authored
feat: open source frontend code (#74)
1 parent 5a3b858 commit 53fa89b

271 files changed

Lines changed: 48761 additions & 200 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 229 additions & 88 deletions
Large diffs are not rendered by default.

README_zh.md

Lines changed: 243 additions & 112 deletions
Large diffs are not rendered by default.

frontend/.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

frontend/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
node_modules
2+
dist
3+
out
4+
.DS_Store
5+
.eslintcache
6+
*.log*
7+
/backend
8+
/externals/python/window_inspector/venv
9+
/externals/python/window_inspector/build
10+
/externals/python/window_inspector/dist
11+
/externals/python/window_capture/venv
12+
/externals/python/window_capture/build
13+
/externals/python/window_capture/dist
14+
15+
frontend.zip

frontend/.npmrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
electron_mirror=https://npmmirror.com/mirrors/electron/
2+
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/
3+
shamefully-hoist=true
4+

frontend/.prettierignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Build outputs
2+
out
3+
dist
4+
build
5+
6+
# Lock files
7+
pnpm-lock.yaml
8+
package-lock.json
9+
yarn.lock
10+
11+
# License and configs
12+
LICENSE.md
13+
tsconfig.json
14+
tsconfig.*.json
15+
16+
# Dependencies
17+
node_modules/
18+
19+
# Logs
20+
*.log
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
pnpm-debug.log*
25+
26+
# Environment
27+
.env*
28+
29+
# IDE
30+
.vscode/
31+
.idea/
32+
*.swp
33+
*.swo
34+
35+
# OS
36+
.DS_Store
37+
Thumbs.db

frontend/.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"bracketSameLine": true,
3+
"endOfLine": "lf",
4+
"jsonRecursiveSort": true,
5+
"jsonSortOrder": "{\"*\": \"lexical\"}",
6+
"plugins": ["prettier-plugin-sort-json"],
7+
"printWidth": 120,
8+
"semi": false,
9+
"singleQuote": true,
10+
"trailingComma": "none"
11+
}

frontend/.prettierrc.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
singleQuote: true
2+
semi: false
3+
printWidth: 100
4+
trailingComma: none

frontend/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# vikingdb-open
2+
3+
An Electron application with React and TypeScript
4+
5+
## Recommended IDE Setup
6+
7+
- [VSCode](https://code.visualstudio.com/) + [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
8+
9+
## Project Setup
10+
11+
### Install
12+
13+
```bash
14+
$ pnpm install
15+
```
16+
17+
### Development
18+
19+
```bash
20+
$ pnpm dev
21+
```
22+
23+
### Build
24+
25+
```bash
26+
# For windows
27+
$ pnpm build:win
28+
29+
# For macOS
30+
$ pnpm build:mac
31+
32+
# For Linux
33+
$ pnpm build:linux
34+
```
35+
36+
### data
37+
38+
/Users/bytedance/Library/Application\ Support/VikingdbAtlasDev

frontend/build-python.sh

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/usr/bin/env bash
2+
3+
# This script builds all necessary Python executables for the application.
4+
5+
set -e # Exit immediately if a command fails.
6+
7+
# Get the directory where this script is located to resolve paths correctly.
8+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
9+
EXTERNALS_DIR="$SCRIPT_DIR/externals/python"
10+
11+
# --- Reusable Build Function ---
12+
# This function handles the logic for building a single Python executable.
13+
# Arguments:
14+
# $1: The directory of the Python project to build (e.g., "window_inspector").
15+
build_python_executable() {
16+
local component_name=$1
17+
local component_dir="$EXTERNALS_DIR/$component_name"
18+
19+
echo ""
20+
echo "--- Building: $component_name ---"
21+
22+
if [ ! -d "$component_dir" ]; then
23+
echo "❌ Error: Directory not found at $component_dir"
24+
return 1
25+
fi
26+
27+
echo "📂 Navigating to $component_dir"
28+
cd "$component_dir"
29+
30+
# --- Pre-build Check ---
31+
# Check if the executable already exists to skip unnecessary work.
32+
local executable_path_dir="dist/$component_name/$component_name"
33+
local executable_path_file="dist/$component_name"
34+
35+
if [ -f "$executable_path_dir" ] || [ -f "$executable_path_file" ]; then
36+
echo "✅ Executable for $component_name already exists. Skipping build."
37+
return 0 # Successfully skipped
38+
fi
39+
40+
echo "🔎 Executable not found for $component_name. Proceeding with build..."
41+
42+
echo "🐍 Creating Python virtual environment..."
43+
python3 -m venv venv
44+
45+
echo "🐍 Activating virtual environment..."
46+
source venv/bin/activate
47+
48+
if [ -f "requirements.txt" ]; then
49+
echo "📦 Installing dependencies from requirements.txt..."
50+
pip3 install -r requirements.txt
51+
else
52+
echo "⚠️ Warning: requirements.txt not found in $component_dir."
53+
fi
54+
55+
echo "📦 Installing PyInstaller..."
56+
pip3 install pyinstaller
57+
58+
if [ -f "$component_name.spec" ]; then
59+
echo "🛠️ Building executable with PyInstaller ($component_name.spec)..."
60+
pyinstaller "$component_name.spec"
61+
else
62+
echo "❌ Error: $component_name.spec not found. Cannot build."
63+
deactivate
64+
return 1
65+
fi
66+
67+
# --- Post-build Verification ---
68+
echo "🔎 Verifying build output..."
69+
if [ -f "$executable_path_dir" ]; then
70+
echo "✅ Executable created at $executable_path_dir"
71+
elif [ -f "$executable_path_file" ]; then
72+
echo "✅ Executable created at $executable_path_file"
73+
else
74+
echo "❌ Error: Build verification failed. Executable not found in 'dist/' directory after build."
75+
deactivate
76+
return 1
77+
fi
78+
79+
echo "✅ Successfully built $component_name."
80+
deactivate
81+
}
82+
83+
# --- Build All Components ---
84+
echo "🚀 Starting Python build process..."
85+
86+
build_python_executable "window_inspector"
87+
build_python_executable "window_capture"
88+
89+
echo ""
90+
echo "🎉 All Python executables have been built successfully!"

0 commit comments

Comments
 (0)