mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
pnpm 12's npm_execpath is a Mach-O/PE binary. build-native-for-platform.mjs still launched it with `node $npm_execpath`, which throws SyntaxError on the binary header and fails every signed macOS dev-channel build.
42 lines
1.2 KiB
JavaScript
Executable File
42 lines
1.2 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { spawnSync } from 'node:child_process'
|
|
import { resolvePnpmCliInvocation } from './pnpm-cli-invocation.mjs'
|
|
|
|
if (process.platform === 'win32') {
|
|
runNodeScript('config/scripts/build-windows-cli-launcher.mjs')
|
|
process.exit(0)
|
|
}
|
|
|
|
if (process.platform !== 'darwin') {
|
|
console.log(`[native-build] no macOS native computer build required on ${process.platform}`)
|
|
process.exit(0)
|
|
}
|
|
|
|
runPnpmScript('build:computer-macos')
|
|
runPnpmScript('build:keyboard-layout-macos')
|
|
runPnpmScript('build:notification-status-macos')
|
|
process.exit(0)
|
|
|
|
function runPnpmScript(scriptName) {
|
|
const { command, prefixArgs, shell } = resolvePnpmCliInvocation()
|
|
const result = spawnSync(command, [...prefixArgs, 'run', scriptName], { stdio: 'inherit', shell })
|
|
|
|
if (result.signal) {
|
|
process.kill(process.pid, result.signal)
|
|
}
|
|
if (result.status !== 0 || result.error) {
|
|
process.exit(result.status ?? 1)
|
|
}
|
|
}
|
|
|
|
function runNodeScript(scriptPath) {
|
|
const result = spawnSync(process.execPath, [scriptPath], { stdio: 'inherit' })
|
|
if (result.signal) {
|
|
process.kill(process.pid, result.signal)
|
|
}
|
|
if (result.status !== 0 || result.error) {
|
|
process.exit(result.status ?? 1)
|
|
}
|
|
}
|