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
10 changes: 8 additions & 2 deletions scully/routerPlugins/traverseAppRoutesPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {parseAngularRoutes} from 'guess-parser';
import {join} from 'path';
import * as yargs from 'yargs';
import {scullyConfig, loadConfig} from '../utils/config';
import {scullyConfig} from '../utils/config';
import {existFolder} from '../utils/fsFolder';
import {green, logError, logWarn, yellow} from '../utils/log';

Expand All @@ -18,7 +18,13 @@ export const traverseAppRoutes = async (appRootFolder = scullyConfig.projectRoot
? scullyConfig.guessParserOptions.excludedFiles
: [];
try {
const file = join(appRootFolder, 'tsconfig.app.json');
let file = join(appRootFolder, 'tsconfig.app.json');
if (!existFolder(file)) {
file = join(appRootFolder, '../tsconfig.app.json');
}
if (!existFolder(file)) {
file = join(appRootFolder, '../../tsconfig.app.json');
}
if (!existFolder(file)) {
logWarn(
`We could not find "${yellow(
Expand Down
20 changes: 1 addition & 19 deletions scully/scully.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
import {readFileSync} from 'fs-extra';
import {join} from 'path';
import * as yargs from 'yargs';
import './pluginManagement/systemPlugins';
import {startBackgroundServer} from './startBackgroundServer';
import {loadConfig} from './utils/config';
Expand All @@ -16,28 +15,11 @@ import {logError, logWarn, yellow} from './utils/log';
import {startScully} from './utils/startup';
import {waitForServerToBeAvailable} from './utils/waitForServerToBeAvailable';
import {bootServe, isBuildThere, watchMode} from './watchMode';
import {watch, removeStaticDist} from './utils/cli-options';

/** the default of 10 is too shallow for generating pages. */
require('events').defaultMaxListeners = 100;

const {argv: options} = yargs.option('port', {
alias: 'p',
type: 'number',
description: 'The port to run on',
});

const {watch} = yargs
.boolean('wm')
.default('wm', false)
.alias('wm', 'watch')
.describe('wm', 'Use this flag for use the watch mode into scully').argv;

const {removeStaticDist} = yargs
.boolean('RSD')
.default('RSD', false)
.alias('RSD', 'removeStaticDist')
.describe('RSD', 'Use this flag to remove the Scully outfolder before starting').argv;

if (process.argv.includes('version')) {
const {version} = JSON.parse(readFileSync(join(__dirname, './package.json')).toString());
console.log('version:', version);
Expand Down
19 changes: 19 additions & 0 deletions scully/utils/cli-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as yargs from 'yargs';

export const {watch} = yargs
.boolean('wm')
.default('wm', false)
.alias('wm', 'watch')
.describe('wm', 'Use this flag for use the watch mode into scully').argv;

export const {removeStaticDist} = yargs
.boolean('RSD')
.default('RSD', false)
.alias('RSD', 'removeStaticDist')
.describe('RSD', 'Use this flag to remove the Scully outfolder before starting').argv;

export const {argv: options} = yargs.option('port', {
alias: 'p',
type: 'number',
description: 'The port to run on',
});
7 changes: 7 additions & 0 deletions scully/utils/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {performance, PerformanceObserver, PerformanceObserverCallback} from 'per
import {generateAll} from './defaultAction';
import {log, yellow} from './log';
import {performanceIds} from './performanceIds';
import {watch} from './cli-options';
import {scullyConfig} from './config';

/**
* Starts the entire process
Expand Down Expand Up @@ -49,6 +51,11 @@ Generating took ${yellow(Math.floor(seconds * 100) / 100)} seconds for ${yellow(
Pulling in route-data took ${logSeconds(durations.Discovery)}
Rendering the pages took ${logSeconds(durations.Render)}

${
watch
? `The server is available on "${yellow(`http://${scullyConfig.hostName}:${scullyConfig.staticport}/`)}"`
: ''
}
`);
});
};
Expand Down
6 changes: 5 additions & 1 deletion scully/utils/staticServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export async function staticServer(port?: number) {
scullyServer.get('/', (req, res) => res.sendFile(join(distFolder, '/index.html')));

scullyServerInstance = scullyServer.listen(port, scullyConfig.hostName, x => {
log(`Scully static server started on "${yellow(`http://${scullyConfig.hostName}:${port}/`)}" `);
log(
`Scully static server started on "${yellow(
`http://${scullyConfig.hostName}:${scullyConfig.staticport}/`
)}"`
);
});

const angularDistServer = express();
Expand Down