Skip to content

Commit

Permalink
refactor!: change install directory to fs-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Diogo-ss committed Mar 26, 2024
1 parent 227e8e4 commit 4dc2b01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions lua/fs/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ M.opts = {
},
-- Five Server bin directory.
-- if installed globally, use: `bin = "five-server"`
bin = vim.fn.stdpath "data" .. "/five-server/node_modules/.bin/five-server",
bin = vim.fn.stdpath "data" .. "/fs-plugin/five-server/node_modules/.bin/five-server",
-- Directory for installing Five Server
path = vim.fn.stdpath "data" .. "/five-server",
path = vim.fn.stdpath "data" .. "/fs-plugin/five-server",
-- notifications on the interface.
notify = true,
-- configure Five Server RC.
Expand Down
26 changes: 12 additions & 14 deletions lua/fs/utils/install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,19 @@ end
local function install(path)
path = path or config.opts.path

if vim.fn.isdirectory(path) ~= 1 then
vim.fn.mkdir(path, "p")
local package_managers = vim.tbl_filter(function(val)
return vim.fn.executable(val) == 1
end, { "npm", "pnpm" })

if #package_managers > 0 then
if vim.fn.isdirectory(path) ~= 1 then
vim.fn.mkdir(path, "p")
end

cmd { package_managers[1], "install", "five-server", "--prefix", path }
else
logger.logger_error "No package manager found (NPM ou PNPM)."
end

if vim.fn.executable "npm" == 1 then
cmd { "npm", "install", "five-server", "--prefix", path }
return
end

if vim.fn.executable "pnpm" == 1 then
cmd { "pnpm", "install", "five-server", "--prefix", path }
return
end

logger.logger_error "No package manager found (npm or pnpm)."
end

return install

0 comments on commit 4dc2b01

Please sign in to comment.