aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/node-debug2-adapter/init.lua
blob: 76b24a6d4f571329fa2c721f5d1b287a029134b9 (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
28
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 = "node-debug2-adapter",
    desc = [[A debug adapter that supports debugging Node via the Chrome Debugging Protocol. No longer maintained.]],
    homepage = "https://github.com/microsoft/vscode-node-debug2",
    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-node-debug2" }
        source.with_receipt()
        git.clone { "https://github.com/microsoft/vscode-node-debug2", version = Optional.of(source.tag) }
        ctx.spawn.npm { "install" }
        ctx.spawn.npm { "run", "build" }
        ctx.spawn.npm { "install", "--production" }
        ctx:link_bin(
            "node-debug2-adapter",
            ctx:write_node_exec_wrapper("node-debug2-adapter", path.concat { "out", "src", "nodeDebug.js" })
        )
    end,
}