| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 6 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 2 个月前 | ||
| 5 个月前 | ||
| 1 个月前 | ||
| 1 个月前 | ||
| 6 个月前 | ||
| 6 个月前 | ||
| 6 个月前 |
BitFun Installer
A fully custom, branded installer for BitFun — built with Tauri 2 + React for maximum UI flexibility.
Why a Custom Installer?
Instead of relying on the generic NSIS wizard UI from Tauri's built-in bundler, this project provides:
- 100% custom UI — React-based, with smooth animations, dark theme, and brand consistency
- Modern experience — Similar to Discord, Figma, and VS Code installers
- Full control — Custom installation logic, right-click context menu, PATH integration
- Cross-platform potential — Same codebase can target Windows, macOS, and Linux
Common tasks
Requires Node.js 22.12+ and pnpm 10.15.0, matching the workspace baseline.
Install dependencies
pnpm install
Production installer builds call workspace desktop build scripts, so root dependencies are required.
Run in dev mode
pnpm run tauri:dev
Build the full installer
pnpm run installer:build
Use this as the release entrypoint. pnpm run tauri:build does not prepare validated payload assets for production.
Build installer only
pnpm run installer:build:only
installer:build:only requires an existing valid desktop executable in the expected target output path.
Architecture
BitFun-Installer/
├── src-tauri/ # Tauri / Rust backend
│ ├── src/
│ │ ├── main.rs # Entry point
│ │ ├── lib.rs # Tauri app setup
│ │ └── installer/
│ │ ├── commands.rs # Tauri IPC commands
│ │ ├── extract.rs # Archive extraction
│ │ ├── registry.rs # Windows registry (uninstall, context menu, PATH)
│ │ ├── shortcut.rs # Desktop & Start Menu shortcuts
│ │ └── types.rs # Shared types
│ ├── capabilities/
│ ├── icons/
│ ├── Cargo.toml
│ └── tauri.conf.json
├── src/ # React frontend
│ ├── pages/
│ │ ├── LanguageSelect.tsx # First screen language picker
│ │ ├── Options.tsx # Path picker + install options
│ │ ├── Progress.tsx # Install progress + confirm
│ │ ├── ModelSetup.tsx # Optional model provider setup
│ │ └── ThemeSetup.tsx # Theme preview + finish
│ ├── components/
│ │ ├── WindowControls.tsx # Custom titlebar
│ │ ├── Checkbox.tsx # Styled checkbox
│ │ └── ProgressBar.tsx # Animated progress bar
│ ├── hooks/
│ │ └── useInstaller.ts # Core installer state machine
│ ├── styles/
│ │ ├── global.css # Base styles
│ │ ├── variables.css # Design tokens
│ │ └── animations.css # Keyframe animations
│ ├── types/
│ │ └── installer.ts # TypeScript types
│ ├── App.tsx
│ └── main.tsx
├── scripts/
│ └── build-installer.cjs # End-to-end build script
├── index.html
├── package.json
├── vite.config.ts
└── tsconfig.json
Installation flow
Language Select → Options → Progress → Model Setup → Theme Setup
│ │ │ │ │
choose UI path + run real optional AI save theme,
language options install model config launch/close
Development
Prerequisites
- Node.js 22.12+
- Rust (latest stable)
- pnpm 10.15.0 via Corepack
Setup
pnpm install
Repository Hygiene
Keep generated artifacts out of commits. This project ignores:
node_modules/dist/src-tauri/target/src-tauri/payload/
Dev Mode
Run the installer in development mode with hot reload:
pnpm run tauri:dev
Uninstall Mode (Dev + Runtime)
Key behavior:
- Install phase creates
uninstall.exein the install directory. - Windows uninstall registry entry points to
"<installPath>\\uninstall.exe" --uninstall "<installPath>". - Launching with
--uninstallopens the dedicated uninstall UI flow. - Launching
uninstall.exedirectly also enters uninstall mode automatically.
Local debug command:
npx tauri dev -- -- --uninstall "D:\\tmp\\example-install-dir"
Core implementation:
- Launch arg parsing + uninstall execution: commands.rs
- Uninstall registry command: registry.rs
- Uninstall UI page: Uninstall.tsx
- Frontend mode switching and state: useInstaller.ts
Build
Full release build
pnpm run installer:build
Release artifacts embed payload files into the installer binary, so runtime installation does not depend on an external payload folder.
Full fast build
pnpm run installer:build:fast
Installer-only build
pnpm run installer:build:only
If payload validation fails, the build exits with an error.
Installer-only fast build
pnpm run installer:build:only:fast
Output
Default release output:
src-tauri/target/release/bitfun-installer.exe
Fast build output:
src-tauri/target/release-fast/bitfun-installer.exe
Customization guide
Changing the UI Theme
Edit variables.css. Colors, spacing, and animations are controlled by CSS custom properties.
Adding Install Steps
- Add a new step key to
InstallStepin installer.ts - Create a new page component in src/pages
- Add the step to the
STEPSarray in useInstaller.ts - Add the page render case in App.tsx
Modifying Install Logic
- File extraction → extract.rs
- Registry operations → registry.rs
- Shortcuts → shortcut.rs
- Tauri commands → commands.rs
Adding Installer Payload
Place the built BitFun application files in src-tauri/payload/ before building the installer. The build script handles this automatically.
During cargo build, the payload directory is packed into an embedded zip inside bitfun-installer.exe.
Integration with CI/CD
Add to your GitHub Actions workflow:
- uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v5
with:
version: 10.15.0
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
cache: pnpm
- name: Build Installer
run: |
cd BitFun-Installer
pnpm install
pnpm run installer:build:only
- name: Upload Installer
uses: actions/upload-artifact@v6
with:
name: BitFun-Installer-Exe
path: BitFun-Installer/src-tauri/target/release/bitfun-installer.exe