mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-06-08 00:50:27 +08:00
31 lines
703 B
JavaScript
31 lines
703 B
JavaScript
import childProcess from 'node:child_process'
|
|
import os from 'node:os'
|
|
|
|
const currentOsPlatform = os.platform()
|
|
const osPlatformToBuildCommandMap = {
|
|
darwin: 'mac',
|
|
linux: 'linux',
|
|
win32: 'win'
|
|
}
|
|
|
|
export default function buildUiOnCurrentPlatform() {
|
|
try {
|
|
const uiBuildProcess = childProcess.spawnSync(
|
|
`pnpm run build:${osPlatformToBuildCommandMap[currentOsPlatform]}`,
|
|
{
|
|
stdio: ['inherit', 'inherit', 'inherit'],
|
|
shell: true
|
|
}
|
|
)
|
|
if (uiBuildProcess.error) {
|
|
throw uiBuildProcess.error
|
|
}
|
|
} catch (error) {
|
|
console.error('error encounter when build ui:')
|
|
console.error(error)
|
|
process.exit(1)
|
|
}
|
|
}
|
|
|
|
buildUiOnCurrentPlatform()
|