Fix plugin version not being loaded

Load the version of the plugin from its package.json file and document
this requirement in the writing plugins document.
This commit is contained in:
Hornwitser committed 2020-10-23 16:57:49 +02:00
1 parent c5a14db8ea
commit 1b0b245484
3 files changed
+23 -9

No files matched your search

+15 -8
View File
@@ -39,8 +39,21 @@ The basic file structure of a plugin is the following.
+- module.json
+- plugin.lua
The most important file is the `info.js` file. Without it the plugin
will not recognized by Clusterio. Here's an example of it:
Clusterio plugins are Node.js packages that can be published on npm for
ease of installation and distribution. The usual guides for creating
such packages apply. At minimum the `package.json` file must contain a
version entry.
A possible workflow for developing plugins is to place the plugin in a
sub-directory of where clusterio has been installed, and rely on Node.js
searching up the folder heirarchy for it to find `@clusterio/lib`. To
add it to `plugin-list.json` so that it gets loaded use the `plugin add
<path>` sub-command to either clusteriomaster, clusterioslave or
clusterioctl. Note that it's important that the path starts with ./ or
../ (use .\ or ..\ on Windows).
For a plugin the most important file is the `info.js` file. Without it
the plugin will not recognized by Clusterio. Here's an example of it:
const link = require('@clusterio/lib/link'); // For messages
@@ -48,7 +61,6 @@ will not recognized by Clusterio. Here's an example of it:
name: "foo_frobber",
title: "Foo Frobber",
description: "Does advanced frobnication",
version: "0.8.1",
instanceEntrypoint: "instance",
masterEntrypoint: "master",
messages: {
@@ -68,11 +80,6 @@ The following properties are recognized:
**description**:
Brief description of what the plugin does. Currently not used.
**version**:
Semver compatible version string of the plugin. Currently only
servers as the default for the Clusterio module embedded in the
plugin, if any.
**instanceEntrypoint**:
Path to a Node.js module relative to the plugin directory which
contains the InstancePlugin class definition for this plugin. This