the spec no longer fixes itself...

modules are more reliable
cleanup some typos
This commit is contained in:
2025-06-23 00:18:33 -04:00
parent 30cc9a8d50
commit 71b78bfca4
5 changed files with 59 additions and 31 deletions

View File

@ -3,6 +3,7 @@ local git = require('dep.git')
local fs = require('dep.fs')
local packager = require('dep.package')
local h = require('dep.helpers')
local spec_man = require("dep.spec")
-- all functions for convenience
local M = {}
@ -38,14 +39,14 @@ function M.registertree(speclist, overrides)
-- make sure the overrides override and take into account the packages spec
---@diagnostic disable-next-line: missing-fields
over = {
pin = over.pin or spec.pin,
disable = over.disable or spec.disable
pin = overrides.pin or spec.pin,
disable = overrides.disable or spec.disable
}
-- While a package can fail to load we just don't care, it will work itself
-- out. The goal is to make sure every plugin that can load does load, not
-- keep working plugins from loading because an unrelated one doesn't load.
packager:new(spec, overrides)
packager:new(spec, over)
end
if speclist.modules then
@ -63,9 +64,14 @@ function M.registertree(speclist, overrides)
name, module = module, require(module)
end
name = module.name or name
-- allow a module to be a spec
if spec_man.check(module, true) ~= false then
---@diagnostic disable-next-line: cast-local-type
module = { module }
end
local ok, err = pcall(M.registertree, module, overrides)
if not ok then
error(string.format("%s <- %s", err, name))
@ -125,7 +131,7 @@ function M.synctree(tree, cb)
end
end
for _, package in ipairs(tree) do
for _, package in pairs(tree) do
local co = coroutine.create(function()
-- if the package provided prefers a local source then use the local
-- source instead of the git repository
@ -160,7 +166,8 @@ return function(opts)
-- register all packages
local root = packager:new({
"squibid/dep",
url = "https://git.squi.bid/dep",
url = "https://git.squi.bid/squibid/dep.git",
branch = "lazy",
pin = true
})
if not root then
@ -170,7 +177,7 @@ return function(opts)
M.registertree(opts)
-- sort package dependencies
for _, package in ipairs(packager.get_packages()) do
for _, package in pairs(packager.get_packages()) do
table.sort(package.requirements, comp)
table.sort(package.dependents, comp)
end
@ -183,7 +190,7 @@ return function(opts)
end)
-- load packages
M.reload()
M.reload(false)
--- check if a package should be synced
---@param package table package table spec
@ -198,7 +205,7 @@ return function(opts)
-- get all package that need syncing
local targets = {}
for _, package in ipairs(packager.get_packages()) do
for _, package in pairs(packager.get_packages()) do
if shouldsync(package) then
table.insert(targets, package)
end