aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/platform.lua2
-rw-r--r--lua/mason-registry/node-debug2-adapter/init.lua13
2 files changed, 5 insertions, 10 deletions
diff --git a/lua/mason-core/platform.lua b/lua/mason-core/platform.lua
index 7ae51a67..987e70bf 100644
--- a/lua/mason-core/platform.lua
+++ b/lua/mason-core/platform.lua
@@ -164,7 +164,7 @@ function M.get_node_version()
return spawn.node({ "--version" }):map(function(result)
-- Parses output such as "v16.3.1" into major, minor, patch
local _, _, major, minor, patch = _.head(_.split("\n", result.stdout)):find "v(%d+)%.(%d+)%.(%d+)"
- return { tonumber(major), tonumber(minor), tonumber(patch) }
+ return { major = tonumber(major), minor = tonumber(minor), patch = tonumber(patch) }
end)
end
diff --git a/lua/mason-registry/node-debug2-adapter/init.lua b/lua/mason-registry/node-debug2-adapter/init.lua
index 33ff2790..4487b6a4 100644
--- a/lua/mason-registry/node-debug2-adapter/init.lua
+++ b/lua/mason-registry/node-debug2-adapter/init.lua
@@ -21,15 +21,10 @@ return Pkg.new {
ctx.spawn.npm { "install" }
local node_env = platform
.get_node_version()
- :map(function(version)
- if version[1] >= 18 then
- return {
- NODE_OPTIONS = "--no-experimental-fetch",
- }
- else
- return {}
- end
- end)
+ :map(_.cond {
+ { _.prop_satisfies(_.gte(18), "major"), _.always { NODE_OPTIONS = "--no-experimental-fetch" } },
+ { _.T, _.always {} },
+ })
:get_or_else {}
ctx.spawn.npm { "run", "build", env = node_env }
ctx.spawn.npm { "install", "--production" }