From 0c0d112aaf548149f4be2ae7aeeaaac642233ef1 Mon Sep 17 00:00:00 2001 From: shanmite Date: Thu, 26 Aug 2021 14:55:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20arm=E5=B9=B3=E5=8F=B0=E5=8F=AF=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/update.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/update.js b/lib/update.js index 3614397..a56f98a 100644 --- a/lib/update.js +++ b/lib/update.js @@ -27,17 +27,25 @@ function getLatestReleaseDownloadUrl(owner, repo) { ['linux', 'linux'], ['darwin', 'macos'] ]).get(process.platform) - if (platform) { + const arch = new Map([ + ['x64', 'x64'] + ['arm', 'armv7'], + ['arm64', 'arm64'] + ]).get(process.arch) + if (platform && arch) { try { const download_url = assets - .filter(({ name }) => name.includes(platform)) + .filter(({ name }) => name.includes(platform) && name.includes(arch)) .map(({ browser_download_url }) => browser_download_url)[0] + if (!download_url) { + reject(`未找到能在此平台(${process.platform})-(${process.arch})上运行的版本`) + } resolve({ download_url, text }) } catch (err) { reject(err) } } else { - reject(`未找到能在此平台(${process.platform})上运行的版本`) + reject(`未找到能在此平台(${process.platform})-(${process.arch})上运行的版本`) } } else { reject('当前已是最新版本')