Graphback allows to create your own plugins that can affect generated schema and create files in filesystem.
Each plugin needs to be a new npm package that will implement GraphbackPlugin.
Building your plugin
Graphback plugins are executed in the order they are defined in the configuration.
transformSchema is called first for each plugin to determine final shape of the schema.
createResources method is called that can create files etc.
Example plugin implementation should look as follows:
NOTE: Plugin name cannot start with
graphback-as this name is reserved for graphback internal plugins
Plugins are loaded using CommonJS 'require' method based on the Graphback plugin section. Order of the plugins matter especially when transforming schema. If your plugin relies on other plugins, it should be placed on the bottom of the list. Each plugin should have its own configuration embedded as follows:
NOTE: Graphback CLI includes Graphback core plugin. When adding your own plugins, you need to run Graphback CLI from your npm scripts for the Graphback engine to be able to pick up the plugin package.
'@graphback/core' offers helpers for building plugins. Please refer to the package documentation for more details.