docs: add discussion and认知修正 about gitea runner and sql.js migration
This commit is contained in:
@@ -52,6 +52,64 @@
|
||||
1. **Multi-select feature**: Double-click selection mode experience is not ideal, keyboard modifier key approach couldn't be implemented
|
||||
2. **TypeScript type errors**: Some type errors in NoteEditor (bold attribute doesn't exist, etc.)
|
||||
|
||||
## Gitea Runner and Release Workflow
|
||||
|
||||
### Runner Configuration
|
||||
|
||||
- **Image**: `hub.gaomia.site/titor/bun:latest` (based on Debian bookworm with Bun installed)
|
||||
- **Default label**: `ubuntu-latest`
|
||||
- **Issue**: Custom image doesn't have git pre-installed
|
||||
|
||||
**Solution**: Install git in workflow:
|
||||
|
||||
```yaml
|
||||
- name: Install git
|
||||
run: apt-get update && apt-get install -y git
|
||||
```
|
||||
|
||||
### Release Workflow (Auto-changelog)
|
||||
|
||||
Trigger on push tag (`v*`):
|
||||
|
||||
1. Clone repository using token
|
||||
2. Install dependencies: `bun install`
|
||||
3. Build: `bun run build`
|
||||
4. Create release and upload source archive:
|
||||
|
||||
```bash
|
||||
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
||||
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
||||
CHANGES=$(git log --pretty=format:"- %s (%h)" "$PREV_TAG..HEAD" 2>/dev/null || echo "")
|
||||
|
||||
# Create release via Gitea API
|
||||
curl -X POST "https://hub.gaomia.site/api/v1/repos/titor/mio/releases" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"${CHANGES}\"}"
|
||||
```
|
||||
|
||||
### Cross-platform Build Limitation
|
||||
|
||||
- Bun's `bun build --compile` runs on Linux runner → can only produce Linux executable
|
||||
- Cannot compile Windows/macOS binaries on Linux environment
|
||||
- Workaround: Publish source code archive instead of binaries
|
||||
|
||||
### Bun Compilation Bug with Native Modules
|
||||
|
||||
**Problem**: Using `@libsql/client` (native SQLite binding) causes runtime error:
|
||||
```
|
||||
error: Cannot find module '@libsql/win32-x64-msvc' from 'B:\~BUN\root\mio.exe'
|
||||
```
|
||||
|
||||
This is a known bug in Bun 1.3.4+ with native modules.
|
||||
|
||||
**Solution**: Replace `@libsql/client` with `sql.js` (pure JavaScript SQLite implementation):
|
||||
|
||||
1. Replace dependency in package.json
|
||||
2. Rewrite db.ts to use sql.js API (async initialization, different query syntax)
|
||||
3. Update all function calls in index.tsx and NoteEditor.tsx
|
||||
|
||||
Result: `bun build --compile` works correctly on all platforms.
|
||||
|
||||
## Build Instructions
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user