fix(cli): js binding template

This commit is contained in:
LongYinan 2022-01-19 17:20:27 +08:00
parent 1b0b075b48
commit 25f6754a71
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7

View file

@ -16,28 +16,43 @@ function isMusl() {
try {
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
} catch (e) {
return false
return true
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !Boolean(glibcVersionRuntime)
return !glibcVersionRuntime
}
}
switch (platform) {
case 'android':
if (arch !== 'arm64') {
throw new Error(\`Unsupported architecture on Android \${arch}\`)
}
localFileExisted = existsSync(join(__dirname, '${localName}.android-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./${localName}.android-arm64.node')
} else {
nativeBinding = require('${pkgName}-android-arm64')
}
} catch (e) {
loadError = e
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, '${localName}.android-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./${localName}.android-arm64.node')
} else {
nativeBinding = require('${pkgName}-android-arm64')
}
} catch (e) {
loadError = e
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, '${localName}.android-arm-eabi.node'))
try {
if (localFileExisted) {
nativeBinding = require('./${localName}.android-arm-eabi.node')
} else {
nativeBinding = require('${pkgName}-android-arm-eabi')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(\`Unsupported architecture on Android \${arch}\`)
}
break
case 'win32':