When creating new repository please use reforis_{{plugin_name}}
format for the path. It should be the same name as for Python module that would be a part of the plugin.
-
Install cookiecutter
$ pip3 install cookiecutter
-
Install template and fill template variables
$ cookiecutter https://gitlab.labs.nic.cz/turris/reforis/plugins-template
If you want to use template from specific branch e.g.
dev
$ cookiecutter https://gitlab.labs.nic.cz/turris/reforis/plugins-template --checkout dev
If
cookiecutter
command is not available trypython3 -m cookiecutter
. -
Install npm dependencies
$ cd reforis_{{plugin_name}} $ make preapare-dev
-
Initialize translation languages Check variable
LANGS
in Makefie for list of languages before initiate translations.$ make init-lang
-
Build JS
$ make build-js
-
Sync plugin directory with router - copy repository to
/tmp/reforis_{{plugin_name}}/
-
Install plugin on the router
$ cd /tmp/reforis_{{plugin_name}}/ $ make install
To locally test example plugin you can use make
commands:
test
lint
init-langs
Please note that the git repository is not automatically created. If you wish to use one it's advised to add repository
section to package.json
.
Foris JS is one of the plugin's dependencies. For the sake of developers convenience its version is set to latest
(in package.json
file). After creating new plugin with the template it is recommended to fix version, i.e. change latest
to the actual version (e.g. 0.2.3
) so that breaking changes in library won't affect the new plugin in an undesired way.
Most plugins would take advantage of reForis API utils, such as APIError
exception or validate_json
function. As a consequence, reForis
is installed by setup.py
(in Python's virtual environment) during development or testing (CI). If you find yourself not using those utilities, feel free to remove that dependency in your plugin.