From 042aaa4f87c6576a369cbecd86aceefb96add228 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 1 Dec 2022 07:43:28 +0100 Subject: [PATCH] feat!: renamed Plugin.run => Plugin.build --- README.md | 4 +++- lua/lazy/core/plugin.lua | 2 +- lua/lazy/manage/init.lua | 4 ++-- lua/lazy/manage/task/plugin.lua | 18 +++++++++--------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 5e60622..a5fa4c4 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,12 @@ ## ✅ TODO - [ ] health checks: check merge conflicts async + - [ ] unsupported props or props from other managers +- [x] rename `run` to `build` - [ ] allow setting up plugins through config - [x] task timeout - [ ] 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 - [ ] git tests - [x] max concurrency diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index 1436f99..3d3c958 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -8,7 +8,7 @@ local M = {} ---@class LazyPluginHooks ---@field init? fun(LazyPlugin) Will always be run ---@field config? fun(LazyPlugin) Will be executed when loading the plugin ----@field run? string|fun() +---@field build? string|fun(LazyPlugin) ---@class LazyPluginState ---@field loaded? {[string]:string, time:number} diff --git a/lua/lazy/manage/init.lua b/lua/lazy/manage/init.lua index 06fb037..ce8c169 100644 --- a/lua/lazy/manage/init.lua +++ b/lua/lazy/manage/init.lua @@ -59,7 +59,7 @@ function M.install(opts) "git.checkout", "plugin.docs", "wait", - "plugin.run", + "plugin.build", }, plugins = function(plugin) return plugin.uri and not plugin._.installed @@ -78,7 +78,7 @@ function M.update(opts) { "git.checkout", lockfile = opts.lockfile }, "plugin.docs", "wait", - "plugin.run", + "plugin.build", { "git.log", updated = true }, }, plugins = function(plugin) diff --git a/lua/lazy/manage/task/plugin.lua b/lua/lazy/manage/task/plugin.lua index 1042624..16adc45 100644 --- a/lua/lazy/manage/task/plugin.lua +++ b/lua/lazy/manage/task/plugin.lua @@ -4,22 +4,22 @@ local Loader = require("lazy.core.loader") ---@type table local M = {} -M.run = { +M.build = { 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, run = function(self) Loader.load(self.plugin, { task = "run" }, { load_start = true }) - local run = self.plugin.run - if run then - if type(run) == "string" and run:sub(1, 1) == ":" then - local cmd = vim.api.nvim_parse_cmd(run:sub(2), {}) + local build = self.plugin.build + if build then + if type(build) == "string" and build:sub(1, 1) == ":" then + local cmd = vim.api.nvim_parse_cmd(build:sub(2), {}) self.output = vim.api.nvim_cmd(cmd, { output = true }) - elseif type(run) == "function" then - run() + elseif type(build) == "function" then + build() else - local args = vim.split(run, "%s+") + local args = vim.split(build, "%s+") return self:spawn(table.remove(args, 1), { args = args, cwd = self.plugin.dir,