mirror of https://github.com/folke/lazy.nvim.git
ci: move to _generated.lua
This commit is contained in:
parent
786a3febc0
commit
49c0b86a6f
|
@ -83,7 +83,7 @@ function M.build()
|
|||
end
|
||||
end
|
||||
end
|
||||
Util.write_file("lua/lazy/community/rocks.lua", "return \n" .. vim.inspect(nvim_rocks))
|
||||
Util.write_file("lua/lazy/community/_generated.lua", "return \n" .. vim.inspect(nvim_rocks))
|
||||
end
|
||||
|
||||
M.build()
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
local M = {}
|
||||
|
||||
---@type table<string, string>
|
||||
local mapping = nil
|
||||
|
||||
local function _load()
|
||||
if mapping then
|
||||
return
|
||||
end
|
||||
mapping = {}
|
||||
---@type {name:string, url:string, version:string}[]
|
||||
local gen = require("lazy.community._generated")
|
||||
for _, rock in ipairs(gen) do
|
||||
mapping[rock.name] = rock.url
|
||||
end
|
||||
end
|
||||
|
||||
---@param rock string
|
||||
---@return string?
|
||||
function M.get_url(rock)
|
||||
_load()
|
||||
return mapping[rock]
|
||||
end
|
||||
|
||||
return M
|
Loading…
Reference in New Issue