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 configuration support #1288

Open
TwitchBronBron opened this issue Aug 20, 2024 · 0 comments
Open

Plugin configuration support #1288

TwitchBronBron opened this issue Aug 20, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@TwitchBronBron
Copy link
Member

Add formal support for plugin configurations in the bsconfig.

Here's how it should work:

existing plugin string shorthand will still work

"plugins": [
    "./path/to/plugin.js",
    "plugin-from-node_modules"
]

plugin definitions can now be objects, with the following properties

  • src - the plugin string shorthand described above (an npm package name, or a path to a nodejs script)
  • config - the plugin-specific config object that will be given to the plugin, or a path to a jsonc config file to be loaded
"plugins": [
    {
        "src": "./path-to-plugin.js"
        "config": {
            //plugin-specific config
         }
    }, 
    {
        "src": "plugin-from-node_modules",
        "config": "path/to/config.json"
    }
]      

Plugins are given their configurations in a new lifecycle hook

This new configuration will be passed to the plugin in a new lifecycle hook (possibly called onSetConfiguration). Plugins may be reconfigured many times depending on whether watched files (such as bsconfig or specific plugin files) changed.

public onSetConfiguration(config: YourConfigInterfaceType) {
    this.config = config;
    //do stuff based on this config
}
@TwitchBronBron TwitchBronBron added the enhancement New feature or request label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant