Skip to main content
Version: v4.5.0

Create a Plugin

Before you begin

A Plugin allows you to add new capabilities to a Template. You can do that through actions such as:

  • Add source code;
  • Import libraries;
  • Execute complex commands and operations to add these capabilities.

Plugins and Templates have the same structure. The only difference between them is the type, Plugin is app, instead of app-template. The steps you followed to create Templates are very similar for creating Plugins, however, there are a few different commands.

caution

To add a Plugin to a Template you must create a Stack. For more details aboutStacks see the Glossary section and to see the Create a Stack page to learn more.

Create Plugin

There are two ways to create a Plugin: 1. Create directly in a Stack.
2. Create a Plugin already linked to a repository.

This tutorial shows you the second option. For more details about the first one, see the Create a Stack tutorial page.

Create and share a Plugin

Follow the steps below:

Step 1. Create a Git repository

Create a Git repository to host your Plugin.

Step 2. Create a Plugin locally

Run the command below to create your Plugin. You have to name it:

stk-legacy create plugin <plugin-name>

Then describe what the Plugin does.

Step 3. Host the Plugin in your repository

Now, upload the Plugin to the repository you created in Step 1.

  • Go to the Plugin folder. In this tutorial, the name is 'plugin-name':
cd <plugin-name>
git remote add origin <your-repo-name>
git push origin main

Step 4. Add the Plugin to a Stack

Add your Plugin to the Stack you want.

  1. Go to the Stack folder:
cd <stack-name>
  1. Use your repository URL and run the command:
stk-legacy add plugin <url-of-your-plugin-repo>

Done!! Your Plugin has been added to the Stack!

Step 5. Host Stack in the repository

Execute the command below to upload your Stack into the repository:

git push origin main 

Step 6. Import the Stack

This step is necessary if you have recently created and uploaded a Stack to the repository.

Run the command below in the terminal to import it:

stk-legacy import stack <Stack-Git-URL>

Step 7. Update your Stack

This step is necessary if you already have imported a Stack.

Run the command below to update it:

stk-legacy update stack <stack-name>

Step 8. Confirm if your Plugin was added to the Stack

Execute the command:

stk-legacy list plugin
info

Templates and Plugins are used to create an application (app). If you want to test them, execute stk-legacy create app and stk-legacy apply plugin commands, and inform the Template/Plugin folder path you want to test.

You can add your Plugins or Templates to other Stacks. If they are modified, the changes are automatically added to any of them, regardless of which Stack they are in.

Was this page helpful?