aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/js-debug-adapter/init.lua
blob: 897aa11e03dfa98af83b6be6ff69888e05ef14eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
local Pkg = require "mason-core.package"
local github = require "mason-core.managers.github"
local git = require "mason-core.managers.git"
local _ = require "mason-core.functional"
local path = require "mason-core.path"
local Optional = require "mason-core.optional"

return Pkg.new {
    name = "js-debug-adapter",
    desc = [[The VS Code JavaScript debugger]],
    homepage = "https://github.com/microsoft/vscode-js-debug",
    languages = { Pkg.Lang.JavaScript, Pkg.Lang.TypeScript },
    categories = { Pkg.Cat.DAP },
    ---@async
    ---@param ctx InstallContext
    install = function(ctx)
        local source = github.tag { repo = "microsoft/vscode-js-debug" }
        source.with_receipt()
        git.clone { "https://github.com/microsoft/vscode-js-debug", version = Optional.of(source.tag) }
        ctx.spawn.npm { "install", "--legacy-peer-deps" }
        ctx.spawn.npm { "run", "compile" }
        ctx:link_bin(
            "js-debug-adapter",
            ctx:write_node_exec_wrapper("js-debug-adapter", path.concat { "out", "src", "vsDebugServer.js" })
        )
    end,
}