-
Notifications
You must be signed in to change notification settings - Fork 257
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
Questions: Should we recommend self-registering plugins or manually registering plugins? #122
Comments
To add clarity: you would consume both of these the same way. For a plugin that queries a CMS or an API somewhere, your sample plugin config looks the same for both of these examples: // In your scully.config.js
exports.config = {
...,
routes: {
"/sample/:sampleId": {
type: "samplePlugin", // or the name you gave it when you manually register it
sampleId: {
cmsCredentials: {
publicKey: "1234",
privateKey: "abcd",
},
query(db){
return db.collection('sampleIds'); // in the database was firebase... example
},
property: 'item.id'
}
}
},
} |
@SanderElias @beeman @LayZeeDK @SanderElias @jorgeucano @Splaktar what do you all think? |
Self-registering plugins would make them easy to consume. Manually registered plugins might allow for some flexibility such as the |
The problem with "self-registration" is that somehow Scully needs to be able to pull those in. I would like to propose a middle ground, that doesn't need a list, and makes it easy to pull them in: require('./extraPlugin/extra-plugin.js')(registerPlugin); in /** plugin code here **/
module.exports = registerPlugin => registerPlugin('router', 'extra', extraRoutesPlugin); Works with #107 npm run scully addPluginToConfig "myNpmProvidedPlugin" which will add the line: require("myNpmProvidedPlugin")(registerPlugin); to the |
After talking to you this evening, I feel like simplifying the codebase by removing the dependency on Sander and I spoke about the advantages of using |
Are the docs still representative of how you want plugins to be registered? https://github.com/scullyio/scully/blob/master/docs/plugins.md |
Thank you, Sander. I'm thinking of creating some content about plugins. |
Self Registered Plugins vs Manually Registered Plugins
When people build a plugin for Scully, should we recommend a self registering plugin or a plugin that they will still need to call
registerPlugin
on?Which of these options would be the best? I am leaning towards Self Registered Plugins.
The text was updated successfully, but these errors were encountered: