fix(json): always write version to prevent spurious migrations. Fixes #1692
This commit is contained in:
@@ -128,7 +128,7 @@ local defaults = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
M.json = {
|
M.json = {
|
||||||
version = 1,
|
version = 2,
|
||||||
data = {
|
data = {
|
||||||
version = nil, ---@type string?
|
version = nil, ---@type string?
|
||||||
news = {}, ---@type table<string, string>
|
news = {}, ---@type table<string, string>
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ function M.encode(value)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.save()
|
function M.save()
|
||||||
|
Config.json.data.version = Config.json.version
|
||||||
local path = vim.fn.stdpath("config") .. "/lazyvim.json"
|
local path = vim.fn.stdpath("config") .. "/lazyvim.json"
|
||||||
local f = io.open(path, "w")
|
local f = io.open(path, "w")
|
||||||
if f then
|
if f then
|
||||||
@@ -68,10 +69,13 @@ function M.migrate()
|
|||||||
json.data.extras = vim.tbl_map(function(extra)
|
json.data.extras = vim.tbl_map(function(extra)
|
||||||
return "lazyvim.plugins.extras." .. extra
|
return "lazyvim.plugins.extras." .. extra
|
||||||
end, json.data.extras or {})
|
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
|
end
|
||||||
|
|
||||||
json.data.version = Config.json.version
|
|
||||||
|
|
||||||
M.save()
|
M.save()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user