mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 23:33:13 +09:00
Address review on plugin install
Rethrow errors other than ENOENT and ENOTDIR when reading the package spec as a directory, mark the tests that run npm as slow so FAST_TEST skips them, and use ./external_plugins/my_plugin in the README examples. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
5606d5d553
commit
7c0f77499c
5 files changed
+15
-12
No files matched your search
@@ -44,9 +44,9 @@ Add plugin either by require path or relative/absolute path to the plugin direct
|
||||
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, adding a plugin checked out next to the Clusterio installation:
|
||||
For example, adding a plugin checked out in the external_plugins directory:
|
||||
|
||||
npx clusteriocontroller plugin add ../my_plugin
|
||||
npx clusteriocontroller plugin add ./external_plugins/my_plugin
|
||||
|
||||
|
||||
#### `plugin remove <name>`
|
||||
|
||||
@@ -46,9 +46,9 @@ Add plugin either by require path or relative/absolute path to the plugin direct
|
||||
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, adding a plugin checked out next to the Clusterio installation:
|
||||
For example, adding a plugin checked out in the external_plugins directory:
|
||||
|
||||
npx clusterioctl plugin add ../my_plugin
|
||||
npx clusterioctl plugin add ./external_plugins/my_plugin
|
||||
|
||||
|
||||
#### `plugin remove <name>`
|
||||
|
||||
@@ -45,9 +45,9 @@ Add plugin either by require path or relative/absolute path to the plugin direct
|
||||
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, adding a plugin checked out next to the Clusterio installation:
|
||||
For example, adding a plugin checked out in the external_plugins directory:
|
||||
|
||||
npx clusteriohost plugin add ../my_plugin
|
||||
npx clusteriohost plugin add ./external_plugins/my_plugin
|
||||
|
||||
|
||||
#### `plugin remove <name>`
|
||||
|
||||
@@ -74,8 +74,10 @@ async function packageNameFromSpec(packageSpec: string) {
|
||||
if (typeof packageJson.name === "string") {
|
||||
return packageJson.name;
|
||||
}
|
||||
} catch {
|
||||
// Not a local directory, treat it as name@version
|
||||
} catch (err: any) {
|
||||
if (!["ENOENT", "ENOTDIR"].includes(err.code)) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
return packageSpec.replace(/(?!^)@.*$/, "");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user