Skip to content

Commit

Permalink
Add support for the --ignore-plugins flag (#80)
Browse files Browse the repository at this point in the history
* Add support for the --ignore-plugin flag

* fix eslint error

Co-authored-by: saurabhdaware <[email protected]>
  • Loading branch information
abhijit-hota and saurabhdaware authored Oct 1, 2020
1 parent 312dd6a commit 1bc13d0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions bin/abell.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ program.command('build').action(build);
program
.command('serve')
.option('--port [port]', 'Serve on different port')
.option('--ignore-plugins', 'Serve without plugins', false)
.action(serve);

/** abell -V */
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
"pre-commit": "npm run prettier && eslint . --fix && npm run eslint"
}
}
}
}
10 changes: 8 additions & 2 deletions src/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,11 @@ async function serve(command) {
);
};

await executeBeforeBuildPlugins(programInfo, { createContent });
programInfo.ignorePlugins = command.ignorePlugins;

if (!programInfo.ignorePlugins) {
await executeBeforeBuildPlugins(programInfo, { createContent });
}

programInfo.port = command.port;
programInfo.logs = 'minimum';
Expand All @@ -257,7 +261,9 @@ async function serve(command) {
process.exit(0);
}

await executeAfterBuildPlugins(programInfo);
if (!programInfo.ignorePlugins) {
await executeAfterBuildPlugins(programInfo);
}

runDevServer(programInfo);
}
Expand Down
6 changes: 4 additions & 2 deletions src/utils/generate-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ async function createHTMLFile(templateObj, programInfo, options) {
});
}

// Execute beforeHTMLWrite plugins
htmlOut = await executeBeforeHTMLWritePlugins(htmlOut, programInfo);
// Execute beforeHTMLWrite plugins if the --ignore-plugins flag is not passed
if (!programInfo.ignorePlugins) {
htmlOut = await executeBeforeHTMLWritePlugins(htmlOut, programInfo);
}

// Write into .html file
fs.writeFileSync(outPath, htmlOut);
Expand Down

0 comments on commit 1bc13d0

Please sign in to comment.