postStart plugin lifecycle
Have you read the Contributing Guidelines on issues?
- [X] I have read the Contributing Guidelines on issues.
Description
Implement postStart which is called when the dev server has finished starting. This is similar to postBuild but the dev server version.
Has this been requested on Canny?
No response
Motivation
Discussion is ongoing on what the functionality would be https://github.com/facebook/docusaurus/discussions/5616. Here is an implementation at postCompile https://github.com/facebook/docusaurus/pull/7737#issuecomment-1179482628.
https://docusaurus.io/docs/next/api/plugin-methods outlines that postStart is TBD.
API design
No response
Have you tried building it?
No response
Self-service
- [X] I'd be willing to contribute this feature to Docusaurus myself.
This seems like the best place to implement it, given that this is utilized by openBrowser which is called once.
https://github.com/facebook/docusaurus/blob/main/packages/docusaurus/src/commands/start.ts#L238-L243
const devServer = new WebpackDevServer(devServerConfig, compiler);
devServer.startCallback(() => {
if (cliOptions.open) {
openBrowser(openUrl);
}
});
I tried to implement the postStart hook as you suggested @Josh-Cena in https://github.com/facebook/docusaurus/pull/7751. Let me know if I can do anything else to help out. Really appreciate all the work you all do!
Closing issue related to closed PR: https://github.com/facebook/docusaurus/pull/7751
If someone come up with a strong use case for postStart we can revisit