Add binary build system for cross-platform distribution
- Add scripts/build.ts: Bun-based build script for generating binaries
- Support macOS (x64, ARM64, Universal), Windows (x64, ARM64), Linux (x64, ARM64)
- Add build:* npm scripts for each platform (build:mac, build:win, build:linux, etc)
- Configure electron-builder with platform-specific settings:
* macOS: DMG + ZIP, Universal binaries, proper icon paths
* Windows: NSIS installer + ZIP, configurable install directory
* Linux: AppImage + DEB + tar.gz packages
- Add BUILD.md: Comprehensive build documentation with examples
- Update README.md: Add build instructions and reference BUILD.md
- Artifacts named: OpenCode Client-{version}-{os}-{arch}.{ext}
- Output directory: release/
Usage:
bun run build:mac # macOS Universal (Intel + Apple Silicon)
bun run build:win # Windows x64
bun run build:linux # Linux x64
bun run build:all # All platforms
This commit is contained in:
102
package.json
102
package.json
@@ -10,6 +10,15 @@
|
||||
"build": "electron-vite build",
|
||||
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.node.json",
|
||||
"preview": "electron-vite preview",
|
||||
"build:binaries": "bun scripts/build.ts",
|
||||
"build:mac": "bun scripts/build.ts mac",
|
||||
"build:mac-x64": "bun scripts/build.ts mac-x64",
|
||||
"build:mac-arm64": "bun scripts/build.ts mac-arm64",
|
||||
"build:win": "bun scripts/build.ts win",
|
||||
"build:win-arm64": "bun scripts/build.ts win-arm64",
|
||||
"build:linux": "bun scripts/build.ts linux",
|
||||
"build:linux-arm64": "bun scripts/build.ts linux-arm64",
|
||||
"build:all": "bun scripts/build.ts all",
|
||||
"package:mac": "electron-builder --mac",
|
||||
"package:win": "electron-builder --win",
|
||||
"package:linux": "electron-builder --linux"
|
||||
@@ -45,6 +54,97 @@
|
||||
"files": [
|
||||
"dist/**/*",
|
||||
"package.json"
|
||||
]
|
||||
],
|
||||
"mac": {
|
||||
"category": "public.app-category.developer-tools",
|
||||
"target": [
|
||||
{
|
||||
"target": "dmg",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64",
|
||||
"universal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "zip",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64",
|
||||
"universal"
|
||||
]
|
||||
}
|
||||
],
|
||||
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
|
||||
"icon": "electron/resources/icon.icns"
|
||||
},
|
||||
"dmg": {
|
||||
"contents": [
|
||||
{
|
||||
"x": 130,
|
||||
"y": 220
|
||||
},
|
||||
{
|
||||
"x": 410,
|
||||
"y": 220,
|
||||
"type": "link",
|
||||
"path": "/Applications"
|
||||
}
|
||||
]
|
||||
},
|
||||
"win": {
|
||||
"target": [
|
||||
{
|
||||
"target": "nsis",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "zip",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
],
|
||||
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
|
||||
"icon": "electron/resources/icon.ico"
|
||||
},
|
||||
"nsis": {
|
||||
"oneClick": false,
|
||||
"allowToChangeInstallationDirectory": true,
|
||||
"createDesktopShortcut": true,
|
||||
"createStartMenuShortcut": true
|
||||
},
|
||||
"linux": {
|
||||
"target": [
|
||||
{
|
||||
"target": "AppImage",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "deb",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "tar.gz",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
],
|
||||
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
|
||||
"category": "Development",
|
||||
"icon": "electron/resources/icon.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user