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
23 changes: 10 additions & 13 deletions scully/utils/cli-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,7 @@ export const {watch, removeStaticDist, openNavigator, ssl, sslCert, sslKey, tds,
.describe('host', 'Add hostname for scully').argv;

/** break up, bcs the linter doesn't like those long lists */
export const {
showBrowser,
path,
port,
folder,
sge,
configFileName,
project,
baseFilter,
scanRoutes,
hl,
} = yargs
export const {showBrowser, path, port, pjFirst, folder, sge, configFileName} = yargs
/** path */
.string('path')
.default('path', undefined)
Expand Down Expand Up @@ -91,7 +80,9 @@ export const {
.describe(
'cf',
'provide name of the config file to use. if the option --project is also there that takes precedence)'
)
).argv;

export const {project, baseFilter, scanRoutes, hl} = yargs
/** projectName */
.string('pr')
.alias('pr', 'project')
Expand All @@ -103,6 +94,12 @@ export const {
.alias('sr', 'scanRoutes')
.alias('sr', 'scan')
.describe('sr', 'Scan the app for unhandled routes')
/** package json fist */
.boolean('pjf')
.default('pjf', false)
.alias('pjf', 'pjFirst')
.alias('pjf', 'pj-first')
.describe('pjf', 'Scan for package.json first instead of angular.json')
/** baseFilter */
.string('bf')
.alias('bf', 'baseFilter')
Expand Down
1 change: 1 addition & 0 deletions scully/utils/compileConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const compileConfig = async (): Promise<ScullyConfig> => {
The config file should have a name that is formated as:
scully.${yellow('<projectName>')}.config.js
where ${yellow('<projectName>')} is the name of the project as defined in the 'angular.json' file
When you are in a mixed mono-repo you might need to use the --pjFirst flag.
---------
`);
return ({projectName: project || defaFaultProjectName} as unknown) as ScullyConfig;
Expand Down
12 changes: 9 additions & 3 deletions scully/utils/findAngularJsonPath.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import {resolve} from 'path';
import {existsSync, statSync} from 'fs';
import {resolve} from 'path';
import {pjFirst} from './cli-options';

const pjf = !!pjFirst;
let startPath: string;
export function findAngularJsonPath(path?: string, usePackageJson = false): string {
export function findAngularJsonPath(path?: string, usePackageJson = pjf): string {
if (!path) {
path = process.cwd();
}
Expand All @@ -14,9 +17,12 @@ export function findAngularJsonPath(path?: string, usePackageJson = false): stri
}
const parent = resolve(path, '..');
if (parent === path) {
if (!usePackageJson) {
if (!pjf && !usePackageJson) {
return findAngularJsonPath(startPath, true);
}
if (pjf) {
return findAngularJsonPath(startPath, false);
}
return null;
}
return findAngularJsonPath(parent, usePackageJson);
Expand Down