Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

fix Compatible with M1 mac below Node.js 16.0.0 #30

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion nodejs/nodejs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down Expand Up @@ -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)

Expand Down
11 changes: 10 additions & 1 deletion nodejs/npmmirror.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down Expand Up @@ -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)

Expand Down