-
Notifications
You must be signed in to change notification settings - Fork 7
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
Redesign plugin config interface #17
Comments
@Dan-Shields Would appreciate if you have any inputs on this |
Can you give an example of a src structure that isn't supported by the current config interface? I went through a few iterations that was aimed at allowing any kind of structure, Also I think this loses the ability to assign a specific template to a specific single graphic/dashboard, no? But I agree that the current config could and probably should be improved! |
One example of unsupported structure is not having a If we need to support templates for a specific file, interface PluginConfig {
// can be a path, glob path, or array of those
graphics?: string | string[];
dashboard?: string | string[];
template?:
| string
| { graphics?: string, dashboard?: string }
| Array<{ template: string, input: string | string[] }>
output?: { graphics?: string, dashboard?: string, shared?: string };
} it should at least not be a vague key value pair of object. |
Struggling to get my head around the new interface. I have this config in the test bundle: {
inputs: {
'graphics/special_graphic.js': './templates/special_template.html',
'graphics/*/main.js': './templates/graphics.html',
'dashboard/*/main.js': './templates/dashboard.html',
},
} Would then that become?: {
graphics: ['src/graphics/special_graphic.js', 'src/graphics/*/main.js'],
dashboard: 'src/dashboard/*/main.js',
template: [
{
inputs: 'src/graphics/*/main.js',
template: 'templates/graphics.html'
},
{
inputs: 'src/graphics/special_graphic.js',
template: 'templates/special_template.html'
},
{
inputs: 'src/dashboard/*/main.js',
template: 'templates/dashboard.html'
}
]
} While the fact its longer isn't necessarily a bad thing, I'm not sure its any more understandable, and kinda has redundant bits. In fact, it would probably work with just the "template" section, no? That could work? It's very possible the mock bundle is structured in a way no one but me actually uses, so feel free to suggest a more "standard" setup. |
Having The graphics/dashboard and template field configure two completely independent concepts. The graphics/dashboard field defines which input files should be used and output to which directory. The template field defines which template file should be used for which input file. In most cases, where you use only one framework, you would only have one or at most two template files with simple template config. I have not encountered a case where I need to define a special template file for a certain input, but if you need to do that special case, inevitably configuration becomes bigger and redundant. |
To reduce redundancy, config can be structured like this. This is more consistent and easy to modify when you have to add special template on top of current setup. {
graphics: ['src/graphics/special_graphic.js', 'src/graphics/*/main.js'],
dashboard: 'src/dashboard/*/main.js',
template: {
graphics: 'templates/graphics.html',
dashboard: 'templates/dashboard.html',
override: [
{
input: 'src/graphics/special_graphic.js',
template: 'templates/special_template.html',
},
],
},
} |
Gonna give this one over to you @Hoishin, not sure I have any more input. I haven't used nodecg, nevermind this plugin for a couple of years so I'll let you take it whichever direction you see fit. |
OK! Fair enough. I've got valuable feedback from you too so it's not like you have to be an active user. |
I do not like the current plugin config structure. I'm not using this plugin because of that.
Current interface
Problems
It has a certain assumption on project structure inside
src
. Ifsrc
directory is structured differently, it cannot do the job as expected.The
inputs
interface is implicit, you can't know if the key is template or the value is template.You don't know how the output directory is determined. It makes plugin behavior hidden in a blackbox and hard to predict what happens, and makes the plugin implementation more complicated and harder to maintain.
New config interface
Because this is built for NodeCG, and NodeCG has a clear boundary of
dashboard
andgraphics
, there is no reason not to have a clear entry points for dashboard and graphics individually.The text was updated successfully, but these errors were encountered: