Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Feature/pin packer dependencies #208

Conversation

connorgmeehan
Copy link
Collaborator

This PR addresses #183 by pinning all packer dependencies to the current latest version from github.
I also made a script to automate this process which works by running ./update_dependencies.sh from within doom-nvim/contribute/. It uses a mixture of grep and perl to find the dependencies, curl and jq to query the latest versions using the github API and sed to modify lua/doom/modules/init.lua.

There are a couple of big caveats and I think this should be re-written in LUA but it does 95% of the work for you for now which is good.

Caveats

  • The github API is ratelimited, because there are so many dependencies I've had to switch nodes on my VPN to finish running the script. (another workaround is to provide a Github API key).
  • The github API is slow the script takes quite a while to run because everything is synchronous.
  • Parsing the data with grep/perl and sed sucks and is prone to failure, right now the commit = pin_commit has to be on the line after the repository name
  • Doesn't handle all edge cases, right now it only updates using the default main/master branch. I've just manually updated these myself.
  • Doesn't handle plugin dependencies i.e. if a plugin has:
  use({
    "hrsh7th/nvim-cmp",
    commit = pin_commit('669803b9ffb31b3963afb4f05c1622fc48ab65cb'),
    wants = { "LuaSnip" },
    requires = {
      {
        "L3MON4D3/LuaSnip",
        event = "BufReadPre",
        wants = "friendly-snippets",
        config = require("doom.modules.config.doom-luasnip"),
        disable = disabled_snippets,
        requires = { "rafamadriz/friendly-snippets" },
      },
      {
        "windwp/nvim-autopairs",
        config = require("doom.modules.config.doom-autopairs"),
        disable = disabled_autopairs,
        event = "BufReadPre",
      },
    },
    config = require("doom.modules.config.doom-cmp"),
    disable = disabled_lsp,
    event = "InsertEnter",
  })

Future Solution

I don't think it's worth fixing these issues just yet because it does automate most of the work for you and it'd be good to get the release out. I think the right way to do this is in lua, I could use treesitter queries to find repositories that need to be updated, fetch the latest version using git fetch and then push the changes into a quickfix buffer. I think this would be good to incorporate into a contributor module that includes the work for the doom-nvim-contrib docker image.

Also if you merge #206 first I'll add documentation for this script inside of contribute/README.md

@NTBBloodbath NTBBloodbath added scope: enhancement New feature or request branch: develop For stuff regarding to development branch priority: high High priority stuff labels Oct 30, 2021
@NTBBloodbath
Copy link
Collaborator

Hey, thank you so much, this looks truly amazing :)

About caveats yeah, they can be a pain in the future but as you said the script does almost all the job for us so we can live with them for a while I guess.

Regarding to GitHub ratelimit I think we could be able to use an API key if we are going to make a CI for updating pins in the future.

This script is good enough as a starter implementation for this thing and we can work on improving this later :)

If we are going to use Lua we could use async jobs with libuv to asynchronously update commits with git fetch as you said. This could be a better aporoach to us I think, your idea looks pretty cool to me :)

I think this would be good to incorporate into a contributor module that includes the work for the doom-nvim-contrib docker image.

Agreed, let me know how do you want to integrate both tools on it. Just as a note if you haven't noticed yet, we have a contrib field for Lua/LibUV docs plugins that we could also use for this.

Also if you merge #206 first I'll add documentation for this script inside of contribute/README.md

Sure thing, I think documentation is the core of all projects so let's merge #206 first so we can have a proper documentation for this script :)

@connorgmeehan connorgmeehan force-pushed the feature/pin-packer-dependencies branch from 5e2bad9 to c2ebee2 Compare November 4, 2021 01:41
@connorgmeehan
Copy link
Collaborator Author

Hey @NTBBloodbath, I've added the documentation, this is ready to go now!

@NTBBloodbath
Copy link
Collaborator

Thank you so much mate, merging right now 👍

@NTBBloodbath NTBBloodbath merged commit 02c9d44 into doom-neovim:develop Nov 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
branch: develop For stuff regarding to development branch priority: high High priority stuff scope: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants