Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Overhaul #372

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Plugin Overhaul #372

wants to merge 30 commits into from

Conversation

Thomas-Smyth
Copy link
Collaborator

@Thomas-Smyth Thomas-Smyth commented Aug 3, 2024

Introduction

Currently, there is a backlog of 8 issues and 13 pull requests related to plugin development. Many of these requests outdated, with the oldest issue over four years old and the oldest pull request over three. Requests and changes relating to plugins are challenging for maintainers. As many maintainers do not actively use all the plugins in their communities, they lack an environment to adequately test new or updated plugins. Additionally, plugins significantly expand the codebase, complicating overall testing and maintenance of SquadJS. This results in insufficiently reviewed pull requests or outright rejection, discouraging contributors and inhibiting innovation.

Solution

This pull request proposes that all plugins are evicted from this repository. In exchange, it implements extensive quality of life improvements making plugin development and publication easier. The aim of this proposal is to reduce the burden plugins place on SquadJS maintainers allowing them to focus on improving SquadJS's core functionality. Moreover, it aims to better foster the community of plugin developers encouraging them to collaboratively maintain the plugins they actively use.

The promise of this approach is highlighted within JetDave (@fantinodavide)'s work. JetDave manages over 12 different plugins which I understand are used by his community or communities he has strong ties to. This provides him an environment to adequately test the plugins, and by extension, far more qualified to manage the maintenance of them. Assuming this responsibility by running his own repositories, he takes the burden off of SquadJS maintainers whilst improving how well the plugins are maintained. Furthermore, each plugin having its own repository allows other to contribute and him to accept these contributions with less fear of breaking SquadJS's core functionality or other plugins.

Going forward, the aim will be to better formalise the communication between SquadJS's core functionality and plugins. This will be implement through the adoption of Typescript to document the available properties and methods that plugins can access, implement and call.

Changes

This pull request:

  • Removes the existing plugins.
  • Removes the existing plugin system.
  • Refactors and improves the config system.
  • Implements a new and improved plugin system.
    • Makes it easier to write plugins.
    • Makes it easier to structure code.
    • Makes it easier to use external dependencies/packages.
  • Implements plugin-level config files.
  • Removes the overly complex connection system in favor of plugins managing their own connections.
  • Updates the plugin documentation.
  • Updates and improves the plugin development documentation.
  • Implements two example plugins which implement basic helpful functionality by default.
    • Implements a SquadJS API Plugin (removing this functionality from the SquadServer class).
    • Implements a SquadJS Command Plugin.
  • Implements Typescript.

I implore people to read the updated documentation for more detail.

Further Changes

Going forwards, we will need to:

  • Setup new repositories for the existing plugins and update them to be compatible.

The latter of these changes is key to prevent a massive drop in functionality. However, I do not propose delaying the merge until this is completed. Doing so will delay significant improvements to SquadJS and discourage people from adopting the aims of the project.

Testing

This has been tested in a small test environment. Further testing will be required from others and in large environments.

@werewolfboy13 werewolfboy13 marked this pull request as draft August 6, 2024 22:00
# Conflicts:
#	squad-server/factory.js
#	squad-server/package.json
#	squad-server/plugins/db-log.js
#	squad-server/plugins/discord-base-message-updater.js
#	squad-server/plugins/discord-base-plugin.js
#	squad-server/plugins/discord-placeholder.js
#	squad-server/plugins/discord-rcon.js
#	squad-server/plugins/discord-server-status.js
#	squad-server/plugins/discord-subsystem-restarter.js
@Thomas-Smyth Thomas-Smyth marked this pull request as ready for review August 7, 2024 18:59
@wesley-931
Copy link

wesley-931 commented Aug 15, 2024

Question, I see no "build" in the "scripts" section of the package.json.

I only see tsx index.ts, this might impact peformance correct?

Will there be a way to deploy the builded version of the TS to JS?

Like something in the way of:

    "build": "npx tsc && npx tsc-alias",
    "start:prod": "node dist/index.js",

@@ -0,0 +1,20 @@
{
"name": "squadjs-api-plugin",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be squadjs-command-plugin right?

@ar1ocker
Copy link

Is this pr still in development or abandoned?

@werewolfboy13
Copy link
Collaborator

Is this pr still in development or abandoned?

Its in progress but still being worked on slowly. There is internal conversations happening from time to time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

5 participants