Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Latest commit

 

History

History
42 lines (34 loc) · 1.06 KB

plugins.md

File metadata and controls

42 lines (34 loc) · 1.06 KB

Writing plugins

Gemini plugin is just an npm package with a gemini-<plugin name> name. Module should export a single function which receives Gemini class instance and user-specified options. Gemini instance contains two fields:

  • config — current config with specified options
  • events — all emitted events, which can be used by plugins

For example:

module.exports = function(gemini, options) {
    console.log('Hello from plugin');
    console.log('Show me config: ', gemini.config);
    console.log('Show me all events: ', gemini.events);
};

Documentation on the gemini object can be found in programmatic API document.

Options are specified by a user in a config file and passed to the plugin as is. For example:

.gemini.yml:

system:
  plugins:
    greeter:
      name: Mr. Incredible

Plugin:

module.exports = function(gemini, options) {
    console.log('Hello, %s' options.name);
};

When publishing plugins, add gemini-plugin keyword to your package.json to help users discovering it.