mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 14:03:49 +00:00
fix(coding-agent): fix standalone binary WASM loading on Linux, fixes #784
- Import photon-node from ESM entry point (photon_rs_bg.js) instead of CJS entry, allowing Bun to embed WASM in compiled binaries - Add photon.d.ts for TypeScript support of ESM entry - Add scripts/build-binaries.sh for local binary builds - Simplify GitHub workflow to use the build script - Add binaries/ to gitignore
This commit is contained in:
parent
0c33e0dee5
commit
5aa0689828
7 changed files with 177 additions and 87 deletions
82
.github/workflows/build-binaries.yml
vendored
82
.github/workflows/build-binaries.yml
vendored
|
|
@ -36,86 +36,8 @@ jobs:
|
|||
node-version: '22'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install cross-platform native bindings
|
||||
run: |
|
||||
# npm ci only installs optional deps for the current platform (linux-x64)
|
||||
# We need all platform bindings for bun cross-compilation
|
||||
# Use --force to bypass platform checks (os/cpu restrictions in package.json)
|
||||
|
||||
# Clipboard bindings for all target platforms
|
||||
npm install --no-save --force \
|
||||
@mariozechner/clipboard-darwin-arm64@0.3.0 \
|
||||
@mariozechner/clipboard-darwin-x64@0.3.0 \
|
||||
@mariozechner/clipboard-linux-x64-gnu@0.3.0 \
|
||||
@mariozechner/clipboard-linux-arm64-gnu@0.3.0 \
|
||||
@mariozechner/clipboard-win32-x64-msvc@0.3.0
|
||||
|
||||
# Sharp bindings for all target platforms
|
||||
npm install --no-save --force \
|
||||
@img/sharp-darwin-arm64@0.34.5 \
|
||||
@img/sharp-darwin-x64@0.34.5 \
|
||||
@img/sharp-linux-x64@0.34.5 \
|
||||
@img/sharp-linux-arm64@0.34.5 \
|
||||
@img/sharp-win32-x64@0.34.5 \
|
||||
@img/sharp-libvips-darwin-arm64@1.2.4 \
|
||||
@img/sharp-libvips-darwin-x64@1.2.4 \
|
||||
@img/sharp-libvips-linux-x64@1.2.4 \
|
||||
@img/sharp-libvips-linux-arm64@1.2.4
|
||||
|
||||
- name: Build all packages
|
||||
run: npm run build
|
||||
|
||||
- name: Build binaries for all platforms
|
||||
run: |
|
||||
cd packages/coding-agent
|
||||
|
||||
# Create output directories for each platform
|
||||
mkdir -p binaries/{darwin-arm64,darwin-x64,linux-x64,linux-arm64,windows-x64}
|
||||
|
||||
# Build for each platform - binary is always named 'pi' (or 'pi.exe' for Windows)
|
||||
echo "Building for darwin-arm64..."
|
||||
bun build --compile --target=bun-darwin-arm64 ./dist/cli.js --outfile binaries/darwin-arm64/pi
|
||||
|
||||
echo "Building for darwin-x64..."
|
||||
bun build --compile --target=bun-darwin-x64 ./dist/cli.js --outfile binaries/darwin-x64/pi
|
||||
|
||||
echo "Building for linux-x64..."
|
||||
bun build --compile --target=bun-linux-x64 ./dist/cli.js --outfile binaries/linux-x64/pi
|
||||
|
||||
echo "Building for linux-arm64..."
|
||||
bun build --compile --target=bun-linux-arm64 ./dist/cli.js --outfile binaries/linux-arm64/pi
|
||||
|
||||
echo "Building for windows-x64..."
|
||||
bun build --compile --target=bun-windows-x64 ./dist/cli.js --outfile binaries/windows-x64/pi.exe
|
||||
|
||||
- name: Create release archives
|
||||
run: |
|
||||
cd packages/coding-agent
|
||||
|
||||
# Copy shared files to each platform directory
|
||||
for platform in darwin-arm64 darwin-x64 linux-x64 linux-arm64 windows-x64; do
|
||||
cp package.json binaries/$platform/
|
||||
cp README.md binaries/$platform/
|
||||
cp CHANGELOG.md binaries/$platform/
|
||||
mkdir -p binaries/$platform/theme
|
||||
cp dist/modes/interactive/theme/*.json binaries/$platform/theme/
|
||||
cp -r examples binaries/$platform/
|
||||
done
|
||||
|
||||
# Create archives
|
||||
cd binaries
|
||||
|
||||
# Unix platforms (tar.gz) - use wrapper directory for mise compatibility
|
||||
# mise auto-detects single-directory archives and strips one component
|
||||
for platform in darwin-arm64 darwin-x64 linux-x64 linux-arm64; do
|
||||
mv $platform pi && tar -czf pi-$platform.tar.gz pi && mv pi $platform
|
||||
done
|
||||
|
||||
# Windows (zip)
|
||||
cd windows-x64 && zip -r ../pi-windows-x64.zip . && cd ..
|
||||
- name: Build binaries
|
||||
run: ./scripts/build-binaries.sh
|
||||
|
||||
- name: Extract changelog for this version
|
||||
id: changelog
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue