mirror of https://github.com/folke/lazy.nvim.git
feat!: renamed Plugin.run => Plugin.build
This commit is contained in:
parent
ec4199bada
commit
042aaa4f87
|
@ -24,10 +24,12 @@
|
||||||
## ✅ TODO
|
## ✅ TODO
|
||||||
|
|
||||||
- [ ] health checks: check merge conflicts async
|
- [ ] health checks: check merge conflicts async
|
||||||
|
- [ ] unsupported props or props from other managers
|
||||||
|
- [x] rename `run` to `build`
|
||||||
- [ ] allow setting up plugins through config
|
- [ ] allow setting up plugins through config
|
||||||
- [x] task timeout
|
- [x] task timeout
|
||||||
- [ ] log file
|
- [ ] log file
|
||||||
- [ ] deal with resourcing init.lua. Check a global?
|
- [ ] deal with re-sourcing init.lua. Check a global?
|
||||||
- [x] incorrect when switching TN from opt to start
|
- [x] incorrect when switching TN from opt to start
|
||||||
- [ ] git tests
|
- [ ] git tests
|
||||||
- [x] max concurrency
|
- [x] max concurrency
|
||||||
|
|
|
@ -8,7 +8,7 @@ local M = {}
|
||||||
---@class LazyPluginHooks
|
---@class LazyPluginHooks
|
||||||
---@field init? fun(LazyPlugin) Will always be run
|
---@field init? fun(LazyPlugin) Will always be run
|
||||||
---@field config? fun(LazyPlugin) Will be executed when loading the plugin
|
---@field config? fun(LazyPlugin) Will be executed when loading the plugin
|
||||||
---@field run? string|fun()
|
---@field build? string|fun(LazyPlugin)
|
||||||
|
|
||||||
---@class LazyPluginState
|
---@class LazyPluginState
|
||||||
---@field loaded? {[string]:string, time:number}
|
---@field loaded? {[string]:string, time:number}
|
||||||
|
|
|
@ -59,7 +59,7 @@ function M.install(opts)
|
||||||
"git.checkout",
|
"git.checkout",
|
||||||
"plugin.docs",
|
"plugin.docs",
|
||||||
"wait",
|
"wait",
|
||||||
"plugin.run",
|
"plugin.build",
|
||||||
},
|
},
|
||||||
plugins = function(plugin)
|
plugins = function(plugin)
|
||||||
return plugin.uri and not plugin._.installed
|
return plugin.uri and not plugin._.installed
|
||||||
|
@ -78,7 +78,7 @@ function M.update(opts)
|
||||||
{ "git.checkout", lockfile = opts.lockfile },
|
{ "git.checkout", lockfile = opts.lockfile },
|
||||||
"plugin.docs",
|
"plugin.docs",
|
||||||
"wait",
|
"wait",
|
||||||
"plugin.run",
|
"plugin.build",
|
||||||
{ "git.log", updated = true },
|
{ "git.log", updated = true },
|
||||||
},
|
},
|
||||||
plugins = function(plugin)
|
plugins = function(plugin)
|
||||||
|
|
|
@ -4,22 +4,22 @@ local Loader = require("lazy.core.loader")
|
||||||
---@type table<string, LazyTaskDef>
|
---@type table<string, LazyTaskDef>
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.run = {
|
M.build = {
|
||||||
skip = function(plugin)
|
skip = function(plugin)
|
||||||
return not (plugin._.dirty and (plugin.opt == false or plugin.run))
|
return not (plugin._.dirty and (plugin.opt == false or plugin.build))
|
||||||
end,
|
end,
|
||||||
run = function(self)
|
run = function(self)
|
||||||
Loader.load(self.plugin, { task = "run" }, { load_start = true })
|
Loader.load(self.plugin, { task = "run" }, { load_start = true })
|
||||||
|
|
||||||
local run = self.plugin.run
|
local build = self.plugin.build
|
||||||
if run then
|
if build then
|
||||||
if type(run) == "string" and run:sub(1, 1) == ":" then
|
if type(build) == "string" and build:sub(1, 1) == ":" then
|
||||||
local cmd = vim.api.nvim_parse_cmd(run:sub(2), {})
|
local cmd = vim.api.nvim_parse_cmd(build:sub(2), {})
|
||||||
self.output = vim.api.nvim_cmd(cmd, { output = true })
|
self.output = vim.api.nvim_cmd(cmd, { output = true })
|
||||||
elseif type(run) == "function" then
|
elseif type(build) == "function" then
|
||||||
run()
|
build()
|
||||||
else
|
else
|
||||||
local args = vim.split(run, "%s+")
|
local args = vim.split(build, "%s+")
|
||||||
return self:spawn(table.remove(args, 1), {
|
return self:spawn(table.remove(args, 1), {
|
||||||
args = args,
|
args = args,
|
||||||
cwd = self.plugin.dir,
|
cwd = self.plugin.dir,
|
||||||
|
|
Loading…
Reference in New Issue