Skip to content

Commit

Permalink
switch over visual-diff task to directly use doServe instead of sta…
Browse files Browse the repository at this point in the history
…rtServer
  • Loading branch information
erwinmombay committed Feb 26, 2021
1 parent ad55ad4 commit e5ce46a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions build-system/tasks/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ async function startServer(
serverOptions = {},
modeOptions = {}
) {
if (modeOptions.esm || argv.esm) {
buildNewServer();
}
if (serverOptions.lazyBuild) {
lazyBuild = serverOptions.lazyBuild;
}
Expand Down Expand Up @@ -226,23 +229,19 @@ async function serve() {

/**
* Starts a webserver at the repository root to serve built files.
* @param {ServerOptionsDef=} serverOptions
* @param {ModeOptionsDef=} modeOptions
* @param {?ServerOptionsDef} serverOptions
* @param {?ModeOptionsDef} modeOptions
*/
async function doServe(serverOptions = {}, modeOptions = {}) {
createCtrlcHandler('serve');
const watchFunc = async () => {
await restartServer(serverOptions, modeOptions);
};
watch(serverFiles).on('change', debounce(watchFunc, watchDebounceDelay));
if (modeOptions.esm || argv.esm) {
buildNewServer();
}
await startServer(
{},
{lazyBuild: serverOptions.lazyBuild},
{esm: 'esm' in modeOptions ? modeOptions.esm : argv.esm}
);
await startServer({}, serverOptions, {
...modeOptions,
esm: 'esm' in modeOptions ? modeOptions.esm : argv.esm,
});
if (serverOptions.lazyBuild) {
await performPreBuildSteps();
}
Expand Down

0 comments on commit e5ce46a

Please sign in to comment.