Developer Center
Getting Started
If you are interested in developing a plugin for Saber, please take the time to read and understand all of the documentation on this page.
Development Process
- To begin, you should start by cloning or downloading a git repository for one of Saber's Plugins. For example, you could clone the Stress Test plugin. All plugins built for Saber uses the Saber.Core NuGet package to communicate with Saber and includes a set of files used for publishing your plugin using Gulp.
- Run the command npm install from within the newly cloned folder.
-
Keep the following files within your newly cloned plugin folder and delete everything else to start from scratch.
- .gitignore
- gulpfile.js
- Info.cs
- LICENSE
- package.json
- package-lock.json
- publish.bat
- README.md
- Saber.Vendors.*.csproj
- Delete the existing .sln (solution) file
- rename your .csproj (project) file to the desired name for your plugin (e.g. Saber.Vendors.My-Plugin.csproj).
- Open your .csproj (project) file in a text editor and replace instances of the old plugin name & information with your plugin's name and information.
- Open package.json in a text editor to make any string replacements for the name and information of your plugin.
- Open the .csproj file in Visual Studio (2019 or better) to start developing your plugin for Saber!
- Right-click your project in Visual Studio and go to Properties
- Make sure the Assembly Name and Default Namespace fields use Saber.Vendors.{MyPlugin} where {MyPlugin} is the name of your plugin.
- Open Info.cs in Visual Studio to make any string replacements for the name and information of your plugin.
- Open README.md in Visual Studio to make any string replacements for the name and information of your plugin. Keep the title, description, Prerequisites, Installation, Publish, & Usage sections within your README, and add more documentation below those sections if you'd like.
- Start developing your new plugin!
Development Caveats
-
You should research and fully understand the tools you have access to when developing a plugin for Saber.
- Saber.Core has many application-wide features that you can utilize when building your Saber vendor plugin.
- Query is an MSSQL/Dapper library that allows you to access stored procedures within Saber's database and is part of the Saber.Core NuGet package.
- You can use HTML & Mustache to generate content for your plugin, or build Mustache Components and Special Variables that users can use when writing HTML for their Saber web pages.
- Saber uses various JavaScript libraries on the client-side for making AJAX calls, displaying popup modals, and enhancing Saber's Editor UI.
- Saber uses Tapestry as a CSS grid & UI framework for Saber's Editor. You will need to learn how to use Tapestry if you wish to create plugins that modify or enhance Saber's Editor.
- Saber uses the Datasilk Core MVC NuGet package to render web pages instead of using Microsoft's MVC framework, and is included in the Saber.Core NuGet package.
- When designing plugins that render content on the user's web pages (using IVendorHtmlComponents), understand that the user will be using vanilla CSS & JavaScript, so make sure to define any CSS styles that your plugin will be using without using any existing CSS/LESS/SASS frameworks (such as Bootstrap) and do not use any JavaScript frameworks, including jQuery, Angular, React, and Vue.
Publish a Release of your Plugin
To publish your plugin, run the command ./publish.bat. When the command completes, you can find your release .7z zip file under /bin/Publish/. This is the file that you should share with the public for download. It will contain two folders, win-x64 and linux-x64, for Windows operating systems and supported Linux distributions. For more information about which Linux distributions are supported, visit Microsoft's RID catalog.
Also, before publishing, you should consider the following steps:
- Right-click your project in Visual Studio and go to Properties, then navigate to the Package tab
- Make sure the Package id and Product fields use Saber.Vendor.MyPlugin where MyPlugin is the name of your plugin.
- Open your gulpfile.js file
- Replace the value for the app variable var app = '' with your plugin name (with no spaces or special characters).
-
Find the comment //include custom resources inside the function
publishToPlatform(platform) to optionally include any files or folders that you wish to publish
along with your plugin's release files, which may include HTML, JavaScript, and CSS files.
Please refer to gulp.src()
documentation to learn how to use regular expressions to include or exclude files & folders from the list.
NOTE: There may already be custom resources included based on the GitHub repository that you cloned as a starting point for your own plugin. You should remove any of these custom resources that are unneccessary from the gulpfile and the project folder.
- Update the README.md file with a description about your plugin, installion instructions, and a guide on how to use your plugin within Saber's Editor UI.