Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
35 changes: 25 additions & 10 deletions docs/scully-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ If you are starting to use scully we highly recommend read the [Getting Started]
also if you want to enhance you project made with scully, visit the [Utils](utils.md) section and see
or teach to the community how to combine scully with others tools.

- [`ScullyConfig` Interface](#scullyconfig-interface)
- [projectRoot](#projectRoot)
- [homeFolder](#homeFolder)
- [outDir](#outDir)
- [distFolder](#distFolder)
- [routes](#routes)
- [extraRoutes](#extraRoutes)
- [appPort](#appPort)
- [staticport](#staticport)
- [Scully Configuration](#scully-configuration)
- [`ScullyConfig` Interface](#scullyconfig-interface)
- [scullyConfig properties explained](#scullyconfig-properties-explained)
- [projectRoot](#projectroot)
- [homeFolder](#homefolder)
- [outDir](#outdir)
- [distFolder](#distfolder)
- [routes](#routes)
- [handled Routes](#handled-routes)
- [unhandled Routes](#unhandled-routes)
- [extraRoutes](#extraroutes)
- [appPort](#appport)
- [staticport](#staticport)
- [puppeteerLaunchOptions](#puppeteerlaunchoptions)

## `ScullyConfig` Interface

Expand All @@ -29,11 +34,14 @@ export interface ScullyConfig {
extraRoutes?: string[];
appPort: number;
staticport: number;
puppeteerLaunchOptions?: LaunchOptions;
}
```

`ScullyConfig` interface provide the parameters to configure how scully works in your project.

## scullyConfig properties explained

### projectRoot

`projectRoot` is reference to the path to the project where scully will intervene.
Expand Down Expand Up @@ -87,7 +95,7 @@ I you want to know more about plugins go to [Plugins](plugins.md) section.

### extraRoutes

The `extraRoutes` property allow to the developer add an array of handled routes to discover by Scully.
The `extraRoutes` property allow to the developer add an array of unhandled routes to discover by Scully.
These can be routes that exist in AngularJS, or in React, or in whatever Framework's router.

It can be handle `:string`, `Promise<string>` or `Promise<Array<string>>`
Expand All @@ -110,4 +118,11 @@ which will serve static files compiled by Scully.

The port by default is: `1668`

### puppeteerLaunchOptions

When in a restricted environment there is a change the default options for puppeteer won't work. In such a case
this option can override the puppeteerLaunchOptions with settings that match this environment.
Word of warning, some settings might interfer with the way Scully is working, creating errornous results.
Follow [this link](https://pptr.dev/#?product=Puppeteer&version=v2.0.0&show=api-puppeteerlaunchoptions) for more information

[Full Documentation ➡️](scully.md)
14 changes: 7 additions & 7 deletions scully/renderPlugins/launchedBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Observable} from 'rxjs';
import {shareReplay, take} from 'rxjs/operators';
import {log} from '../utils/log';
import * as yargs from 'yargs';
import {scullyConfig} from '../utils/config';

const {showBrowser} = yargs
.boolean('sb')
Expand All @@ -14,14 +15,13 @@ const launched = obsBrowser().pipe(shareReplay({refCount: false, bufferSize: 1})
export const launchedBrowser: () => Promise<Browser> = () => launched.pipe(take(1)).toPromise();
let browser: Browser;

function obsBrowser(
options: LaunchOptions = {
headless: !showBrowser,
// dumpio: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
function obsBrowser(options: LaunchOptions = scullyConfig.puppeteerLaunchOptions || {}): Observable<Browser> {
if (showBrowser) {
options.headless = false;
}
): Observable<Browser> {
const { SCULLY_PUPPETEER_EXECUTABLE_PATH } = process.env;
// option.args= ['--no-sandbox', '--disable-setuid-sandbox'],

const {SCULLY_PUPPETEER_EXECUTABLE_PATH} = process.env;
if (SCULLY_PUPPETEER_EXECUTABLE_PATH) {
log(`Launching puppeteer with executablePath ${SCULLY_PUPPETEER_EXECUTABLE_PATH}`);
options.executablePath = SCULLY_PUPPETEER_EXECUTABLE_PATH;
Expand Down
3 changes: 3 additions & 0 deletions scully/utils/interfacesandenums.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {LaunchOptions} from 'puppeteer';

export enum RouteTypes {
json = 'json',
contentFolder = 'contentFolder',
Expand All @@ -14,6 +16,7 @@ export interface ScullyConfig {
extraRoutes?: string[];
appPort: number;
staticport: number;
puppeteerLaunchOptions?: LaunchOptions;
}

interface RouteConfig {
Expand Down