Add --ignore-plugins flag to abell serve
saurabhdaware opened this issue Β· comments
Is your feature request related to a problem? Please describe.
Plugins can have additional sources (CHANGELOGS, READMES) which can slow down the development process if you don't want to test them on every run.
Describe the solution you'd like
Calling abell serve --ignore-plugins
should ignore the plugin execution.
Approach
- We will have to register this flag in bin/abell.js
- Add flag value
true
orfalse
toprogramInfo
in src/commands/serve.js - On true, ignore calling
executeAfterBuildPlugins
andexecuteBeforeBuildPlugins
functions in the serve.js - ignore calling
executeBeforeHTMLWritePlugins
from src/utils/generate-site.js
This issue can be a good start for beginners so if you're experienced and comfortable with GitHub, Please look for other issues and leave this issue for beginners to that they can get started :D
Hey, I'm working on this. (I guess I'm done too).
Just a query: What exactly does the createContent
function do and can I move the programInfo
property assignments before that function?
Something like this:
async function serve(command) {
const programInfo = getProgramInfo();
programInfo.ignorePlugins = command['ignore-plugins'];
programInfo.port = command.port;
programInfo.logs = 'minimum';
programInfo.task = 'serve';
programInfo.abellConfig.outputPath = '.debug';
// createContent function that goes to plugins
const createContent = (pluginNode) => {
programInfo.contentMap[pluginNode.slug] = getSourceNodeFromPluginNode(
pluginNode
);
};
.
.
.
}
Also, (guessing this because it involves plugins and I couldn't really find any use of it in serving other than the *BuildPlugins
functions) should we ignore executing that function too while serving?
createContent
function is used in plugins to create source plugins
https://github.com/abelljs/official-plugins/blob/main/abell-source-devto/plugin/index.js#L23
Is there any specific reason to move it below? I don't think so it breaks anything as long as it is above the executeBuildPlugins function but it is just safe to change minimal things possible π
If we ignore executeBeforeBuild
function then createContent won't be called anyway so it is fine to keep it out of the if condition for now
We should have integration tests for official plugins. I will create an issue for it. Then someone can pick it up.
Having those tests would be valuable as we will have some confidence when we will change the renderer code.
Edit:
Issue created: https://github.com/abelljs/abell/issues/78
We have https://github.com/abelljs/abell/blob/main/examples/with-plugin/with-plugin.spec.js to test beforeHTMLWrite
and beforeBuild
with createContent()
. I just realized It lacks the test for afterBuild
though.
@saurabhdaware That is a unit test though.
Integration tests is also required here between plugins as unit tests can't catch bugs caused by order of execution
Is there any specific reason to move it below?
Currently the executeBeforeBuildPlugins
is executed before all the properties of programInfo
are assigned. In order to check for the --ignore-plugin
flag, I had to assign a property before the execution. So I thought why not assign them at one place?(and the beginning of the function seemed like a really good place)
I don't think so it breaks anything as long as it is above the executeBuildPlugins function but it is just safe to change minimal things possible π
Totally agree with this and that's the reason I thought asking for opinions would be better (even if it is such a small thing) as I'm new to the repository.
If we ignore executeBeforeBuild function then createContent won't be called anyway so it is fine to keep it out of the if condition for now
Yeah, got it! π
Thanks for assigning me!