fix(@angular/cli): add more description

This commit is contained in:
Hans Larsen 2017-02-22 17:20:17 -08:00
parent 7ebe4f0d4e
commit b4594bac33
No known key found for this signature in database
GPG Key ID: 537DD9CDA3032687
10 changed files with 249 additions and 146 deletions

View File

@ -24,78 +24,81 @@ export const baseBuildCommandOptions: any = [
description: 'Defines the build environment.' description: 'Defines the build environment.'
}, },
{ {
name: 'output-path', name: 'output-path',
type: 'Path', type: 'Path',
aliases: ['op'], aliases: ['op'],
description: 'Path where output will be placed.' description: 'Path where output will be placed.'
}, },
{ {
name: 'aot', name: 'aot',
type: Boolean, type: Boolean,
description: 'Build using Ahead of Time compilation.' description: 'Build using Ahead of Time compilation.'
}, },
{ {
name: 'sourcemap', name: 'sourcemap',
type: Boolean, type: Boolean,
aliases: ['sm', 'sourcemaps'], aliases: ['sm', 'sourcemaps'],
description: 'Output sourcemaps.' description: 'Output sourcemaps.'
}, },
{ {
name: 'vendor-chunk', name: 'vendor-chunk',
type: Boolean, type: Boolean,
default: true, default: true,
aliases: ['vc'], aliases: ['vc'],
description: 'Use a separate bundle containing only vendor libraries.' description: 'Use a separate bundle containing only vendor libraries.'
}, },
{ {
name: 'base-href', name: 'base-href',
type: String, type: String,
aliases: ['bh'], aliases: ['bh'],
description: 'Base url for the application being built.' description: 'Base url for the application being built.'
}, },
{ {
name: 'deploy-url', name: 'deploy-url',
type: String, type: String,
aliases: ['d'], aliases: ['d'],
description: 'URL where files will be deployed.' description: 'URL where files will be deployed.'
}, },
{ {
name: 'verbose', name: 'verbose',
type: Boolean, type: Boolean,
default: false, default: false,
aliases: ['v'], aliases: ['v'],
description: 'Adds more details to output logging.' description: 'Adds more details to output logging.'
}, },
{ {
name: 'progress', name: 'progress',
type: Boolean, type: Boolean,
default: true, default: true,
aliases: ['pr'], aliases: ['pr'],
description: 'Log progress to the console while building.' description: 'Log progress to the console while building.'
}, },
{ {
name: 'i18n-file', name: 'i18n-file',
type: String type: String,
description: 'Localization file to use for i18n.'
}, },
{ {
name: 'i18n-format', name: 'i18n-format',
type: String type: String,
description: 'Format of the localization file specified with --i18n-file.'
}, },
{ {
name: 'locale', name: 'locale',
type: String type: String,
description: 'Locale to use for i18n.'
}, },
{ {
name: 'extract-css', name: 'extract-css',
type: Boolean, type: Boolean,
aliases: ['ec'], aliases: ['ec'],
description: 'Extract css from global styles onto css files instead of js ones.' description: 'Extract css from global styles onto css files instead of js ones.'
}, },
{ {
name: 'watch', name: 'watch',
type: Boolean, default: false, type: Boolean, default: false,
aliases: ['w'], aliases: ['w'],
description: 'Run build when files change.' description: 'Run build when files change.'
}, },
{ {
name: 'output-hashing', name: 'output-hashing',

View File

@ -36,7 +36,7 @@ export interface CompletionCommandOptions {
all?: boolean; all?: boolean;
bash?: boolean; bash?: boolean;
zsh?: boolean; zsh?: boolean;
}; }
const commandsToIgnore = [ const commandsToIgnore = [
'destroy', 'destroy',
@ -51,9 +51,27 @@ const CompletionCommand = Command.extend({
description: 'Adds autocomplete functionality to `ng` commands and subcommands.', description: 'Adds autocomplete functionality to `ng` commands and subcommands.',
works: 'everywhere', works: 'everywhere',
availableOptions: [ availableOptions: [
{ name: 'all', type: Boolean, default: true, aliases: ['a'] }, {
{ name: 'bash', type: Boolean, default: false, aliases: ['b'] }, name: 'all',
{ name: 'zsh', type: Boolean, default: false, aliases: ['z'] } type: Boolean,
default: true,
aliases: ['a'],
description: 'Generate a completion script compatible with both bash and zsh.'
},
{
name: 'bash',
type: Boolean,
default: false,
aliases: ['b']
description: 'Generate a completion script for bash.'
},
{
name: 'zsh',
type: Boolean,
default: false,
aliases: ['z']
description: 'Generate a completion script for zsh.'
}
], ],
run: function (commandOptions: CompletionCommandOptions) { run: function (commandOptions: CompletionCommandOptions) {

View File

@ -21,54 +21,63 @@ const E2eCommand = Command.extend({
aliases: ['e'], aliases: ['e'],
description: 'Run e2e tests in existing project.', description: 'Run e2e tests in existing project.',
works: 'insideProject', works: 'insideProject',
availableOptions: overrideOptions( availableOptions: overrideOptions([
baseServeCommandOptions.concat([ ...baseServeCommandOptions,
{ {
name: 'config', name: 'config',
type: String, type: String,
aliases: ['c'], aliases: ['c'],
description: oneLine`Use a specific config file. description: oneLine`
Defaults to the protractor config file in angular-cli.json.` Use a specific config file.
}, Defaults to the protractor config file in angular-cli.json.
{ `
name: 'specs', },
type: Array, {
default: [], name: 'specs',
aliases: ['sp'], type: Array,
description: oneLine`Override specs in the protractor config. default: [],
Can send in multiple specs by repeating flag (ng e2e --specs=spec1.ts --specs=spec2.ts).` aliases: ['sp'],
}, description: oneLine`
{ Override specs in the protractor config.
name: 'element-explorer', Can send in multiple specs by repeating flag (ng e2e --specs=spec1.ts --specs=spec2.ts).
type: Boolean, `
default: false, },
aliases: ['ee'], {
description: 'Start Protractor\'s Element Explorer for debugging.' name: 'element-explorer',
}, type: Boolean,
{ default: false,
name: 'webdriver-update', aliases: ['ee'],
type: Boolean, description: 'Start Protractor\'s Element Explorer for debugging.'
default: true, },
aliases: ['wu'], {
description: 'Try to update webdriver.' name: 'webdriver-update',
}, type: Boolean,
{ default: true,
name: 'serve', aliases: ['wu'],
type: Boolean, description: 'Try to update webdriver.'
default: true, },
aliases: ['s'], {
description: oneLine`Compile and Serve the app. name: 'serve',
All non-reload related serve options are also available (e.g. --port=4400).` type: Boolean,
} default: true,
]), [ aliases: ['s'],
{ name: 'port', default: 0 }, description: oneLine`
{ Compile and Serve the app.
name: 'watch', All non-reload related serve options are also available (e.g. --port=4400).
default: false, `
description: 'Run build when files change.' }
}, ], [
] {
), name: 'port',
default: 0,
description: 'The port to use to serve the application.'
},
{
name: 'watch',
default: false,
description: 'Run build when files change.'
},
]),
run: function (commandOptions: E2eTaskOptions) { run: function (commandOptions: E2eTaskOptions) {
const E2eTask = require('../tasks/e2e').E2eTask; const E2eTask = require('../tasks/e2e').E2eTask;
this.project.ngConfig = this.project.ngConfig || CliConfig.fromProject(); this.project.ngConfig = this.project.ngConfig || CliConfig.fromProject();

View File

@ -6,7 +6,11 @@ const Command = require('../ember-cli/lib/models/command');
// defaults for BuildOptions // defaults for BuildOptions
export const baseEjectCommandOptions: any = [ export const baseEjectCommandOptions: any = [
...baseBuildCommandOptions, ...baseBuildCommandOptions,
{ name: 'force', 'type': Boolean }, {
name: 'force',
type: Boolean,
description: 'Overwrite any webpack.config.js and npm scripts already existing.'
},
{ {
name: 'app', name: 'app',
type: String, type: String,

View File

@ -15,7 +15,12 @@ const GetCommand = Command.extend({
works: 'everywhere', works: 'everywhere',
availableOptions: [ availableOptions: [
{ name: 'global', type: Boolean, 'default': false } {
name: 'global',
type: Boolean,
'default': false,
description: 'Get the value in the global configuration (in your home directory).'
}
], ],
run: function (commandOptions: GetOptions, rawArgs: string[]): Promise<void> { run: function (commandOptions: GetOptions, rawArgs: string[]): Promise<void> {

View File

@ -1,5 +1,8 @@
import {oneLine} from 'common-tags';
const Command = require('../ember-cli/lib/models/command'); const Command = require('../ember-cli/lib/models/command');
export interface LintCommandOptions { export interface LintCommandOptions {
fix?: boolean; fix?: boolean;
format?: string; format?: string;
@ -12,9 +15,27 @@ export default Command.extend({
description: 'Lints code in existing project.', description: 'Lints code in existing project.',
works: 'insideProject', works: 'insideProject',
availableOptions: [ availableOptions: [
{ name: 'fix', type: Boolean, default: false }, {
{ name: 'force', type: Boolean, default: false }, name: 'fix',
{ name: 'format', alias: 't', type: String, default: 'prose' } type: Boolean,
default: false,
description: 'Fixes linting errors (may overwrite linted files).'
},
{
name: 'force',
type: Boolean,
default: false,
description: 'Succeeds even if there was linting errors.'
},
{
name: 'format',
alias: 't',
type: String,
default: 'prose',
description: oneLine`
Output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist).
`
}
], ],
run: function (commandOptions: LintCommandOptions) { run: function (commandOptions: LintCommandOptions) {
const LintTask = require('../tasks/lint').default; const LintTask = require('../tasks/lint').default;

View File

@ -71,7 +71,8 @@ const NewCommand = Command.extend({
name: 'skip-commit', name: 'skip-commit',
type: Boolean, type: Boolean,
default: false, default: false,
aliases: ['sc'] aliases: ['sc'],
description: 'Skip committing the first commit to git.'
}, },
{ {
name: 'directory', name: 'directory',

View File

@ -29,43 +29,78 @@ export interface ServeTaskOptions extends BuildOptions {
} }
// Expose options unrelated to live-reload to other commands that need to run serve // Expose options unrelated to live-reload to other commands that need to run serve
export const baseServeCommandOptions: any = overrideOptions( export const baseServeCommandOptions: any = overrideOptions([
baseBuildCommandOptions.concat([ ...baseBuildCommandOptions,
{ name: 'port', type: Number, default: defaultPort, aliases: ['p'] }, {
{ name: 'port',
name: 'host', type: Number,
type: String, default: defaultPort,
default: defaultHost, aliases: ['p'],
aliases: ['H'], description: 'Port to listen to for serving.'
description: `Listens only on ${defaultHost} by default.` },
}, {
{ name: 'proxy-config', type: 'Path', aliases: ['pc'] }, name: 'host',
{ name: 'ssl', type: Boolean, default: defaultSsl }, type: String,
{ name: 'ssl-key', type: String, default: defaultSslKey }, default: defaultHost,
{ name: 'ssl-cert', type: String, default: defaultSslCert }, aliases: ['H'],
{ description: `Listens only on ${defaultHost} by default.`
name: 'open', },
type: Boolean, {
default: false, name: 'proxy-config',
aliases: ['o'], type: 'Path',
description: 'Opens the url in default browser.', aliases: ['pc'],
}, description: 'Proxy configuration file.'
{ name: 'live-reload', type: Boolean, default: true, aliases: ['lr'] }, },
{ {
name: 'live-reload-client', name: 'ssl',
type: String, type: Boolean,
description: 'Specify the URL that the live reload browser client will use.' default: defaultSsl,
}, description: 'Serve using HTTPS.'
{ },
name: 'hmr', {
type: Boolean, name: 'ssl-key',
default: false, type: String,
description: 'Enable hot module replacement.', default: defaultSslKey,
} description: 'SSL key to use for serving HTTPS.'
]), [ },
{ name: 'watch', default: true } {
] name: 'ssl-cert',
); type: String,
default: defaultSslCert,
description: 'SSL certificate to use for serving HTTPS.'
},
{
name: 'open',
type: Boolean,
default: false,
aliases: ['o'],
description: 'Opens the url in default browser.',
},
{
name: 'live-reload',
type: Boolean,
default: true,
aliases: ['lr'],
description: 'Whether to reload the page on change, using live-reload.'
},
{
name: 'live-reload-client',
type: String,
description: 'Specify the URL that the live reload browser client will use.'
},
{
name: 'hmr',
type: Boolean,
default: false,
description: 'Enable hot module replacement.',
}
], [
{
name: 'watch',
default: true,
description: 'Rebuild on change.'
}
]);
const ServeCommand = Command.extend({ const ServeCommand = Command.extend({
name: 'serve', name: 'serve',

View File

@ -1,4 +1,4 @@
import {CliConfig} from '../models/config'; \import {CliConfig} from '../models/config';
const SilentError = require('silent-error'); const SilentError = require('silent-error');
const Command = require('../ember-cli/lib/models/command'); const Command = require('../ember-cli/lib/models/command');
@ -15,7 +15,13 @@ const SetCommand = Command.extend({
works: 'everywhere', works: 'everywhere',
availableOptions: [ availableOptions: [
{ name: 'global', type: Boolean, 'default': false, aliases: ['g'] }, {
name: 'global',
type: Boolean,
'default': false,
aliases: ['g'],
description: 'Set the value in the global configuration rather than in your project\'s.'
},
], ],
asBoolean: function (raw: string): boolean { asBoolean: function (raw: string): boolean {

View File

@ -15,7 +15,8 @@ const Xi18nCommand = Command.extend({
name: 'i18n-format', name: 'i18n-format',
type: String, type: String,
default: 'xlf', default: 'xlf',
aliases: ['f', {'xmb': 'xmb'}, {'xlf': 'xlf'}, {'xliff': 'xlf'}] aliases: ['f', {'xmb': 'xmb'}, {'xlf': 'xlf'}, {'xliff': 'xlf'}],
description: 'Output format for the generated file.'
}, },
{ {
name: 'output-path', name: 'output-path',