From f6fc272ec983bfcd3286868ac7a153617e3b039a Mon Sep 17 00:00:00 2001 From: Service Account Date: Tue, 3 Dec 2024 19:39:21 +0700 Subject: [PATCH] chore: build universal for hnswlib-node on macos --- Makefile | 3 ++- extensions/assistant-extension/package.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0228c52d7b..e0750f3064 100644 --- a/Makefile +++ b/Makefile @@ -133,6 +133,7 @@ else ifeq ($(shell uname -s),Linux) find . -name ".turbo" -type d -exec rm -rf '{}' + find . -name "packake-lock.json" -type f -exec rm -rf '{}' + find . -name "yarn.lock" -type f -exec rm -rf '{}' + + find . -name "package-lock.json" -type f -exec rm -rf '{}' + rm -rf ./pre-install/*.tgz rm -rf ./extensions/*/*.tgz rm -rf ./electron/pre-install/*.tgz @@ -145,7 +146,7 @@ else find . -name "build" -type d -exec rm -rf '{}' + find . -name "out" -type d -exec rm -rf '{}' + find . -name ".turbo" -type d -exec rm -rf '{}' + - find . -name "packake-lock.json" -type f -exec rm -rf '{}' + + find . -name "package-lock.json" -type f -exec rm -rf '{}' + find . -name "yarn.lock" -type f -exec rm -rf '{}' + rm -rf ./pre-install/*.tgz rm -rf ./extensions/*/*.tgz diff --git a/extensions/assistant-extension/package.json b/extensions/assistant-extension/package.json index aa5dba6922..ff757cccec 100644 --- a/extensions/assistant-extension/package.json +++ b/extensions/assistant-extension/package.json @@ -9,9 +9,10 @@ "license": "AGPL-3.0", "scripts": { "clean:modules": "rimraf node_modules/pdf-parse/test && cd node_modules/pdf-parse/lib/pdf.js && rimraf v1.9.426 v1.10.88 v2.0.550", + "build-universal-hnswlib": "cd node_modules/hnswlib-node && arch -x86_64 npx node-gyp rebuild --arch=x64 && mv build/Release/addon.node ./addon-amd64.node && node-gyp rebuild --arch=arm64 && mv build/Release/addon.node ./addon-arm64.node && lipo -create -output build/Release/addon.node ./addon-arm64.node ./addon-amd64.node && rm ./addon-arm64.node && rm ./addon-amd64.node", "build": "yarn clean:modules && tsc --module commonjs && rollup -c rollup.config.ts", "build:publish:linux": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install", - "build:publish:darwin": "rimraf *.tgz --glob && yarn build && ../../.github/scripts/auto-sign.sh && npm pack && cpx *.tgz ../../pre-install", + "build:publish:darwin": "rimraf *.tgz --glob && yarn build-universal-hnswlib && yarn build && ../../.github/scripts/auto-sign.sh && npm pack && cpx *.tgz ../../pre-install", "build:publish:win32": "rimraf *.tgz --glob && yarn build && npm pack && cpx *.tgz ../../pre-install", "build:publish": "run-script-os" },