mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 00:13:12 +09:00
Add plugin install command to controller, host and ctl
Installing a plugin used to take two steps, npm install followed by plugin add, and both silently did their work in whatever directory they were run from. The new plugin install <package> subcommand runs npm install --save and then discovers the plugin through the existing loadPluginList logic, so the plugin list is updated in the same step. The command refuses to run outside a Clusterio installation, detected by the package.json the installer writes or one that depends on a Clusterio package. plugin add with a bare package name warns in the same situation. Reinstalling a plugin that is already listed reports it as such instead of failing. Installing a package without the clusterio-plugin keyword fails. Fixes #1008 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
7987a5d925
commit
5606d5d553
6 files changed
+292
-24
No files matched your search
+16
-5
@@ -27,17 +27,28 @@ Configure plugins available to be loaded by ctl.
|
||||
The available plugins will be automatically loaded and the commands they provide will be added to the ctl utility.
|
||||
|
||||
|
||||
#### `plugin install <package>`
|
||||
|
||||
Install a plugin from npm and add it to the plugin list.
|
||||
The package is passed to `npm install --save` so anything npm accepts works, including a version like `@clusterio/plugin-subspace_storage@2.0.0`.
|
||||
This command refuses to run outside the directory Clusterio was installed in, as the plugin has to end up in that directory's node_modules to be found.
|
||||
|
||||
For example, installing the Subspace Storage plugin:
|
||||
|
||||
npx clusterioctl plugin install @clusterio/plugin-subspace_storage
|
||||
|
||||
Since the `plugin-list.json` is shared between controller, host and ctl you usually only need to do this once per machine.
|
||||
|
||||
|
||||
#### `plugin add <path>`
|
||||
|
||||
Add plugin either by require path or relative/absolute path to the plugin directory.
|
||||
A relative path must start with ./ or ../ (or .\ and ..\ on Windows) otherwise it will be assumed to be a require path for an installed package in node_modules.
|
||||
This is mainly useful for plugins under development, packages published on npm are better installed with `plugin install`.
|
||||
|
||||
For example, installing the Subspace Storage plugin:
|
||||
For example, adding a plugin checked out next to the Clusterio installation:
|
||||
|
||||
npm install @clusterio/plugin-subspace_storage
|
||||
npx clusterioctl plugin add @clusterio/plugin-subspace_storage
|
||||
|
||||
Since the `plugin-list.json` is shared between controller, host and ctl you usually only need to do this once per machine.
|
||||
npx clusterioctl plugin add ../my_plugin
|
||||
|
||||
|
||||
#### `plugin remove <name>`
|
||||
|
||||
Reference in new issue
Block a user