mirror of
https://github.com/rememberber/MooTool.git
synced 2026-12-01 03:18:19 +08:00
22 lines
698 B
JavaScript
22 lines
698 B
JavaScript
import { spawnSync } from 'node:child_process'
|
|
import { dirname, join } from 'node:path'
|
|
import { createRequire } from 'node:module'
|
|
|
|
const require = createRequire(import.meta.url)
|
|
const electronPackagePath = require.resolve('electron/package.json')
|
|
const installerPath = join(dirname(electronPackagePath), 'install.js')
|
|
const mirror = process.env.ELECTRON_MIRROR
|
|
|| process.env.npm_config_electron_mirror
|
|
|| 'https://npmmirror.com/mirrors/electron/'
|
|
|
|
const result = spawnSync(process.execPath, [installerPath], {
|
|
stdio: 'inherit',
|
|
env: {
|
|
...process.env,
|
|
ELECTRON_MIRROR: mirror
|
|
}
|
|
})
|
|
|
|
if (result.error) throw result.error
|
|
if (result.status !== 0) process.exit(result.status ?? 1)
|