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
2 changes: 1 addition & 1 deletion scully.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports.config = {
projectRoot: './projects/sampleBlog/src/app',
/** outDir is where the static distribution files end up */
outDir: './dist/static',

hostUrl: 'http://localhost:5000',
routes: {
'/demo/:id': {
type: 'extra',
Expand Down
8 changes: 5 additions & 3 deletions scully/renderPlugins/puppeteerRenderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import {logError, yellow} from '../utils/log';
import {launchedBrowser} from './launchedBrowser';

export const puppeteerRender = async (route: HandledRoute): Promise<string> => {
const {version} = JSON.parse(readFileSync(join(__dirname, '../package.json')).toString()) || '0.0.0';
const path = `http://localhost:${scullyConfig.appPort}${route.route}`;
// const {version} = JSON.parse(readFileSync(join('../package.json')).toString()) || '0.0.0';
Comment thread
SanderElias marked this conversation as resolved.
const path = scullyConfig.hostUrl === null ?
`http://localhost:${scullyConfig.appPort}${route.route}`
: `${scullyConfig.hostUrl}${route.route}`;
let pageHtml: string;
let browser: Browser;
let page: Page;
Expand All @@ -28,7 +30,7 @@ export const puppeteerRender = async (route: HandledRoute): Promise<string> => {
resolve();
});

windowSet(page, 'scullyVersion', version);
// windowSet(page, 'scullyVersion', version);

/** Inject this into the running page, runs in browser*/
await page.evaluateOnNewDocument(() => {
Expand Down
8 changes: 7 additions & 1 deletion scully/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {ScullyConfig} from './interfacesandenums';
import {logError, logWarn, yellow} from './log';
import {validateConfig} from './validateConfig';
import {compileConfig} from './compileConfig';

export const angularRoot = findAngularJsonPath();
export const scullyConfig: ScullyConfig = {} as ScullyConfig;

Expand Down Expand Up @@ -35,6 +34,11 @@ const loadIt = async () => {
process.exit(15);
}

if (compiledConfig.hostUrl && compiledConfig.hostUrl.endsWith('/')) {
compiledConfig.hostUrl = compiledConfig.hostUrl.substr(0, compiledConfig.hostUrl.length - 1);
} else if (compiledConfig.hostUrl === undefined) {
compiledConfig.hostUrl = null;
}
// TODO: update types in interfacesandenums to force correct types in here.
// tslint:disable-next-line: no-unused-expression
Object.assign(
Expand All @@ -46,6 +50,8 @@ const loadIt = async () => {
appPort: /** 1864 */ 'herodevs'.split('').reduce((sum, token) => (sum += token.charCodeAt(0)), 1000),
staticport: /** 1771 */ 'scully'.split('').reduce((sum, token) => (sum += token.charCodeAt(0)), 1000),
defaultPostRenderers: [],
// tslint:disable-next-line:no-bitwise
hostUrl: compiledConfig.hostUrl
}
// compiledConfig
) as ScullyConfig;
Expand Down
1 change: 1 addition & 0 deletions scully/utils/interfacesandenums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface ScullyConfig {
appPort: number;
staticport: number;
puppeteerLaunchOptions?: LaunchOptions;
hostUrl?: string;
}

interface RouteConfig {
Expand Down