CLI - Batch install plugins

A kind of batch file to install mulitple plugins at once. That would save some time.

Something like this:

kirby pluginbatch:install pluginbatch.json

Probably a json array:

A
List
Of
Plugin
Repositories

Do you mean JSON? JS is not going to work here.
Also I think this shouldn’t be a separate command.

1 Like

I’m doing that with Composer, with the method described in this thread. It’s a bit verbose but it works.
Here’s an example: https://gist.github.com/fvsch/a34c7a87d2813f23abaffbd2cbcfda59

One thing I found out was that using the “package” repository type meant that if the repo you’re referencing has a composer.json, it will be ignored. This type mostly means "clone the repo and put it in vendor".

@lukasbestle

Yes, I mean json.

@fvsch

While that probably works, I’m hoping for a more simple approach.

Something like this (but as json):

github.com/fvsch/kirby-twig
github.com/fvsch/kirby-staticbuilder

Well, actually we could also just use a simple text file. Doesn’t need to be JSON.
The Homebrew package manager once supported a simple line-separated list, but it seems like they removed it and/or I can’t find it anymore.

Edit: It is called the “Brewfile”, but it has been deprecated because it was apparently limited in some way.

Shouldn’t it be possible to implement it as:

kirby plugin:install fvsch/kirby-twig fvsch/kirby-staticbuilder

?

With a list of 10 plugins it would be too long to write to be useful.

I don’t think that would be much better than the current:

kirby plugin:install fvsch/kirby-twig
kirby plugin:install fvsch/kirby-staticbuilder

It would be better in the way that you could enter it at once. With multiple lines you always need to wait till one is finished. I don’t really get the advantage of a just a file that is specific to the Kirby CLI?

With multiple lines you always need to wait till one is finished.

Good point.

I don’t really get the advantage of a just a file that is specific to the Kirby CLI?

Maybe I always setup Kirby with 12 plugins that I use. Then it would be helpful to just carry around a tiny batch-file containing references to the plugins instead of really long row, or in multiple rows.

A setup would take seconds instead of minutes.

What you could also do in the meantime is to just create a batch file/shell script that will invoke the CLI with the packages you need. You could run this script once and it will do all the work for you.

Or - I know not as sophisticated but I think comparing effort and result it’s a good middle way - just save the long one-liner in a txt file and when needed, copy and paste it into the terminal

That composer setup is indeed very verbose, but:

  • it works for plugins without a Kirby-specific package.json
  • it works for plugins hosted somewhere outside of GitHub
  • it allows working with specific versions of a plugin

I guess it depends on what you need, but at least version management should be — or will quickly become — a requirement. So you add version management, you add listing plugins to install in a config file… and you’re getting closer to reinventing Composer. :wink:

I wonder if a Kirby-specific Composer installer plugin could keep most things in vendor/username/myplugin and then register plugins with Kirby (e.g. by writing a site.php file for Kirby). (Thinking out loud here, sorry.)

@lukasbestle @distantnative @fvsch

Three different approaches. Nice to have options. :slight_smile:

  • I have not written a batch script in two decades but for the person who is a batch pro it’s probably a good simple solution.
  • The one liner as copy paste. Does it work today with multiple plugins like that, or is it just an idea of how it could work?
  • The composer. If taking the time to learn Composer it’s probably great. It require some initial effort.