From b2408d54ec787c50e72f633e4a94868716fbce91 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Wed, 21 Oct 2020 21:37:26 +0200 Subject: [PATCH] Convert plugins to node packages Setup package.json for the plugins and add them back to tests now that they are compatible again. --- lerna.json | 3 ++- package.json | 2 +- plugins/global_chat/info.js | 1 - plugins/global_chat/package.json | 18 ++++++++++++++++++ plugins/research_sync/info.js | 1 - plugins/research_sync/package.json | 19 +++++++++++++++++++ plugins/statistics_exporter/info.js | 1 - plugins/statistics_exporter/package.json | 18 ++++++++++++++++++ plugins/subspace_storage/info.js | 1 - plugins/subspace_storage/package.json | 19 +++++++++++++++++++ plugins/subspace_storage/routes.js | 1 - test/integration/index.js | 5 +++++ 12 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 plugins/global_chat/package.json create mode 100644 plugins/research_sync/package.json create mode 100644 plugins/statistics_exporter/package.json create mode 100644 plugins/subspace_storage/package.json diff --git a/lerna.json b/lerna.json index 8732d9e9..fdf6300d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,7 @@ { "packages": [ - "packages/*" + "packages/*", + "plugins/*" ], "version": "2.0.0-alpha0" } diff --git a/package.json b/package.json index 74f67bfc..efdf2697 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "root", "private": true, "scripts": { - "test": "mocha --exit --check-leaks -R spec --recursive test", + "test": "mocha --exit --check-leaks -R spec --recursive test plugins/*/test", "fast-test": "FAST_TEST=y npm test", "cover": "nyc npm test", "fast-cover": "FAST_TEST=y nyc npm test", diff --git a/plugins/global_chat/info.js b/plugins/global_chat/info.js index bb4dece1..ea36cf20 100644 --- a/plugins/global_chat/info.js +++ b/plugins/global_chat/info.js @@ -6,7 +6,6 @@ module.exports = { name: "global_chat", title: "Global Chat", description: "Forwards chat between instances.", - version: "2.0.0-alpha", instanceEntrypoint: "instance", controlEntrypoint: "control", diff --git a/plugins/global_chat/package.json b/plugins/global_chat/package.json new file mode 100644 index 00000000..519569a8 --- /dev/null +++ b/plugins/global_chat/package.json @@ -0,0 +1,18 @@ +{ + "name": "@clusterio/plugin-global_chat", + "version": "2.0.0-alpha0", + "description": "Clusterio plugin forwarding between Factorio servers", + "author": "Hornwitser ", + "homepage": "https://github.com/clusterio/factorioClusterio#readme", + "license": "MIT", + "repository": "clusterio/factorioClusterio", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "bugs": { + "url": "https://github.com/clusterio/factorioClusterio/issues" + }, + "dependencies": { + "@clusterio/lib": ">=2.0.0-alpha0" + } +} diff --git a/plugins/research_sync/info.js b/plugins/research_sync/info.js index e28ef732..094f67e2 100644 --- a/plugins/research_sync/info.js +++ b/plugins/research_sync/info.js @@ -22,7 +22,6 @@ module.exports = { name: "research_sync", title: "Research Sync", description: "Synchronises technology research progress between instances.", - version: "2.0.0-alpha", instanceEntrypoint: "instance", masterEntrypoint: "master", diff --git a/plugins/research_sync/package.json b/plugins/research_sync/package.json new file mode 100644 index 00000000..3cc2ee0c --- /dev/null +++ b/plugins/research_sync/package.json @@ -0,0 +1,19 @@ +{ + "name": "@clusterio/plugin-research_sync", + "version": "2.0.0-alpha0", + "description": "Clusterio plugin for synchronizing research between Factorio servers", + "author": "Hornwitser ", + "homepage": "https://github.com/clusterio/factorioClusterio#readme", + "license": "MIT", + "repository": "clusterio/factorioClusterio", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "bugs": { + "url": "https://github.com/clusterio/factorioClusterio/issues" + }, + "dependencies": { + "@clusterio/lib": ">=2.0.0-alpha0", + "fs-extra": "^8.1.0" + } +} diff --git a/plugins/statistics_exporter/info.js b/plugins/statistics_exporter/info.js index a0dabdd4..b54e56c4 100644 --- a/plugins/statistics_exporter/info.js +++ b/plugins/statistics_exporter/info.js @@ -5,6 +5,5 @@ module.exports = { name: "statistics_exporter", title: "Prometheus Statistics Export", description: "Exports statistics to Prometheus", - version: "2.0.0-alpha", instanceEntrypoint: "instance", }; diff --git a/plugins/statistics_exporter/package.json b/plugins/statistics_exporter/package.json new file mode 100644 index 00000000..594c3760 --- /dev/null +++ b/plugins/statistics_exporter/package.json @@ -0,0 +1,18 @@ +{ + "name": "@clusterio/plugin-statistics_exporter", + "version": "2.0.0-alpha0", + "description": "Clusterio plugin for gathering statistics from Factorio servers", + "author": "Hornwitser ", + "homepage": "https://github.com/clusterio/factorioClusterio#readme", + "license": "MIT", + "repository": "clusterio/factorioClusterio", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "bugs": { + "url": "https://github.com/clusterio/factorioClusterio/issues" + }, + "dependencies": { + "@clusterio/lib": ">=2.0.0-alpha0" + } +} diff --git a/plugins/subspace_storage/info.js b/plugins/subspace_storage/info.js index cc0e9831..72298262 100644 --- a/plugins/subspace_storage/info.js +++ b/plugins/subspace_storage/info.js @@ -57,7 +57,6 @@ module.exports = { name: "subspace_storage", title: "Subspace Storage", description: "Provides shared storage across instances for the Subspace Storage mod", - version: "2.0.0-alpha", instanceEntrypoint: "instance", InstanceConfigGroup, diff --git a/plugins/subspace_storage/package.json b/plugins/subspace_storage/package.json new file mode 100644 index 00000000..3268d42a --- /dev/null +++ b/plugins/subspace_storage/package.json @@ -0,0 +1,19 @@ +{ + "name": "@clusterio/plugin-subspace_storage", + "version": "2.0.0-alpha0", + "description": "Clusterio plugin for sharing storage between Factorio servers", + "author": "Hornwitser ", + "homepage": "https://github.com/clusterio/clusterio#readme", + "license": "MIT", + "repository": "clusterio/factorioClusterio", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "bugs": { + "url": "https://github.com/clusterio/factorioClusterio/issues" + }, + "dependencies": { + "@clusterio/lib": ">=2.0.0-alpha0", + "fs-extra": "^8.1.0" + } +} diff --git a/plugins/subspace_storage/routes.js b/plugins/subspace_storage/routes.js index 5247cd8b..f4d648a4 100644 --- a/plugins/subspace_storage/routes.js +++ b/plugins/subspace_storage/routes.js @@ -1,5 +1,4 @@ "use strict"; -const express = require("express"); const path = require("path"); const prometheus = require("@clusterio/lib/prometheus"); diff --git a/test/integration/index.js b/test/integration/index.js index 7c3fd2c2..873dacc1 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -129,6 +129,11 @@ before(async function() { await exec("node ../../packages/master config set master.heartbeat_interval 0.25"); await exec("node ../../packages/master config set master.connector_shutdown_timeout 2"); + await exec("node ../../packages/ctl plugin add ../../plugins/global_chat"); + await exec("node ../../packages/ctl plugin add ../../plugins/research_sync"); + await exec("node ../../packages/ctl plugin add ../../plugins/statistics_exporter"); + await exec("node ../../packages/ctl plugin add ../../plugins/subspace_storage"); + await exec("node ../../packages/master bootstrap create-admin test"); await exec("node ../../packages/master bootstrap create-ctl-config test");