Skip to content

Commit

Permalink
fix(scripts): node_modules path local to script.cwd (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
gorillamoe authored Aug 21, 2024
1 parent 50b0444 commit 77c5624
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion lua/kulala/scripts/javascript.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,17 @@ M.run = function(type, data)
end

for _, script in ipairs(scripts) do
vim.system({ "node", script.path }, { cwd = script.cwd }):wait()
vim
.system({
"node",
script.path,
}, {
cwd = script.cwd,
env = {
NODE_PATH = script.cwd .. "/" .. "node_modules",
},
})
:wait()
end
end

Expand Down
2 changes: 1 addition & 1 deletion lua/kulala/utils/fs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ end
M.get_global_scripts_variables = function()
local fp = M.get_global_scripts_variables_file_path()
if M.file_exists(fp) then
return vim.fn.json_decode(fp)
return vim.fn.json_decode(M.read_file(fp))
end
return nil
end
Expand Down

0 comments on commit 77c5624

Please sign in to comment.