From 8edc903b874ced73521c187eee6fad39d425cf93 Mon Sep 17 00:00:00 2001 From: Giora Guttsait Date: Fri, 26 May 2017 17:54:41 +0300 Subject: [PATCH] docs(@angular/cli): update documentation for `ng new` * for several options that are saved in .angular-cli.json, I've added an explanation of what setting in the json file controls that options. * added an explanation about what --dry-run will output. * added possible values for --style option * added respective documentation in the command * also added less, sass and styl(stylus) as possible style extensions The motivation for this change is that sometimes people would want to change some of the settings set by the cli durig ng new, that they might have not known or cared about, for example, prefix. --- docs/documentation/new.md | 22 +++++++++++++++++++--- packages/@angular/cli/commands/new.ts | 19 +++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/docs/documentation/new.md b/docs/documentation/new.md index e3e66addf12d..9400ce2ef5e2 100644 --- a/docs/documentation/new.md +++ b/docs/documentation/new.md @@ -24,7 +24,7 @@ Default applications are created in a directory of the same name, with an initia --dry-run (alias: -d) default value: false

- Run through without making any changes. + Run through without making any changes. Will list all files that would have been created when running ng new.

@@ -66,6 +66,9 @@ Default applications are created in a directory of the same name, with an initia

The prefix to use for all component selectors.

+

+ You can later change the value in .angular-cli.json (apps[0].prefix). +

@@ -129,6 +132,9 @@ Default applications are created in a directory of the same name, with an initia

The name of the source directory.

+

+ You can later change the value in .angular-cli.json (apps[0].root). +

@@ -136,8 +142,18 @@ Default applications are created in a directory of the same name, with an initia

--style default value: css

-

- The style file default extension. +

+ The style file default extension. Possible values: +
    +
  • css
  • +
  • scss
  • +
  • less
  • +
  • sass
  • +
  • styl (stylus)
  • +
+
+

+ You can later change the value in .angular-cli.json (defaults.styleExt).

diff --git a/packages/@angular/cli/commands/new.ts b/packages/@angular/cli/commands/new.ts index 5f2647f95102..b4f61766613b 100644 --- a/packages/@angular/cli/commands/new.ts +++ b/packages/@angular/cli/commands/new.ts @@ -13,6 +13,8 @@ const Project = require('../ember-cli/lib/models/project'); const SilentError = require('silent-error'); const mkdir = denodeify(fs.mkdir); +const configFile = '.angular-cli.json'; +const changeLater = (path: string) => `You can later change the value in "${configFile}" (${path})`; const NewCommand = Command.extend({ name: 'new', @@ -26,7 +28,10 @@ const NewCommand = Command.extend({ type: Boolean, default: false, aliases: ['d'], - description: 'Run through without making any changes.' + description: oneLine` + Run through without making any changes. + Will list all files that would have been created when running "ng new". + ` }, { name: 'verbose', @@ -82,20 +87,26 @@ const NewCommand = Command.extend({ type: String, default: 'src', aliases: ['sd'], - description: 'The name of the source directory.' + description: `The name of the source directory. ${changeLater('apps[0].root')}.` }, { name: 'style', type: String, default: 'css', - description: 'The style file default extension.' + description: oneLine`The style file default extension. + Possible values: css, scss, less, sass, styl(stylus). + ${changeLater('defaults.styleExt')}. + ` }, { name: 'prefix', type: String, default: 'app', aliases: ['p'], - description: 'The prefix to use for all component selectors.' + description: oneLine` + The prefix to use for all component selectors. + ${changeLater('apps[0].prefix')}. + ` }, { name: 'routing',