Skip to content

Local plugins tutorial

Simon Schmid edited this page Apr 27, 2022 · 1 revision

Local plugins tutorial

This tutorial walks you through setting up your own local plugins.

The project name in this tutorial will be MyProject and the plugin name will be demo.

  • navigate into you project folder
cd MyProject
  • create a new Beefile
bee new
  • create a new folder for all your local plugins
mkdir -p .bee/plugins
  • add a folder and a bash file for your plugin
mkdir -p .bee/plugins/demo
touch .bee/plugins/demo/demo.bash
  • open demo.bash and add a function to test your plugin
demo::hello() {
  echo "Hello"
}
  • update your Beefile to use the local plugin
BEE_PROJECT=MyProject
BEE_VERSION=1.0.0

# BEE_PLUGINS_PATHS can contain multiple folders
# BEE_RESOURCES is .bee by default
BEE_PLUGINS_PATHS=("${BEE_RESOURCES}/plugins")
BEE_PLUGINS=(demo)
  • run your plugin
bee demo hello

Dependencies

Your plugin may have dependencies to other plugins. Specify them in plugin.json

  • create plugin.json for your plugin
touch .bee/plugins/demo/plugin.json
{
  "dependencies": [
    "semver"
  ]
}
  • use dependencies in your plugin
demo::hello() {
  semver::write 1.2.3
  echo "Hello $(semver::read)"
}
  • install dependencies
bee install
  • run your plugin
bee demo hello

Clone this wiki locally