fix: macos intel build

This commit is contained in:
linonetwo 2025-12-08 14:01:38 +08:00
parent ea89bddcec
commit b8a9bbcf3d
4 changed files with 50 additions and 6 deletions

View file

@ -35,9 +35,13 @@ jobs:
- os: ubuntu-latest
platform: linux
arch: arm64
- os: macos-latest
# Use macos-13 (Intel) for x64 builds to get correct dugite git binaries
# Note: macos-13 is deprecated but macos-15-large (Intel) requires paid plan
# When macos-13 is fully deprecated, switch to macos-15-large or use cross-compilation workaround
- os: macos-13
platform: mac
arch: x64
# Use macos-latest (ARM64) for arm64 builds
- os: macos-latest
platform: mac
arch: arm64

43
docs/Release.md Normal file
View file

@ -0,0 +1,43 @@
# Release App
See [.github/workflows/release.yml](.github/workflows/release.yml)
## macOS Runner Architecture Mismatch Issue
If you build x64 version on an ARM64 runner, dugite will download ARM64 git binaries. When users run the x64 app on Intel Mac, it fails with error: `spawn Unknown system error -86 (EBADEXEC)`.
Solution: Use architecture-specific runners:
- Use `macos-13` for x64 builds (free)
- Use `macos-latest` for arm64 builds (free)
See `.github/workflows/release.yml` matrix configuration.
### Future: When macos-13 is Deprecated
When GitHub fully deprecates `macos-13`, you have two options:
Option A (Simple, Costs Money):
Replace `macos-13` with `macos-15-large` in release.yml. Note that `-large` runners require GitHub Team or Enterprise plan and incur charges even for public repos.
Option B (Complex, Free):
Use npm_config_arch environment variable to force dugite download correct architecture on ARM64 runner:
```yaml
- name: Install dependencies
run: pnpm install
env:
npm_config_arch: ${{ matrix.arch }}
```
This tells dugite's postinstall script which architecture to download, regardless of host machine. See `node_modules/dugite/script/config.js` for details.
## App Size Reduction
dugite bundles a full git distribution. The package contains unnecessary components for TidGi:
- 141 git command symlinks (all point to main git binary, only needed if directly invoking `git-add` instead of `git add`)
- Git LFS (13MB, TiddlyWiki wikis don't use LFS)
- Git Credential Manager + .NET runtime (26MB on macOS, TidGi embeds credentials directly in URLs)
afterPack script automatically removes these, saving approximately 40-60MB per platform. See `scripts/trimDugite.ts` for implementation details.

View file

@ -2,7 +2,7 @@
"name": "tidgi",
"productName": "TidGi",
"description": "Customizable personal knowledge-base with Github as unlimited storage and blogging platform.",
"version": "0.13.0-prerelease15",
"version": "0.13.0-prerelease16",
"license": "MPL 2.0",
"packageManager": "pnpm@10.24.0",
"scripts": {

View file

@ -5,7 +5,6 @@
*/
import fs from 'fs-extra';
import path from 'path';
import { trimUnusedGitCommands } from './trimDugite';
/**
* Running afterPack hook
@ -83,13 +82,11 @@ export default (
console.log('Copy dugite');
// it has things like `git/bin/libexec/git-core/git-add` link to `git/bin/libexec/git-core/git`, to reduce size, so can't use `dereference: true, recursive: true` here.
const dugiteDestination = path.join(cwd, 'node_modules', 'dugite');
fs.copySync(
path.join(sourceNodeModulesFolder, 'dugite'),
dugiteDestination,
path.join(cwd, 'node_modules', 'dugite'),
{ dereference: false },
);
trimUnusedGitCommands(dugiteDestination, platform);
if (platform === 'win32') {
console.log('Copy registry-js (Windows only)');