Skip to content

Instantly share code, notes, and snippets.

@ZackDeRose
Created January 26, 2023 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZackDeRose/ee4d29ed1f3386bb2f01d54a7c64c02b to your computer and use it in GitHub Desktop.
Save ZackDeRose/ee4d29ed1f3386bb2f01d54a7c64c02b to your computer and use it in GitHub Desktop.
async function startBackendServer(options: ServeFullstackExecutorSchema) {
let frontendServerStarted = false;
return new Promise(() => {
const childProcess = exec(`npx nx serve ${options.backendProject}`, {
maxBuffer: LARGE_BUFFER,
});
process.on('exit', () => childProcess.kill());
process.on('SIGTERM', () => childProcess.kill());
childProcess.stdout.on('data', (data) => {
if (!frontendServerStarted && data.includes('build succeeded, watching for changes...')) {
startFrontendServer(options.frontendProject, targetPadSize);
frontendServerStarted = true;
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment