fix(json): always write version to prevent spurious migrations. Fixes #1692

This commit is contained in:
Folke Lemaitre
2023-10-13 07:35:24 +02:00
parent bd1928ba59
commit 01dbd07073
2 changed files with 7 additions and 3 deletions

View File

@ -47,6 +47,7 @@ function M.encode(value)
end
function M.save()
Config.json.data.version = Config.json.version
local path = vim.fn.stdpath("config") .. "/lazyvim.json"
local f = io.open(path, "w")
if f then
@ -68,10 +69,13 @@ function M.migrate()
json.data.extras = vim.tbl_map(function(extra)
return "lazyvim.plugins.extras." .. extra
end, json.data.extras or {})
elseif json.data.version == 1 then
json.data.extras = vim.tbl_map(function(extra)
-- replace double extras module name
return extra:gsub("^lazyvim%.plugins%.extras%.lazyvim%.plugins%.extras%.", "lazyvim.plugins.extras.")
end, json.data.extras or {})
end
json.data.version = Config.json.version
M.save()
end