diff options
| author | William Boman <william@redwill.se> | 2022-07-10 16:39:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-10 14:39:35 +0000 |
| commit | da3cac4632322a62ef9f2551e1b790c557d88e7d (patch) | |
| tree | 8ab9745d8252b93bd6c36604ceb57e2e6f551ae0 /lua | |
| parent | fix(node-debug2-adapter): fix build on Node >= 18 (#47) (diff) | |
| download | mason-da3cac4632322a62ef9f2551e1b790c557d88e7d.tar mason-da3cac4632322a62ef9f2551e1b790c557d88e7d.tar.gz mason-da3cac4632322a62ef9f2551e1b790c557d88e7d.tar.bz2 mason-da3cac4632322a62ef9f2551e1b790c557d88e7d.tar.lz mason-da3cac4632322a62ef9f2551e1b790c557d88e7d.tar.xz mason-da3cac4632322a62ef9f2551e1b790c557d88e7d.tar.zst mason-da3cac4632322a62ef9f2551e1b790c557d88e7d.zip | |
refactor: return table with declarative keys (#48)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/mason-core/platform.lua | 2 | ||||
| -rw-r--r-- | lua/mason-registry/node-debug2-adapter/init.lua | 13 |
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" } |
