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.'
},
{
name: 'output-path',
type: 'Path',
aliases: ['op'],
description: 'Path where output will be placed.'
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: 'aot',
type: Boolean,
description: 'Build using Ahead of Time compilation.'
},
{
name: 'sourcemap',
type: Boolean,
aliases: ['sm', 'sourcemaps'],
description: 'Output sourcemaps.'
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: '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: '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: '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: '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: 'progress',
type: Boolean,
default: true,
aliases: ['pr'],
description: 'Log progress to the console while building.'
},
{
name: 'i18n-file',
type: String
name: 'i18n-file',
type: String,
description: 'Localization file to use for i18n.'
},
{
name: 'i18n-format',
type: String
name: 'i18n-format',
type: String,
description: 'Format of the localization file specified with --i18n-file.'
},
{
name: 'locale',
type: String
name: 'locale',
type: String,
description: 'Locale to use for i18n.'
},
{
name: 'extract-css',
type: Boolean,
aliases: ['ec'],
description: 'Extract css from global styles onto css files instead of js ones.'
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: 'watch',
type: Boolean, default: false,
aliases: ['w'],
description: 'Run build when files change.'
},
{
name: 'output-hashing',

View File

@ -36,7 +36,7 @@ export interface CompletionCommandOptions {
all?: boolean;
bash?: boolean;
zsh?: boolean;
};
}
const commandsToIgnore = [
'destroy',
@ -51,9 +51,27 @@ const CompletionCommand = Command.extend({
description: 'Adds autocomplete functionality to `ng` commands and subcommands.',
works: 'everywhere',
availableOptions: [
{ name: 'all', type: Boolean, default: true, aliases: ['a'] },
{ name: 'bash', type: Boolean, default: false, aliases: ['b'] },
{ name: 'zsh', type: Boolean, default: false, aliases: ['z'] }
{
name: 'all',
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) {

View File

@ -21,54 +21,63 @@ const E2eCommand = Command.extend({
aliases: ['e'],
description: 'Run e2e tests in existing project.',
works: 'insideProject',
availableOptions: overrideOptions(
baseServeCommandOptions.concat([
{
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,
description: 'Run build when files change.'
},
]
),
availableOptions: overrideOptions([
...baseServeCommandOptions,
{
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,
description: 'The port to use to serve the application.'
},
{
name: 'watch',
default: false,
description: 'Run build when files change.'
},
]),
run: function (commandOptions: E2eTaskOptions) {
const E2eTask = require('../tasks/e2e').E2eTask;
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
export const baseEjectCommandOptions: any = [
...baseBuildCommandOptions,
{ name: 'force', 'type': Boolean },
{
name: 'force',
type: Boolean,
description: 'Overwrite any webpack.config.js and npm scripts already existing.'
},
{
name: 'app',
type: String,

View File

@ -15,7 +15,12 @@ const GetCommand = Command.extend({
works: 'everywhere',
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> {

View File

@ -1,5 +1,8 @@
import {oneLine} from 'common-tags';
const Command = require('../ember-cli/lib/models/command');
export interface LintCommandOptions {
fix?: boolean;
format?: string;
@ -12,9 +15,27 @@ export default Command.extend({
description: 'Lints code in existing project.',
works: 'insideProject',
availableOptions: [
{ name: 'fix', type: Boolean, default: false },
{ name: 'force', type: Boolean, default: false },
{ name: 'format', alias: 't', type: String, default: 'prose' }
{
name: 'fix',
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) {
const LintTask = require('../tasks/lint').default;

View File

@ -71,7 +71,8 @@ const NewCommand = Command.extend({
name: 'skip-commit',
type: Boolean,
default: false,
aliases: ['sc']
aliases: ['sc'],
description: 'Skip committing the first commit to git.'
},
{
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
export const baseServeCommandOptions: any = overrideOptions(
baseBuildCommandOptions.concat([
{ name: 'port', type: Number, default: defaultPort, aliases: ['p'] },
{
name: 'host',
type: String,
default: defaultHost,
aliases: ['H'],
description: `Listens only on ${defaultHost} by default.`
},
{ name: 'proxy-config', type: 'Path', aliases: ['pc'] },
{ name: 'ssl', type: Boolean, default: defaultSsl },
{ name: 'ssl-key', type: String, default: defaultSslKey },
{ name: 'ssl-cert', type: String, default: defaultSslCert },
{
name: 'open',
type: Boolean,
default: false,
aliases: ['o'],
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.'
},
{
name: 'hmr',
type: Boolean,
default: false,
description: 'Enable hot module replacement.',
}
]), [
{ name: 'watch', default: true }
]
);
export const baseServeCommandOptions: any = overrideOptions([
...baseBuildCommandOptions,
{
name: 'port',
type: Number,
default: defaultPort,
aliases: ['p'],
description: 'Port to listen to for serving.'
},
{
name: 'host',
type: String,
default: defaultHost,
aliases: ['H'],
description: `Listens only on ${defaultHost} by default.`
},
{
name: 'proxy-config',
type: 'Path',
aliases: ['pc'],
description: 'Proxy configuration file.'
},
{
name: 'ssl',
type: Boolean,
default: defaultSsl,
description: 'Serve using HTTPS.'
},
{
name: 'ssl-key',
type: String,
default: defaultSslKey,
description: 'SSL key to use for serving HTTPS.'
},
{
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({
name: 'serve',

View File

@ -1,4 +1,4 @@
import {CliConfig} from '../models/config';
\import {CliConfig} from '../models/config';
const SilentError = require('silent-error');
const Command = require('../ember-cli/lib/models/command');
@ -15,7 +15,13 @@ const SetCommand = Command.extend({
works: 'everywhere',
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 {

View File

@ -15,7 +15,8 @@ const Xi18nCommand = Command.extend({
name: 'i18n-format',
type: String,
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',