feat(natives): added native addon distribution and platform validation to CLI update mechanism

- Added native addon distribution and installation support to the CLI update mechanism, enabling platform-specific native modules to be downloaded and installed alongside the main binary.
- Added platform validation in native addon loader to verify supported platforms (linux-x64, linux-arm64, darwin-x64, darwin-arm64, win32-x64) with helpful error messages for unsupported configurations.
- Enhanced native addon loading error messages to provide platform-specific troubleshooting guidance for both npm/bun installations and local development environments.
- Updated installation scripts (install.sh, install.ps1) to download and install native addon files alongside the main binary during CLI installation.
This commit is contained in:
can1357
2026-02-01 05:17:06 +01:00
parent 67fcf85518
commit 1e52c837c8
10 changed files with 130 additions and 24 deletions
+12 -5
View File
@@ -200,6 +200,7 @@ install_binary() {
esac
BINARY="omp-${PLATFORM}-${ARCH}"
NATIVE_ADDON="pi_natives.${PLATFORM}-${ARCH}.node"
# Get release tag
if [ -n "$REF" ]; then
@@ -222,16 +223,22 @@ install_binary() {
fi
echo "Using version: $LATEST"
# Download binary
URL="https://github.com/${REPO}/releases/download/${LATEST}/${BINARY}"
echo "Downloading ${BINARY}..."
mkdir -p "$INSTALL_DIR"
curl -fsSL "$URL" -o "${INSTALL_DIR}/omp"
# Download binary
BINARY_URL="https://github.com/${REPO}/releases/download/${LATEST}/${BINARY}"
echo "Downloading ${BINARY}..."
curl -fsSL "$BINARY_URL" -o "${INSTALL_DIR}/omp"
chmod +x "${INSTALL_DIR}/omp"
# Download native addon
NATIVE_URL="https://github.com/${REPO}/releases/download/${LATEST}/${NATIVE_ADDON}"
echo "Downloading ${NATIVE_ADDON}..."
curl -fsSL "$NATIVE_URL" -o "${INSTALL_DIR}/${NATIVE_ADDON}"
echo ""
echo "✓ Installed omp to ${INSTALL_DIR}/omp"
echo "✓ Installed native addon to ${INSTALL_DIR}/${NATIVE_ADDON}"
# Check if in PATH
case ":$PATH:" in