0.1.1 • Published 6 years ago
sourcebit-sourcebit-sample-plugin v0.1.1
sourcebit-sample-plugin
A sample plugin for Sourcebit
👩🏫 Introduction
This is a simple Sourcebit plugin for development and educational purposes. It operates on a model with three fields (firstName, lastName and points) and creates two entries with a pre-defined value for points. If the watch option is supplied, then every 3 seconds one of the entries will be randomly picked and its points will be incremented by one.
⚙️ Configuration
The plugin accepts the following configuration parameters. They can be supplied in any of the following ways:
- In the
optionsobject of the plugin configuration block insidesourcebit.js, with the value of the Property column as a key; - As an environment variable named after the Env variable column, when running the
sourcebit fetchcommand; - As part of a
.envfile, with the value of the Env variable column separated by the value with an equals sign (e.g.MY_VARIABLE=my-value); - As a CLI parameter, when running the
sourcebit fetchcommand, using the value of the Parameter column as the name of the parameter (e.g.sourcebit fetch --my-parameter).
| Property | Type | Visibility | Default value | Env variable | Parameter | Description |
|---|---|---|---|---|---|---|
mySecret | String | Private | MY_SECRET | A secret value. Not actually used by the plugin, purely for demonstration purposes. | ||
watch | Boolean | Public | false | watch | Whether to update entries on a regular interval. | |
pointsForJane | Number | Public | 0 | The initial number of points assigned to Jane | ||
pointsForJohn | Number | Public | 0 | The initial number of points assigned to John |
👀 Example configuration
sourcebit.js
module.exports = {
plugins: [
{
module: require("sourcebit-sample-plugin"),
options: {
pointsForJane: 5,
pointsForJohn: 3
}
}
]
};🧞♂️ Interactive setup process
This plugin offers an interactive setup process via the npx create-sourcebit command.
📥 Input
N/A
📤 Output
This plugin adds normalized entries to the objects data bucket and normalized model objects to the models data bucket.