fix(cli): js binding template
This commit is contained in:
parent
1b0b075b48
commit
25f6754a71
1 changed files with 29 additions and 14 deletions
|
@ -16,28 +16,43 @@ function isMusl() {
|
||||||
try {
|
try {
|
||||||
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
|
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const { glibcVersionRuntime } = process.report.getReport().header
|
const { glibcVersionRuntime } = process.report.getReport().header
|
||||||
return !Boolean(glibcVersionRuntime)
|
return !glibcVersionRuntime
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'android':
|
case 'android':
|
||||||
if (arch !== 'arm64') {
|
switch (arch) {
|
||||||
throw new Error(\`Unsupported architecture on Android \${arch}\`)
|
case 'arm64':
|
||||||
}
|
localFileExisted = existsSync(join(__dirname, '${localName}.android-arm64.node'))
|
||||||
localFileExisted = existsSync(join(__dirname, '${localName}.android-arm64.node'))
|
try {
|
||||||
try {
|
if (localFileExisted) {
|
||||||
if (localFileExisted) {
|
nativeBinding = require('./${localName}.android-arm64.node')
|
||||||
nativeBinding = require('./${localName}.android-arm64.node')
|
} else {
|
||||||
} else {
|
nativeBinding = require('${pkgName}-android-arm64')
|
||||||
nativeBinding = require('${pkgName}-android-arm64')
|
}
|
||||||
}
|
} catch (e) {
|
||||||
} catch (e) {
|
loadError = 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
|
break
|
||||||
case 'win32':
|
case 'win32':
|
||||||
|
|
Loading…
Reference in a new issue