mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-25 10:18:47 +02:00
fix(json): always write version to prevent spurious migrations. Fixes #1692
This commit is contained in:
parent
bd1928ba59
commit
01dbd07073
2 changed files with 7 additions and 3 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue