diff --git a/nodejs/nodejs.lua b/nodejs/nodejs.lua index dc20587..9697bb5 100644 --- a/nodejs/nodejs.lua +++ b/nodejs/nodejs.lua @@ -16,7 +16,7 @@ VersionSourceUrl = "https://nodejs.org/dist/index.json" PLUGIN = { name = "nodejs", author = "Aooohan", - version = "0.0.4", + version = "0.0.5", description = "Node.js", updateUrl = "https://raw.githubusercontent.com/version-fox/version-fox-plugins/main/nodejs/nodejs.lua", } @@ -49,6 +49,15 @@ function PLUGIN:PreInstall(ctx) ext = ".zip" osType = "win" end + + -- add logic for macOS M1~ + if OS_TYPE == "darwin" then + local major, _ = extract_semver(version) + if major and tonumber(major) <= 16 then + arch_type = "x86" + end + end + local filename = FileName:format(version, osType, arch_type, ext) local baseUrl = NodeBaseUrl:format(version) diff --git a/nodejs/npmmirror.lua b/nodejs/npmmirror.lua index ab81b67..f1622ab 100644 --- a/nodejs/npmmirror.lua +++ b/nodejs/npmmirror.lua @@ -16,7 +16,7 @@ VersionSourceUrl = "https://cdn.npmmirror.com/binaries/node/index.json" PLUGIN = { name = "nodejs", author = "yimiaoxiehou", - version = "0.0.2", + version = "0.0.3", description = "install Node.js use https://cdn.npmmirror.com", updateUrl = "https://raw.githubusercontent.com/version-fox/version-fox-plugins/main/nodejs/npmmirror.lua", } @@ -49,6 +49,15 @@ function PLUGIN:PreInstall(ctx) ext = ".zip" osType = "win" end + + -- add logic for macOS M1~ + if OS_TYPE == "darwin" then + local major, _ = extract_semver(version) + if major and tonumber(major) <= 16 then + arch_type = "x86" + end + end + local filename = FileName:format(version, osType, arch_type, ext) local baseUrl = NodeBaseUrl:format(version)