Skip to content

Commit

Permalink
fix(@angular/cli): adding help descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
sumitarora committed Feb 22, 2017
1 parent 0d8799e commit 7ebe4f0
Show file tree
Hide file tree
Showing 12 changed files with 370 additions and 72 deletions.
19 changes: 16 additions & 3 deletions packages/@angular/cli/blueprints/guard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
112 changes: 93 additions & 19 deletions packages/@angular/cli/commands/build.ts
Original file line number Diff line number Diff line change
@@ -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');

Expand All @@ -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',
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/@angular/cli/commands/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'] },
Expand Down
51 changes: 44 additions & 7 deletions packages/@angular/cli/commands/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');


Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/@angular/cli/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/@angular/cli/commands/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
115 changes: 100 additions & 15 deletions packages/@angular/cli/commands/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 7ebe4f0

Please sign in to comment.