From 6f0738fba49759d49af4856b0df1f150ed07781c Mon Sep 17 00:00:00 2001 From: Jorge Cano Date: Fri, 10 Jul 2020 01:04:06 -0300 Subject: [PATCH] fix(CLI-OPTIONS): fix --help (#728) --- libs/scully-schematics/package-lock.json | 2 +- libs/scully-schematics/package.json | 2 +- libs/scully/src/lib/utils/cli-options.ts | 206 ++++++++++++----------- 3 files changed, 109 insertions(+), 101 deletions(-) diff --git a/libs/scully-schematics/package-lock.json b/libs/scully-schematics/package-lock.json index 4c70605d6..9d494ba33 100644 --- a/libs/scully-schematics/package-lock.json +++ b/libs/scully-schematics/package-lock.json @@ -1,6 +1,6 @@ { "name": "@scullyio/init", - "version": "0.0.27", + "version": "0.0.29", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/libs/scully-schematics/package.json b/libs/scully-schematics/package.json index e0417863a..a9e912dbb 100644 --- a/libs/scully-schematics/package.json +++ b/libs/scully-schematics/package.json @@ -1,6 +1,6 @@ { "name": "@scullyio/init", - "version": "0.0.28", + "version": "0.0.29", "description": "Add scully to your angular app", "repository": { "type": "GIT", diff --git a/libs/scully/src/lib/utils/cli-options.ts b/libs/scully/src/lib/utils/cli-options.ts index 2476a13eb..267e72685 100644 --- a/libs/scully/src/lib/utils/cli-options.ts +++ b/libs/scully/src/lib/utils/cli-options.ts @@ -1,6 +1,8 @@ -import * as yargs from 'yargs'; +import yargs from 'yargs'; export const { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore watch, removeStaticDist, openNavigator, @@ -10,8 +12,25 @@ export const { tds, proxyConfigFile, hostName, + showBrowser, + path, + port, + folder, + sge, + configFileName, + project, + baseFilter, + routeFilter, + scanRoutes, + pjFirst, + serverTimeout, + pluginsError, + handle404, + prod, } = /** return the argv */ + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore yargs /** watch mode */ .boolean('w') @@ -59,107 +78,96 @@ export const { .string('hostName') .default('hostName', undefined) .alias('host', 'hostName') - .describe('host', 'Add hostname for scully').argv; + .describe('host', 'Add hostname for scully') -/** break up, bcs the linter doesn't like those long lists */ -export const { showBrowser, path, port, folder, sge } = yargs + /** path */ + .string('path') + .default('path', undefined) + .alias('p', 'path') + .describe('path', 'The path to generate') + /** port */ + .number('port') + .default('port', undefined) + .alias('p', 'port') + .describe('port', 'The port to run on') + /** showBrowser */ + .boolean('sb') + .alias('sb', 'showBrowser') + .describe('sb', 'Shows the puppeteer controlled browser') + /** folder */ + .string('folder') + .default('folder', undefined) + .describe('folder', 'folder') + /** showGuessErrors */ + .boolean('sge') + .alias('sge', 'showGuessError') + .describe('sb', 'dumps the error from guess to the console') - /** path */ - .string('path') - .default('path', undefined) - .alias('p', 'path') - .describe('path', 'The path to generate') - /** port */ - .number('port') - .default('port', undefined) - .alias('p', 'port') - .describe('port', 'The port to run on') - /** showBrowser */ - .boolean('sb') - .alias('sb', 'showBrowser') - .describe('sb', 'Shows the puppeteer controlled browser') - /** folder */ - .string('folder') - .default('folder', undefined) - .describe('folder', 'folder') - /** showGuessErrors */ - .boolean('sge') - .alias('sge', 'showGuessError') - .describe('sb', 'dumps the error from guess to the console').argv; - -export const { - configFileName, - project, - baseFilter, - routeFilter, - scanRoutes, -} = yargs /** config file */ - .string('cf') - .alias('cf', 'configFile') - .alias('cf', 'configFileName') - .default('cf', '') - .describe( - 'cf', - 'provide name of the config file to use. if the option --project is also there that takes precedence)' - ) - /** projectName */ - .string('pr') - .alias('pr', 'project') - .default('pr', '') - .describe('pr', 'provide name of the project to handle') - /** scanRoutes */ - .boolean('sr') - .default('sr', false) - .alias('sr', 'scanRoutes') - .alias('sr', 'scan') - .describe('sr', 'Scan the app for unhandled routes') - /** baseFilter */ - .string('bf') - .alias('bf', 'baseFilter') - .default('bf', '') - .describe( - 'bf', - 'provide a wildcard string separated by ,(comma) to filter the unhandled routes' - ) - /** filter */ - .string('routeFilter') - .alias('routeFilter', 'rf') - .default('routeFilter', '') - .describe( - 'routeFilter', - 'provide a wildcard string separated by ,(comma) to filter the handled routes' - ).argv; + .string('cf') + .alias('cf', 'configFile') + .alias('cf', 'configFileName') + .default('cf', '') + .describe( + 'cf', + 'provide name of the config file to use. if the option --project is also there that takes precedence)' + ) + /** projectName */ + .string('pr') + .alias('pr', 'project') + .default('pr', '') + .describe('pr', 'provide name of the project to handle') + /** scanRoutes */ + .boolean('sr') + .default('sr', false) + .alias('sr', 'scanRoutes') + .alias('sr', 'scan') + .describe('sr', 'Scan the app for unhandled routes') + /** baseFilter */ + .string('bf') + .alias('bf', 'baseFilter') + .default('bf', '') + .describe( + 'bf', + 'provide a wildcard string separated by ,(comma) to filter the unhandled routes' + ) + /** filter */ + .string('routeFilter') + .alias('routeFilter', 'rf') + .default('routeFilter', '') + .describe( + 'routeFilter', + 'provide a wildcard string separated by ,(comma) to filter the handled routes' + ) -export const { pjFirst, serverTimeout, pluginsError, handle404, prod } = yargs - /** server Timout */ - .number('st') - .default('st', 0) - .alias('st', 'serverTimeout') - .describe( - 'st', - 'The time Scully will wait for the server before timeout. in milliseconds' - ) - /** 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') - /** handle 404 in server */ - .string('handle404') - .alias('handle404', '404') - .default('handle404', '') - .describe('handle404', 'determine how 404 is handled') - /** Exit Scully with plugin error */ - .boolean('pe') - .alias('pe', 'pluginsError') - .default('pe', true) - .describe('pe', "Exit scully's run when exist an error in a plugin") - /** Use Prod Mode */ - .boolean('prod') - .alias('prod', 'Production') - .default('prod', false) - .describe('prod', 'Use prod mode for Scully').argv; + /** server Timout */ + .number('st') + .default('st', 0) + .alias('st', 'serverTimeout') + .describe( + 'st', + 'The time Scully will wait for the server before timeout. in milliseconds' + ) + /** 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') + /** handle 404 in server */ + .string('handle404') + .alias('handle404', '404') + .default('handle404', '') + .describe('handle404', 'determine how 404 is handled') + /** Exit Scully with plugin error */ + .boolean('pe') + .alias('pe', 'pluginsError') + .default('pe', true) + .describe('pe', "Exit scully's run when exist an error in a plugin") + /** Use Prod Mode */ + .boolean('prod') + .alias('prod', 'Production') + .default('prod', false) + .describe('prod', 'Use prod mode for Scully').argv; yargs.help();