From 7ebe4f0d4e0c3d5c8b4a2bbf4b543b021f66f08a Mon Sep 17 00:00:00 2001 From: Sumit Arora Date: Tue, 21 Feb 2017 14:11:20 -0500 Subject: [PATCH] fix(@angular/cli): adding help descriptions --- .../@angular/cli/blueprints/guard/index.ts | 19 ++- packages/@angular/cli/commands/build.ts | 112 ++++++++++++++--- packages/@angular/cli/commands/completion.ts | 2 +- packages/@angular/cli/commands/e2e.ts | 51 ++++++-- packages/@angular/cli/commands/help.ts | 2 +- packages/@angular/cli/commands/lint.ts | 2 +- packages/@angular/cli/commands/new.ts | 115 +++++++++++++++--- packages/@angular/cli/commands/serve.ts | 8 +- packages/@angular/cli/commands/test.ts | 87 +++++++++++-- packages/@angular/cli/commands/version.ts | 6 +- packages/@angular/cli/commands/xi18n.ts | 23 +++- .../cli/ember-cli/lib/commands/generate.js | 15 ++- 12 files changed, 370 insertions(+), 72 deletions(-) diff --git a/packages/@angular/cli/blueprints/guard/index.ts b/packages/@angular/cli/blueprints/guard/index.ts index 134babf78be5..7091fe277b40 100644 --- a/packages/@angular/cli/blueprints/guard/index.ts +++ b/packages/@angular/cli/blueprints/guard/index.ts @@ -15,9 +15,22 @@ export default Blueprint.extend({ description: '', availableOptions: [ - { name: 'flat', type: Boolean }, - { name: 'spec', type: Boolean }, - { name: 'module', type: String, aliases: ['m'] } + { + name: 'flat', + type: Boolean, + description: 'Indicate if a dir is created.' + }, + { + name: 'spec', + type: Boolean, + description: 'Specifies if a spec file is generated.' + }, + { + name: 'module', + type: String, + aliases: ['m'], + description: 'Allows specification of the declaring module.' + } ], beforeInstall: function(options: any) { diff --git a/packages/@angular/cli/commands/build.ts b/packages/@angular/cli/commands/build.ts index a2e4b72e2739..f204f03aad4d 100644 --- a/packages/@angular/cli/commands/build.ts +++ b/packages/@angular/cli/commands/build.ts @@ -1,6 +1,7 @@ import { CliConfig } from '../models/config'; import { BuildOptions } from '../models/build-options'; import { Version } from '../upgrade/version'; +import { oneLine } from 'common-tags'; const Command = require('../ember-cli/lib/models/command'); @@ -13,34 +14,101 @@ export const baseBuildCommandOptions: any = [ name: 'target', type: String, default: 'development', - aliases: ['t', { 'dev': 'development' }, { 'prod': 'production' }] - }, - { name: 'environment', type: String, aliases: ['e'] }, - { name: 'output-path', type: 'Path', aliases: ['op'] }, - { name: 'aot', type: Boolean }, - { name: 'sourcemap', type: Boolean, aliases: ['sm', 'sourcemaps'] }, - { name: 'vendor-chunk', type: Boolean, default: true, aliases: ['vc'] }, - { name: 'base-href', type: String, aliases: ['bh'] }, - { name: 'deploy-url', type: String, aliases: ['d'] }, - { name: 'verbose', type: Boolean, default: false, aliases: ['v'] }, - { name: 'progress', type: Boolean, default: true, aliases: ['pr'] }, - { name: 'i18n-file', type: String }, - { name: 'i18n-format', type: String }, - { name: 'locale', type: String }, - { name: 'extract-css', type: Boolean, aliases: ['ec'] }, - { name: 'watch', type: Boolean, default: false, aliases: ['w'] }, + aliases: ['t', { 'dev': 'development' }, { 'prod': 'production' }], + description: 'Defines the build target.' + }, + { + name: 'environment', + type: String, + aliases: ['e'] , + description: 'Defines the build environment.' + }, + { + name: 'output-path', + type: 'Path', + aliases: ['op'], + description: 'Path where output will be placed.' + }, + { + name: 'aot', + type: Boolean, + description: 'Build using Ahead of Time compilation.' + }, + { + name: 'sourcemap', + type: Boolean, + aliases: ['sm', 'sourcemaps'], + description: 'Output sourcemaps.' + }, + { + name: 'vendor-chunk', + type: Boolean, + default: true, + aliases: ['vc'], + description: 'Use a separate bundle containing only vendor libraries.' + }, + { + name: 'base-href', + type: String, + aliases: ['bh'], + description: 'Base url for the application being built.' + }, + { + name: 'deploy-url', + type: String, + aliases: ['d'], + description: 'URL where files will be deployed.' + }, + { + name: 'verbose', + type: Boolean, + default: false, + aliases: ['v'], + description: 'Adds more details to output logging.' + }, + { + name: 'progress', + type: Boolean, + default: true, + aliases: ['pr'], + description: 'Log progress to the console while building.' + }, + { + name: 'i18n-file', + type: String + }, + { + name: 'i18n-format', + type: String + }, + { + name: 'locale', + type: String + }, + { + name: 'extract-css', + type: Boolean, + aliases: ['ec'], + description: 'Extract css from global styles onto css files instead of js ones.' + }, + { + name: 'watch', + type: Boolean, default: false, + aliases: ['w'], + description: 'Run build when files change.' + }, { name: 'output-hashing', type: String, values: ['none', 'all', 'media', 'bundles'], - description: 'define the output filename cache-busting hashing mode', + description: 'Define the output filename cache-busting hashing mode.', aliases: ['oh'] }, { name: 'poll', type: Number, default: pollDefault, - description: 'enable and define the file watching poll time period (milliseconds)' + description: 'Enable and define the file watching poll time period (milliseconds).' }, { name: 'app', @@ -60,7 +128,13 @@ const BuildCommand = Command.extend({ aliases: ['b'], availableOptions: baseBuildCommandOptions.concat([ - { name: 'stats-json', type: Boolean, default: false } + { + name: 'stats-json', + type: Boolean, + default: false, + description: oneLine`Generates a \`stats.json\` file which can be analyzed using tools + such as: \`webpack-bundle-analyzer\` or https://webpack.github.io/analyse.` + } ]), run: function (commandOptions: BuildTaskOptions) { diff --git a/packages/@angular/cli/commands/completion.ts b/packages/@angular/cli/commands/completion.ts index d7aa2471c8b4..891fd4cb9e39 100644 --- a/packages/@angular/cli/commands/completion.ts +++ b/packages/@angular/cli/commands/completion.ts @@ -48,7 +48,7 @@ const optsNg: string[] = []; const CompletionCommand = Command.extend({ name: 'completion', - description: 'Adds autocomplete functionality to `ng` commands and subcommands', + description: 'Adds autocomplete functionality to `ng` commands and subcommands.', works: 'everywhere', availableOptions: [ { name: 'all', type: Boolean, default: true, aliases: ['a'] }, diff --git a/packages/@angular/cli/commands/e2e.ts b/packages/@angular/cli/commands/e2e.ts index cc69ce9ff081..a40ce1a163ff 100644 --- a/packages/@angular/cli/commands/e2e.ts +++ b/packages/@angular/cli/commands/e2e.ts @@ -4,6 +4,7 @@ import { overrideOptions } from '../utilities/override-options'; import { CliConfig } from '../models/config'; import { ServeTaskOptions, baseServeCommandOptions } from './serve'; import { checkPort } from '../utilities/check-port'; +import { oneLine } from 'common-tags'; const Command = require('../ember-cli/lib/models/command'); @@ -18,18 +19,54 @@ export interface E2eTaskOptions extends ServeTaskOptions { const E2eCommand = Command.extend({ name: 'e2e', aliases: ['e'], - description: 'Run e2e tests in existing project', + description: 'Run e2e tests in existing project.', works: 'insideProject', availableOptions: overrideOptions( baseServeCommandOptions.concat([ - { name: 'config', type: String, aliases: ['c'] }, - { name: 'specs', type: Array, default: [], aliases: ['sp'] }, - { name: 'element-explorer', type: Boolean, default: false, aliases: ['ee'] }, - { name: 'webdriver-update', type: Boolean, default: true, aliases: ['wu'] }, - { name: 'serve', type: Boolean, default: true, aliases: ['s'] } + { + name: 'config', + type: String, + aliases: ['c'], + description: oneLine`Use a specific config file. + Defaults to the protractor config file in angular-cli.json.` + }, + { + name: 'specs', + type: Array, + default: [], + aliases: ['sp'], + description: oneLine`Override specs in the protractor config. + Can send in multiple specs by repeating flag (ng e2e --specs=spec1.ts --specs=spec2.ts).` + }, + { + name: 'element-explorer', + type: Boolean, + default: false, + aliases: ['ee'], + description: 'Start Protractor\'s Element Explorer for debugging.' + }, + { + name: 'webdriver-update', + type: Boolean, + default: true, + aliases: ['wu'], + description: 'Try to update webdriver.' + }, + { + name: 'serve', + type: Boolean, + default: true, + aliases: ['s'], + description: oneLine`Compile and Serve the app. + All non-reload related serve options are also available (e.g. --port=4400).` + } ]), [ { name: 'port', default: 0 }, - { name: 'watch', default: false }, + { + name: 'watch', + default: false, + description: 'Run build when files change.' + }, ] ), run: function (commandOptions: E2eTaskOptions) { diff --git a/packages/@angular/cli/commands/help.ts b/packages/@angular/cli/commands/help.ts index 2e47d7921428..5b32f7c21636 100644 --- a/packages/@angular/cli/commands/help.ts +++ b/packages/@angular/cli/commands/help.ts @@ -13,7 +13,7 @@ const commandsToIgnore = [ const HelpCommand = Command.extend({ name: 'help', - description: 'Shows help for the CLI', + description: 'Shows help for the CLI.', works: 'everywhere', availableOptions: [], diff --git a/packages/@angular/cli/commands/lint.ts b/packages/@angular/cli/commands/lint.ts index e8bc20a05fa3..db7b44c378a6 100644 --- a/packages/@angular/cli/commands/lint.ts +++ b/packages/@angular/cli/commands/lint.ts @@ -9,7 +9,7 @@ export interface LintCommandOptions { export default Command.extend({ name: 'lint', aliases: ['l'], - description: 'Lints code in existing project', + description: 'Lints code in existing project.', works: 'insideProject', availableOptions: [ { name: 'fix', type: Boolean, default: false }, diff --git a/packages/@angular/cli/commands/new.ts b/packages/@angular/cli/commands/new.ts index c4696011162b..1cafc8952566 100644 --- a/packages/@angular/cli/commands/new.ts +++ b/packages/@angular/cli/commands/new.ts @@ -19,21 +19,106 @@ const NewCommand = Command.extend({ works: 'outsideProject', availableOptions: [ - { name: 'dry-run', type: Boolean, default: false, aliases: ['d'] }, - { name: 'verbose', type: Boolean, default: false, aliases: ['v'] }, - { name: 'link-cli', type: Boolean, default: false, aliases: ['lc'] }, - { name: 'ng4', type: Boolean, default: false }, - { name: 'skip-install', type: Boolean, default: false, aliases: ['si'] }, - { name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] }, - { name: 'skip-tests', type: Boolean, default: false, aliases: ['st'] }, - { name: 'skip-commit', type: Boolean, default: false, aliases: ['sc'] }, - { name: 'directory', type: String, aliases: ['dir'] }, - { name: 'source-dir', type: String, default: 'src', aliases: ['sd'] }, - { name: 'style', type: String, default: 'css' }, - { name: 'prefix', type: String, default: 'app', aliases: ['p'] }, - { name: 'routing', type: Boolean, default: false }, - { name: 'inline-style', type: Boolean, default: false, aliases: ['is'] }, - { name: 'inline-template', type: Boolean, default: false, aliases: ['it'] } + { + name: 'dry-run', + type: Boolean, + default: false, + aliases: ['d'], + description: 'Run through without making any changes.' + }, + { + name: 'verbose', + type: Boolean, + default: false, + aliases: ['v'], + description: 'Adds more details to output logging.' + }, + { + name: 'link-cli', + type: Boolean, + default: false, + aliases: ['lc'], + description: 'Automatically link the `@angular/cli` package.' + }, + { + name: 'ng4', + type: Boolean, + default: false, + description: 'Create a project with Angular 4 in the template.' + }, + { + name: 'skip-install', + type: Boolean, + default: false, + aliases: ['si'], + description: 'Skip installing packages.' + }, + { + name: 'skip-git', + type: Boolean, + default: false, + aliases: ['sg'], + description: 'Skip initializing a git repository.' + }, + { + name: 'skip-tests', + type: Boolean, + default: false, + aliases: ['st'], + description: 'Skip creating spec files.' + }, + { + name: 'skip-commit', + type: Boolean, + default: false, + aliases: ['sc'] + }, + { + name: 'directory', + type: String, + aliases: ['dir'], + description: 'The directory name to create the app in.' + }, + { + name: 'source-dir', + type: String, + default: 'src', + aliases: ['sd'], + description: 'The name of the source directory.' + }, + { + name: 'style', + type: String, + default: 'css', + description: 'The style file default extension.' + }, + { + name: 'prefix', + type: String, + default: 'app', + aliases: ['p'], + description: 'The prefix to use for all component selectors.' + }, + { + name: 'routing', + type: Boolean, + default: false, + description: 'Generate a routing module.' + }, + { + name: 'inline-style', + type: Boolean, + default: false, + aliases: ['is'], + description: 'Should have an inline style.' + }, + { + name: 'inline-template', + type: Boolean, + default: false, + aliases: ['it'], + description: 'Should have an inline template.' + } ], isProject: function (projectPath: string) { diff --git a/packages/@angular/cli/commands/serve.ts b/packages/@angular/cli/commands/serve.ts index 30ac1690026c..f944d56d8dc3 100644 --- a/packages/@angular/cli/commands/serve.ts +++ b/packages/@angular/cli/commands/serve.ts @@ -37,7 +37,7 @@ export const baseServeCommandOptions: any = overrideOptions( type: String, default: defaultHost, aliases: ['H'], - description: `Listens only on ${defaultHost} by default` + description: `Listens only on ${defaultHost} by default.` }, { name: 'proxy-config', type: 'Path', aliases: ['pc'] }, { name: 'ssl', type: Boolean, default: defaultSsl }, @@ -48,19 +48,19 @@ export const baseServeCommandOptions: any = overrideOptions( type: Boolean, default: false, aliases: ['o'], - description: 'Opens the url in default browser', + description: 'Opens the url in default browser.', }, { name: 'live-reload', type: Boolean, default: true, aliases: ['lr'] }, { name: 'live-reload-client', type: String, - description: 'specify the URL that the live reload browser client will use' + description: 'Specify the URL that the live reload browser client will use.' }, { name: 'hmr', type: Boolean, default: false, - description: 'Enable hot module replacement', + description: 'Enable hot module replacement.', } ]), [ { name: 'watch', default: true } diff --git a/packages/@angular/cli/commands/test.ts b/packages/@angular/cli/commands/test.ts index 9beb3312c85b..08fb1fb358e2 100644 --- a/packages/@angular/cli/commands/test.ts +++ b/packages/@angular/cli/commands/test.ts @@ -1,6 +1,7 @@ const EmberTestCommand = require('../ember-cli/lib/commands/test'); import TestTask from '../tasks/test'; import {CliConfig} from '../models/config'; +import { oneLine } from 'common-tags'; const config = CliConfig.fromProject() || CliConfig.fromGlobal(); const pollDefault = config.config.defaults && config.config.defaults.poll; @@ -25,23 +26,83 @@ export interface TestOptions { const TestCommand = EmberTestCommand.extend({ availableOptions: [ - { name: 'watch', type: Boolean, default: true, aliases: ['w'] }, - { name: 'code-coverage', type: Boolean, default: false, aliases: ['cc'] }, - { name: 'config', type: String, aliases: ['c'] }, - { name: 'single-run', type: Boolean, default: false, aliases: ['sr'] }, - { name: 'progress', type: Boolean, default: true}, - { name: 'browsers', type: String }, - { name: 'colors', type: Boolean }, - { name: 'log-level', type: String }, - { name: 'port', type: Number }, - { name: 'reporters', type: String }, - { name: 'build', type: Boolean, default: true }, - { name: 'sourcemap', type: Boolean, default: true, aliases: ['sm'] }, + { + name: 'watch', + type: Boolean, + default: true, + aliases: ['w'], + description: 'Run build when files change.' + }, + { + name: 'code-coverage', + type: Boolean, + default: false, + aliases: ['cc'], + description: 'Coverage report will be in the coverage/ directory.' + }, + { + name: 'config', + type: String, + aliases: ['c'], + description: oneLine`Use a specific config file. + Defaults to the protractor config file in angular-cli.json.` + }, + { + name: 'single-run', + type: Boolean, + default: false, + aliases: ['sr'], + description: 'Run tests a single time.' + }, + { + name: 'progress', + type: Boolean, + default: true, + description: 'Log progress to the console while in progress.' + }, + { + name: 'browsers', + type: String, + description: 'Override which browsers tests are run against.' + }, + { + name: 'colors', + type: Boolean, + description: 'Enable or disable colors in the output (reporters and logs).' + }, + { + name: 'log-level', + type: String, + description: 'Level of logging.' + }, + { + name: 'port', + type: Number, + description: 'Port where the web server will be listening.' + }, + { + name: 'reporters', + type: String, + description: 'List of reporters to use.' + }, + { + name: 'build', + type: Boolean, + default: true, + description: 'Build prior to running tests.' + }, + { + name: 'sourcemap', + type: Boolean, + default: true, + aliases: ['sm'], + description: 'Output sourcemaps.' + }, { name: 'poll', type: Number, default: pollDefault, - description: 'enable and define the file watching poll time period (milliseconds)' + description: 'Enable and define the file watching poll time period (milliseconds).' }, { name: 'app', diff --git a/packages/@angular/cli/commands/version.ts b/packages/@angular/cli/commands/version.ts index f512a05b1bbc..da6d2f47449b 100644 --- a/packages/@angular/cli/commands/version.ts +++ b/packages/@angular/cli/commands/version.ts @@ -7,13 +7,15 @@ import { CliConfig } from '../models/config'; const VersionCommand = Command.extend({ name: 'version', - description: 'outputs Angular CLI version', + description: 'Outputs Angular CLI version.', aliases: ['v', '--version', '-v'], works: 'everywhere', availableOptions: [{ name: 'verbose', - type: Boolean, 'default': false + type: Boolean, + 'default': false, + description: 'Adds more details to output logging.' }], run: function (options: any) { diff --git a/packages/@angular/cli/commands/xi18n.ts b/packages/@angular/cli/commands/xi18n.ts index 7bce94ca70a8..67ee147bd23a 100644 --- a/packages/@angular/cli/commands/xi18n.ts +++ b/packages/@angular/cli/commands/xi18n.ts @@ -17,16 +17,31 @@ const Xi18nCommand = Command.extend({ default: 'xlf', aliases: ['f', {'xmb': 'xmb'}, {'xlf': 'xlf'}, {'xliff': 'xlf'}] }, - { name: 'output-path', type: 'Path', default: null, aliases: ['op']}, - { name: 'verbose', type: Boolean, default: false}, - { name: 'progress', type: Boolean, default: true }, + { + name: 'output-path', + type: 'Path', + default: null, + aliases: ['op'], + description: 'Path where output will be placed.' + }, + { + name: 'verbose', + type: Boolean, + default: false, + description: 'Adds more details to output logging.' + }, + { + name: 'progress', + type: Boolean, + default: true, + description: 'Log progress to the console while running.' + }, { name: 'app', type: String, aliases: ['a'], description: 'Specifies app name to use.' } - ], run: function (commandOptions: any) { const {Extracti18nTask} = require('../tasks/extract-i18n'); diff --git a/packages/@angular/cli/ember-cli/lib/commands/generate.js b/packages/@angular/cli/ember-cli/lib/commands/generate.js index 48f0db1db2eb..6c43b5424787 100644 --- a/packages/@angular/cli/ember-cli/lib/commands/generate.js +++ b/packages/@angular/cli/ember-cli/lib/commands/generate.js @@ -17,8 +17,19 @@ module.exports = Command.extend({ works: 'insideProject', availableOptions: [ - { name: 'dry-run', type: Boolean, default: false, aliases: ['d'] }, - { name: 'verbose', type: Boolean, default: false, aliases: ['v'] }, + { name: 'dry-run', + type: Boolean, + default: false, + aliases: ['d'], + description: 'Run through without making any changes.' + }, + { + name: 'verbose', + type: Boolean, + default: false, + aliases: ['v'], + description: 'Adds more details to output logging.' + }, { name: 'pod', type: Boolean, default: false, aliases: ['p'] }, { name: 'classic', type: Boolean, default: false, aliases: ['c'] }, { name: 'dummy', type: Boolean, default: false, aliases: ['dum', 'id'] },