aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/installers/npm.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-10-30 11:05:50 +0200
committerGitHub <noreply@github.com>2021-10-30 11:05:50 +0200
commit8e6615916de6f7d2491e47f8a97870eef0ad36d3 (patch)
tree762def1fb61a0fc8a3aaaaa072da3e2c1c535817 /lua/nvim-lsp-installer/installers/npm.lua
parentdoc: add some docs (diff)
downloadmason-8e6615916de6f7d2491e47f8a97870eef0ad36d3.tar
mason-8e6615916de6f7d2491e47f8a97870eef0ad36d3.tar.gz
mason-8e6615916de6f7d2491e47f8a97870eef0ad36d3.tar.bz2
mason-8e6615916de6f7d2491e47f8a97870eef0ad36d3.tar.lz
mason-8e6615916de6f7d2491e47f8a97870eef0ad36d3.tar.xz
mason-8e6615916de6f7d2491e47f8a97870eef0ad36d3.tar.zst
mason-8e6615916de6f7d2491e47f8a97870eef0ad36d3.zip
run installations in tmpdir (#199)
Resolves #154.
Diffstat (limited to 'lua/nvim-lsp-installer/installers/npm.lua')
-rw-r--r--lua/nvim-lsp-installer/installers/npm.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/lua/nvim-lsp-installer/installers/npm.lua b/lua/nvim-lsp-installer/installers/npm.lua
index d6805b0e..93c33532 100644
--- a/lua/nvim-lsp-installer/installers/npm.lua
+++ b/lua/nvim-lsp-installer/installers/npm.lua
@@ -29,15 +29,15 @@ local function create_installer(read_version_from_context)
return function(packages)
return ensure_npm(
---@type ServerInstallerFunction
- function(server, callback, context)
+ function(_, callback, context)
local pkgs = Data.list_copy(packages or {})
local c = process.chain {
- cwd = server.root_dir,
+ cwd = context.install_dir,
stdio_sink = context.stdio_sink,
}
-- stylua: ignore start
- if not (fs.dir_exists(path.concat { server.root_dir, "node_modules" }) or
- fs.file_exists(path.concat { server.root_dir, "package.json" }))
+ if not (fs.dir_exists(path.concat { context.install_dir, "node_modules" }) or
+ fs.file_exists(path.concat { context.install_dir, "package.json" }))
then
c.run(npm, { "init", "--yes", "--scope=lsp-installer" })
end
@@ -66,10 +66,10 @@ M.install = create_installer(false)
---@param args string[]
function M.exec(executable, args)
---@type ServerInstallerFunction
- return function(server, callback, context)
- process.spawn(M.executable(server.root_dir, executable), {
+ return function(_, callback, context)
+ process.spawn(M.executable(context.install_dir, executable), {
args = args,
- cwd = server.root_dir,
+ cwd = context.install_dir,
stdio_sink = context.stdio_sink,
}, callback)
end
@@ -80,10 +80,10 @@ end
function M.run(script)
return ensure_npm(
---@type ServerInstallerFunction
- function(server, callback, context)
+ function(_, callback, context)
process.spawn(npm, {
args = { "run", script },
- cwd = server.root_dir,
+ cwd = context.install_dir,
stdio_sink = context.stdio_sink,
}, callback)
end