cli: darwin universal support in js-binding-template.ts

This commit is contained in:
Tadas Dailyda 2022-12-13 16:59:10 +02:00 committed by LongYinan
parent b8bb2e5e4a
commit 2afdfe7aee

View file

@ -105,6 +105,15 @@ switch (platform) {
} }
break break
case 'darwin': case 'darwin':
localFileExisted = existsSync(join(__dirname, '${localName}.darwin-universal.node'))
try {
if (localFileExisted) {
nativeBinding = require('./${localName}.darwin-universal.node')
} else {
nativeBinding = require('${pkgName}-darwin-universal')
}
break
} catch {}
switch (arch) { switch (arch) {
case 'x64': case 'x64':
localFileExisted = existsSync(join(__dirname, '${localName}.darwin-x64.node')) localFileExisted = existsSync(join(__dirname, '${localName}.darwin-x64.node'))