mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 14:41:24 +08:00
feat: add support for downloading and retaining @napi-rs/system-ocr packages (#9741)
- Implemented downloading of architecture-specific versions of the @napi-rs/system-ocr packages for macOS and Windows platforms in build-npm.js. - Updated after-pack.js to retain these packages during the packaging process, ensuring compatibility across different architectures.
This commit is contained in:
parent
a0fa536926
commit
9df7ac0ac2
@ -25,6 +25,12 @@ exports.default = async function (context) {
|
||||
? ['sharp-darwin-arm64', 'sharp-libvips-darwin-arm64']
|
||||
: ['sharp-darwin-x64', 'sharp-libvips-darwin-x64']
|
||||
)
|
||||
|
||||
keepPackageNodeFiles(
|
||||
node_modules_path,
|
||||
'@napi-rs',
|
||||
arch === Arch.arm64 ? ['system-ocr-darwin-arm64'] : ['system-ocr-darwin-x64']
|
||||
)
|
||||
}
|
||||
|
||||
if (platform === 'linux') {
|
||||
@ -59,6 +65,12 @@ exports.default = async function (context) {
|
||||
? ['sharp-win32-arm64', 'sharp-libvips-win32-arm64']
|
||||
: ['sharp-win32-x64', 'sharp-libvips-win32-x64']
|
||||
)
|
||||
|
||||
keepPackageNodeFiles(
|
||||
node_modules_path,
|
||||
'@napi-rs',
|
||||
arch === Arch.arm64 ? ['system-ocr-win32-arm64-msvc'] : ['system-ocr-win32-x64-msvc']
|
||||
)
|
||||
}
|
||||
|
||||
if (platform === 'windows') {
|
||||
|
||||
@ -25,6 +25,14 @@ async function downloadNpm(platform) {
|
||||
'@img/sharp-libvips-darwin-x64',
|
||||
'https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.2.0.tgz'
|
||||
)
|
||||
downloadNpmPackage(
|
||||
'@napi-rs/system-ocr-darwin-arm64',
|
||||
'https://registry.npmjs.org/@napi-rs/system-ocr-darwin-arm64/-/system-ocr-darwin-arm64-1.0.2.tgz'
|
||||
)
|
||||
downloadNpmPackage(
|
||||
'@napi-rs/system-ocr-darwin-x64',
|
||||
'https://registry.npmjs.org/@napi-rs/system-ocr-darwin-x64/-/system-ocr-darwin-x64-1.0.2.tgz'
|
||||
)
|
||||
}
|
||||
|
||||
if (!platform || platform === 'linux') {
|
||||
@ -81,6 +89,15 @@ async function downloadNpm(platform) {
|
||||
'@img/sharp-win32-x64',
|
||||
'https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.3.tgz'
|
||||
)
|
||||
|
||||
downloadNpmPackage(
|
||||
'@napi-rs/system-ocr-win32-arm64-msvc',
|
||||
'https://registry.npmjs.org/@napi-rs/system-ocr-win32-arm64-msvc/-/system-ocr-win32-arm64-msvc-1.0.2.tgz'
|
||||
)
|
||||
downloadNpmPackage(
|
||||
'@napi-rs/system-ocr-win32-x64-msvc',
|
||||
'https://registry.npmjs.org/@napi-rs/system-ocr-win32-x64-msvc/-/system-ocr-win32-x64-msvc-1.0.2.tgz'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user