Skip to content

Commit

Permalink
chore(monorepo) add tools and update dependecies (scullyio#619)
Browse files Browse the repository at this point in the history
* refactor(monorepo): add tools and scripts to aid testing and building docs

* chore(monorepo): use scully-docs for kill

* chore(monorepo): update depedencies, and use correct 'utf-8' in tests
  • Loading branch information
SanderElias authored Jun 9, 2020
1 parent a9dcaf4 commit db16d15
Show file tree
Hide file tree
Showing 16 changed files with 5,215 additions and 3,215 deletions.
13 changes: 10 additions & 3 deletions libs/scully/src/lib/renderPlugins/puppeteerRenderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { interval, Subject } from 'rxjs';
import { filter, switchMap, take } from 'rxjs/operators';
import { HandledRoute } from '../routerPlugins/addOptionalRoutesPlugin';
import { createFolderFor } from '../utils';
import { ssl } from '../utils/cli-options';
import { ssl, showBrowser } from '../utils/cli-options';
import { scullyConfig } from '../utils/config';
import { logError, yellow } from '../utils/log';
import { launchedBrowser } from './launchedBrowser';
Expand Down Expand Up @@ -135,8 +135,15 @@ export const puppeteerRender = async (route: HandledRoute): Promise<string> => {
await page.goto(path);
pageLoaded.next();

/** wait for page-read, timeout @ 25 seconds. */
await Promise.race([pageReady, waitForIt(timeOutValueInSeconds * 1000)]);
/**
* when the browser is shown, use a 2 minute timeout, otherwise
* wait for page-read || timeout @ 25 seconds.
*/
if (showBrowser) {
await waitForIt(120 * 1000);
} else {
await Promise.race([pageReady, waitForIt(timeOutValueInSeconds * 1000)]);
}
// await Promise.race([ waitForIt(120 * 1000)]);

/** when done, add in some scully content. */
Expand Down
6 changes: 5 additions & 1 deletion libs/scully/src/lib/utils/serverstuff/staticServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ export async function staticServer(port?: number) {
angularDistServer.use(compression());
proxyAdd(angularDistServer);
angularDistServer.get('/_pong', (req, res) => {
res.json({ res: true, homeFolder: scullyConfig.homeFolder });
res.json({
res: true,
homeFolder: scullyConfig.homeFolder,
projectName: scullyConfig.projectName
});
});
angularDistServer.get('/killMe', async (req, res) => {
logWarn('Received Kill command');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ export const waitForServerToBeAvailable = () =>
scullyConfig.appPort
}/_pong`,
{
suppressErrors: true
suppressErrors: true,
}
)
.then((res: any) => {
if (res && res.res) {
if (res.homeFolder !== scullyConfig.homeFolder) {
if (
res.homeFolder !== scullyConfig.homeFolder ||
res.projectName !== scullyConfig.projectName
) {
logWarn(
'`scully serve` is running in a different project. you can kill it by running `npx scully killServer`'
);
Expand All @@ -37,7 +40,7 @@ export const waitForServerToBeAvailable = () =>
}
setTimeout(tryServer, 125);
})
.catch(e => {
.catch((e) => {
// console.log(e);
setTimeout(tryServer, 125);
});
Expand Down
Loading

0 comments on commit db16d15

Please sign in to comment.