diff --git a/scripts/after-pack.js b/scripts/after-pack.js index fd3c361788..21bef17821 100644 --- a/scripts/after-pack.js +++ b/scripts/after-pack.js @@ -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') { diff --git a/scripts/build-npm.js b/scripts/build-npm.js index 159e77453e..c3a63d5221 100644 --- a/scripts/build-npm.js +++ b/scripts/build-npm.js @@ -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' + ) } }