dotfiles/vim/lua/helpers.lua

13 lines
446 B
Lua

-- Return the node_modules path for this project. If the project root contains a
-- frontend/ directory, assume node_modules lives there.
function Get_project_node_modules_path()
local root_path = vim.fn.getcwd()
local frontend_path = root_path .. "/frontend"
local is_frontend = vim.fn.isdirectory(frontend_path) ~= 0
local base_path = root_path
if is_frontend then
base_path = frontend_path
end
return base_path .. "/node_modules"
end