Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scripts): node_modules path local to script.cwd #171

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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