Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions libs/scully/src/lib/renderPlugins/puppeteerRenderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ const errorredPages = new Set<string>();

let version = '0.0.0';
try {
version =
jsonc.parse(readFileSync(join(__dirname, '../package.json')).toString())
.version || '0.0.0';
} catch {
const pkg = join(__dirname, '../../package.json');
// console.log(pkg)
version = jsonc.parse(readFileSync(pkg).toString()).version || '0.0.0';
} catch (e) {
// this is only for internals builds
// version = jsonc.parse(readFileSync(join(__dirname, '../../../package.json')).toString()).version || '0.0.0';
}
console.log(version);

export const puppeteerRender = async (route: HandledRoute): Promise<string> => {
const timeOutValueInSeconds = 25;
Expand Down Expand Up @@ -52,10 +53,12 @@ export const puppeteerRender = async (route: HandledRoute): Promise<string> => {
page.on('requestfailed', unRegisterRequest);

const requests = new Set();
// eslint-disable-next-line no-inner-declarations
function registerRequest(request) {
request.continue();
requests.add(requests);
}
// eslint-disable-next-line no-inner-declarations
function unRegisterRequest(request) {
// request.continue();
requests.delete(requests);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ContentFolder: Test blog/page-1 Check contentPlugin render 1`] = `
"<!DOCTYPE html><html lang=\\"en\\"><head><meta name=\\"generator\\" content=\\"Scully 0.0.0\\">
"<!DOCTYPE html><html lang=\\"en\\"><head><meta name=\\"generator\\" content=\\"Scully 0.0.92\\">
<meta charset=\\"utf-8\\">
<title>SampleBlog</title>
<base href=\\"/\\">
Expand All @@ -17,7 +17,7 @@ exports[`ContentFolder: Test blog/page-1 Check contentPlugin render 1`] = `
}
</style><script>window['ScullyIO']='generated';</script></head>

<body scully-version=\\"0.0.0\\">
<body >
<app-root class=\\"foo\\" =\\"\\" > Scully demo blog app! <small =\\"\\">rendering inside scully</small></h1><a =\\"\\" href=\\"/home/\\">🏠</a></header><main =\\"\\"><router-outlet =\\"\\"></router-outlet><app-blog =\\"\\"><h3 =\\"\\">Scully blog content</h3>
<hr =\\"\\">

Expand Down Expand Up @@ -62,7 +62,7 @@ exports[`ContentFolder: Test blog/page-1 Check contentPlugin render 1`] = `
`;

exports[`Static: Test blog index Check clean blog index by scully 1`] = `
"<!DOCTYPE html><html lang=\\"en\\"><head><meta name=\\"generator\\" content=\\"Scully 0.0.0\\">
"<!DOCTYPE html><html lang=\\"en\\"><head><meta name=\\"generator\\" content=\\"Scully 0.0.92\\">
<meta charset=\\"utf-8\\">
<title>SampleBlog</title>
<base href=\\"/\\">
Expand All @@ -71,7 +71,7 @@ exports[`Static: Test blog index Check clean blog index by scully 1`] = `
<link rel=\\"stylesheet\\" href=\\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css\\">
<link rel=\\"stylesheet\\" href=\\"styles.css\\"><style>[]{display:grid;height:100vh;grid-template-rows:60px 1fr 60px}[] > header[]{display:grid;background-color:#4169e1;color:#f5f5f5;margin:0;padding:0 10px;grid-template-columns:1fr 40px;place-items:center center}footer[] h3[], header[] h1[]{margin:0}[] > footer[]{display:grid;background-color:#4169e1;color:#f5f5f5;margin:0;padding-right:10px;justify-content:right;align-content:center}main[]{background-color:#f5f5f5;color:#040c24;padding:10px}</style><script charset=\\"utf-8\\" src=\\"6-es2015.js\\"></script><script charset=\\"utf-8\\" src=\\"10-es2015.js\\"></script><style>[]{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}[] h1[]:first-child{grid-column:span 3;text-align:center}article[]{background-color:#4169e1;padding:5px;border-radius:5px;color:#f5f5f5}</style><script>window['ScullyIO']='generated';</script></head>

<body scully-version=\\"0.0.0\\">
<body >
<app-root class=\\"foo\\" =\\"\\" > Scully demo blog app! <small =\\"\\">rendering inside scully</small></h1><a =\\"\\" href=\\"/home/\\">🏠</a></header><main =\\"\\"><router-outlet =\\"\\"></router-outlet><app-blog-list =\\"\\"><h1 =\\"\\">Overview of blog posts</h1><a =\\"\\" href=\\"/blog/2014/2/12/asdf/\\"><article =\\"\\"><h3 =\\"\\">Deeply embedded</h3><h4 =\\"\\">11/27/19</h4><p =\\"\\">This is the deep folder demo page in this sample.</p></article></a><a =\\"\\" href=\\"/blog/page-1/\\"><article =\\"\\"><h3 =\\"\\">My first page</h3><h4 =\\"\\">11/26/19</h4><p =\\"\\">This is the first demo page in this sample.</p></article></a><a =\\"\\" href=\\"/blog/page-3/\\"><article =\\"\\"><h3 =\\"\\">My third page</h3><h4 =\\"\\">11/28/19</h4><p =\\"\\">At this point, I should write something different in here.</p></article></a><a =\\"\\" href=\\"/blog/page-4/\\"><article =\\"\\"><h3 =\\"\\">The Rainbow Cat, A free book out of the Guttenberg library</h3><h4 =\\"\\">12/16/19</h4><p =\\"\\"></p></article></a><a =\\"\\" href=\\"/blog/page-5/\\"><article =\\"\\"><h3 =\\"\\">/blog/page-5</h3><h4 =\\"\\"></h4><p =\\"\\"></p></article></a><a =\\"\\" href=\\"/blog/test/testing/\\"><article =\\"\\"><h3 =\\"\\">My test sub page</h3><h4 =\\"\\">11/27/19</h4><p =\\"\\">This is the second demo page in this sample.</p></article></a><!----></app-blog-list><!----></main><footer =\\"\\"><h3 =\\"\\">Made with ❤️ <strong =\\"\\">@HeroDevs</strong></h3></footer></app-root>
<script id=\\"ScullyIO-transfer-state\\"></script><script src=\\"runtime-es2015.js\\" type=\\"module\\"></script><script src=\\"runtime-es5.js\\" nomodule=\\"\\" defer=\\"\\"></script><script src=\\"polyfills-es5.js\\" nomodule=\\"\\" defer=\\"\\"></script><script src=\\"polyfills-es2015.js\\" type=\\"module\\"></script><script src=\\"main-es2015.js\\" type=\\"module\\"></script><script src=\\"main-es5.js\\" nomodule=\\"\\" defer=\\"\\"></script>

Expand Down
4 changes: 2 additions & 2 deletions tests/jest/src/__tests__/__snapshots__/home.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Check list of all Check clean all list from scully 1`] = `
"<!DOCTYPE html><html lang=\\"en\\"><head><meta name=\\"generator\\" content=\\"Scully 0.0.0\\">
"<!DOCTYPE html><html lang=\\"en\\"><head><meta name=\\"generator\\" content=\\"Scully 0.0.92\\">
<meta charset=\\"utf-8\\">
<title>SampleBlog</title>
<base href=\\"/\\">
Expand All @@ -10,7 +10,7 @@ exports[`Check list of all Check clean all list from scully 1`] = `
<link rel=\\"stylesheet\\" href=\\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/default.min.css\\">
<link rel=\\"stylesheet\\" href=\\"styles.css\\"><style>[]{display:grid;height:100vh;grid-template-rows:60px 1fr 60px}[] > header[]{display:grid;background-color:#4169e1;color:#f5f5f5;margin:0;padding:0 10px;grid-template-columns:1fr 40px;place-items:center center}footer[] h3[], header[] h1[]{margin:0}[] > footer[]{display:grid;background-color:#4169e1;color:#f5f5f5;margin:0;padding-right:10px;justify-content:right;align-content:center}main[]{background-color:#f5f5f5;color:#040c24;padding:10px}</style><script charset=\\"utf-8\\" src=\\"12-es2015.js\\"></script><script charset=\\"utf-8\\" src=\\"10-es2015.js\\"></script><style>li[]{display:grid;grid-template-columns:200px 200px}a.btn[]{display:inline-block;padding:10px;margin:10px 3px;width:200px;height:40px;border-radius:4px;background-color:#4169e1;color:#fff;text-align:center;text-decoration:none;box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);transition:all .3s cubic-bezier(.25,.8,.25,1)}a.btn[]:hover{box-shadow:0 14px 28px rgba(0,0,0,.25),0 6px 6px rgba(0,0,0,.22)}a.btn[]:active{box-shadow:0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24)}</style><script>window['ScullyIO']='generated';</script></head>

<body scully-version=\\"0.0.0\\">
<body >
<app-root class=\\"foo\\" =\\"\\" > Scully demo blog app! <small =\\"\\">rendering inside scully</small></h1><a =\\"\\" href=\\"/home/\\">🏠</a></header><main =\\"\\"><router-outlet =\\"\\"></router-outlet><app-static =\\"\\"><h1 =\\"\\">Available routes</h1><a =\\"\\" class=\\"btn\\" href=\\"/home/\\">Top level routes only</a><!----><!----><a =\\"\\" class=\\"btn\\" href=\\"/home/unpublished/\\">Unpublished routes</a><!----><ul =\\"\\"><li =\\"\\"><strong =\\"\\">routelink</strong><strong =\\"\\">full page reload</strong></li><li =\\"\\"><a =\\"\\" href=\\"/about/\\">/about</a><a =\\"\\" href=\\"/about/\\">/about</a></li><li =\\"\\"><a =\\"\\" href=\\"/home/all/\\">/home/all</a><a =\\"\\" href=\\"/home/all/\\">/home/all</a></li><li =\\"\\"><a =\\"\\" href=\\"/home/unpublished/\\">/home/unpublished</a><a =\\"\\" href=\\"/home/unpublished/\\">/home/unpublished</a></li><li =\\"\\"><a =\\"\\" href=\\"/home/\\">/home/</a><a =\\"\\" href=\\"/home/\\">/home/</a></li><li =\\"\\"><a =\\"\\" href=\\"/home/\\">/home</a><a =\\"\\" href=\\"/home/\\">/home</a></li><li =\\"\\"><a =\\"\\" href=\\"/blog/\\">/blog</a><a =\\"\\" href=\\"/blog/\\">/blog</a></li><li =\\"\\"><a =\\"\\" href=\\"/blog/2014/2/12/asdf/\\">Deeply embedded</a><a =\\"\\" href=\\"/blog/2014/2/12/asdf/\\">Deeply embedded</a></li><li =\\"\\"><a =\\"\\" href=\\"/blog/page-1/\\">My first page</a><a =\\"\\" href=\\"/blog/page-1/\\">My first page</a></li><li =\\"\\"><a =\\"\\" href=\\"/blog/page-3/\\">My third page</a><a =\\"\\" href=\\"/blog/page-3/\\">My third page</a></li><li =\\"\\"><a =\\"\\" href=\\"/blog/page-4/\\">The Rainbow Cat, A free book out of the Guttenberg library</a><a =\\"\\" href=\\"/blog/page-4/\\">The Rainbow Cat, A free book out of the Guttenberg library</a></li><li =\\"\\"><a =\\"\\" href=\\"/blog/page-5/\\">/blog/page-5</a><a =\\"\\" href=\\"/blog/page-5/\\">/blog/page-5</a></li><li =\\"\\"><a =\\"\\" href=\\"/blog/test/testing/\\">My test sub page</a><a =\\"\\" href=\\"/blog/test/testing/\\">My test sub page</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/\\">/user</a><a =\\"\\" href=\\"/user/\\">/user</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/\\">/user/1</a><a =\\"\\" href=\\"/user/1/\\">/user/1</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/\\">/user/2</a><a =\\"\\" href=\\"/user/2/\\">/user/2</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/1/\\">/user/1/post/1</a><a =\\"\\" href=\\"/user/1/post/1/\\">/user/1/post/1</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/2/\\">/user/1/post/2</a><a =\\"\\" href=\\"/user/1/post/2/\\">/user/1/post/2</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/3/\\">/user/1/post/3</a><a =\\"\\" href=\\"/user/1/post/3/\\">/user/1/post/3</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/4/\\">/user/1/post/4</a><a =\\"\\" href=\\"/user/1/post/4/\\">/user/1/post/4</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/5/\\">/user/1/post/5</a><a =\\"\\" href=\\"/user/1/post/5/\\">/user/1/post/5</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/6/\\">/user/1/post/6</a><a =\\"\\" href=\\"/user/1/post/6/\\">/user/1/post/6</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/7/\\">/user/1/post/7</a><a =\\"\\" href=\\"/user/1/post/7/\\">/user/1/post/7</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/8/\\">/user/1/post/8</a><a =\\"\\" href=\\"/user/1/post/8/\\">/user/1/post/8</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/9/\\">/user/1/post/9</a><a =\\"\\" href=\\"/user/1/post/9/\\">/user/1/post/9</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/1/post/10/\\">/user/1/post/10</a><a =\\"\\" href=\\"/user/1/post/10/\\">/user/1/post/10</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/11/\\">/user/2/post/11</a><a =\\"\\" href=\\"/user/2/post/11/\\">/user/2/post/11</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/12/\\">/user/2/post/12</a><a =\\"\\" href=\\"/user/2/post/12/\\">/user/2/post/12</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/13/\\">/user/2/post/13</a><a =\\"\\" href=\\"/user/2/post/13/\\">/user/2/post/13</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/14/\\">/user/2/post/14</a><a =\\"\\" href=\\"/user/2/post/14/\\">/user/2/post/14</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/15/\\">/user/2/post/15</a><a =\\"\\" href=\\"/user/2/post/15/\\">/user/2/post/15</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/16/\\">/user/2/post/16</a><a =\\"\\" href=\\"/user/2/post/16/\\">/user/2/post/16</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/17/\\">/user/2/post/17</a><a =\\"\\" href=\\"/user/2/post/17/\\">/user/2/post/17</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/18/\\">/user/2/post/18</a><a =\\"\\" href=\\"/user/2/post/18/\\">/user/2/post/18</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/19/\\">/user/2/post/19</a><a =\\"\\" href=\\"/user/2/post/19/\\">/user/2/post/19</a></li><li =\\"\\"><a =\\"\\" href=\\"/user/2/post/20/\\">/user/2/post/20</a><a =\\"\\" href=\\"/user/2/post/20/\\">/user/2/post/20</a></li><li =\\"\\"><a =\\"\\" href=\\"/demo/0/\\">/demo/0</a><a =\\"\\" href=\\"/demo/0/\\">/demo/0</a></li><li =\\"\\"><a =\\"\\" href=\\"/demo/1/\\">/demo/1</a><a =\\"\\" href=\\"/demo/1/\\">/demo/1</a></li><li =\\"\\"><a =\\"\\" href=\\"/demo/2/\\">/demo/2</a><a =\\"\\" href=\\"/demo/2/\\">/demo/2</a></li><li =\\"\\"><a =\\"\\" href=\\"/demo/3/\\">/demo/3</a><a =\\"\\" href=\\"/demo/3/\\">/demo/3</a></li><li =\\"\\"><a =\\"\\" href=\\"/demo/4/\\">/demo/4</a><a =\\"\\" href=\\"/demo/4/\\">/demo/4</a></li><li =\\"\\"><a =\\"\\" href=\\"/slow/\\">/slow</a><a =\\"\\" href=\\"/slow/\\">/slow</a></li><li =\\"\\"><a =\\"\\" href=\\"/manualIdle/\\">/manualIdle</a><a =\\"\\" href=\\"/manualIdle/\\">/manualIdle</a></li><li =\\"\\"><a =\\"\\" href=\\"/\\">/</a><a =\\"\\" href=\\"/\\">/</a></li><li =\\"\\"><a =\\"\\" href=\\"/exclude/present/\\">/exclude/present</a><a =\\"\\" href=\\"/exclude/present/\\">/exclude/present</a></li><!----></ul></app-static><!----></main><footer =\\"\\"><h3 =\\"\\">Made with ❤️ <strong =\\"\\">@HeroDevs</strong></h3></footer></app-root>
<script id=\\"ScullyIO-transfer-state\\"></script><script src=\\"runtime-es2015.js\\" type=\\"module\\"></script><script src=\\"runtime-es5.js\\" nomodule=\\"\\" defer=\\"\\"></script><script src=\\"polyfills-es5.js\\" nomodule=\\"\\" defer=\\"\\"></script><script src=\\"polyfills-es2015.js\\" type=\\"module\\"></script><script src=\\"main-es2015.js\\" type=\\"module\\"></script><script src=\\"main-es5.js\\" nomodule=\\"\\" defer=\\"\\"></script>

Expand Down
Loading