ci: move to _generated.lua

This commit is contained in:
Folke Lemaitre 2024-06-25 18:07:26 +02:00
parent 786a3febc0
commit 49c0b86a6f
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
3 changed files with 26 additions and 1 deletions

View File

@ -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()

View File

@ -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