Skip to content

Commit

Permalink
feat(scully): cache the version number during rendering (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderElias authored Apr 23, 2020
1 parent 2ecc216 commit edbdcc3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scully/renderPlugins/puppeteerRenderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import {createFolderFor} from '../utils';

const errorredPages = new Set<string>();

let version = '0.0.0';
try {
const {version: pkgVersion} = jsonc.parse(readFileSync(join(__dirname, '../package.json')).toString());
version = pkgVersion || '0.0.0';
} catch {}

export const puppeteerRender = async (route: HandledRoute): Promise<string> => {
const timeOutValueInSeconds = 25;
let version = '0.0.0';
try {
const {version: pkgVersion} = jsonc.parse(readFileSync(join(__dirname, '../package.json')).toString());
version = pkgVersion || '0.0.0';
} catch {}
const path = scullyConfig.hostUrl
? `${scullyConfig.hostUrl}${route.route}`
: `http${ssl ? 's' : ''}://${scullyConfig.hostName}:${scullyConfig.appPort}${route.route}`;
Expand Down

0 comments on commit edbdcc3

Please sign in to comment.