Yeoman

On TBSP, you can use Yeoman to create and upload plugins.

What is a Plugin?

Plugins are applications developed and used by both Tymlez and third-party developers. 

Plugins can be installed and activated on TBSP to extend the platform's capabilities by enabling new functionalities and new services.

What's Yeoman?

Yeoman is an open source client-side scaffolding tool for web applications.

Yeoman provides a generator ecosystem; a generator is basically a plugin that can be run with the `yo` command to scaffold complete projects or useful parts.

With Yeoman, you can easily create plugins and upload them to the TBSP platform, where you can run them as applications.

Install Yeoman

Note that the Docker SDK container already contains all client-side development tools.

If you're not using the Docker SDK container to interact with TBSP, begin with installing Yeoman:

$ npm i -g yo

Install the TYMLEZ plugin generator:

$ npm install -g yo generator-tymlez-plugin

Create a directory for the plugin and enter into that directory:

$ mkdir hello-|company| && cd hello-|company|

Use Yeoman to create a plugin

Scaffold empty application in the plugins of tymlez/ng-rt-core

In the Docker container, create a new plugin:

$ yo

Available plugin types

Application

  • Server-side: contains both API routes and services
  • Client-side: contains html files for the front-end and user interface
  • Full-stack: contains both the server-side and client-side plugins.
In this fashion, the generator separates the workflow where desired and enables front-end and back-end developers to work separately on the same plugin.
 
Smart Contract
  • Validation: this contract checks if a specific condition is met.
  • Escrow: this contract holds the digital assets and only changes the ownership of an asset as soon as a specified condition is met.
  • Memory: this contract ensures the immutability of the content of a contract. Validated through a consensus involving different nodes, this kind of contract can be either read-only or modifiable (read/write).

Branding/Theming

Generates a plugin that enables you to use your **Custom Icons and CSS** for the server UI.

It is recommended to use your company name for this plugin's name.
The Branding/Theming plugin name is assigned **ng-css-theme-** as prefix.

Prompt

You will see the following prompt. Enter the following values:

  • Plugin Name - give your plugin a name
  • Project Root - specify a desired plugin folder
  • TBSP Version - specify version 3.0
  • Plugin Type - specify the kind of TBSP plugin you'd like to create
  • Description - describe the functions of your plugin
  • Author - you can enter your name or your organization's name here
  • Advanced Options (Y/N) - select Y for advanced options; select N to skip

The generator will create a plugin folder in the project root.

Upload a plugin

CLI

You can use the command line interface to upload the plugin you just created.

First, a zip file must be first prepared.

Prepare zip file

Assuming your working directory is 'plugins/test1', build a distributable archive:

$ tymlez-dev gulp dist

Get your app key

The app key is required for uploading plugins. This section is also covered in the Obtain App Key article. 

First log in as the admin user to obtain the JWT token:

tymlez-dev auth getJWTToken --username=admin --password=<GENERATED PASSWORD FROM OUTPUT>

After logging in with the admin user, obtain the app key for ng-rt-admin:

tymlez-dev utils addAppKey --username=admin --plugin=ng-rt-admin --domain=<DESIRED_DOMAIN_ID>

An app key is then generated:

[INFO] utilsCommands.addAppkey - appKey for  ng-rt-admin added :  <GENERATED_APP_KEY>

Upload zip file via the command line interface

Navigate to the folder containing the plugin. In this case, ng-rt-SmartContracts is used as an example:

$ cd ~/ng-rt-SmartContracts

In the plugin folder, install the required node modules:

npm i

Run:

$ tymlez-dev plugin upload

Upload zip file via the UI

Log in to your instance as administrator.

In the menu bar, select Plugins:

Screen Shot 2020-05-25 at 3.49.32 PM

Click on 'Add plugin' at the top right corner:

Screen Shot 2020-05-25 at 3.49.48 PM

Navigate to 'Local File':

Screen Shot 2020-05-25 at 3.49.59 PM

Click 'Browse' to find the zip file you created.

If you created the plugin in your Docker SDK container, you'll find the file on your local development machine at this location:

/Users/<HOME_DIRECTORY>/Tymlez/sdk/plugins

Once your plugin has been uploaded, install and activate your plugin:

Screen Shot 2020-05-26 at 2.45.11 PM

 

After creating your plugin, you can proceed with the steps outlined here