Skip to content

Commit e87598e

Browse files
gioraguttBrocco
authored andcommitted
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.
1 parent f75b5a7 commit e87598e

File tree

2 files changed

+34
-7
lines changed
  • docs/documentation
  • packages/@angular/cli/commands

2 files changed

+34
-7
lines changed

docs/documentation/new.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Default applications are created in a directory of the same name, with an initia
2424
<code>--dry-run</code> (alias: <code>-d</code>) <em>default value: false</em>
2525
</p>
2626
<p>
27-
Run through without making any changes.
27+
Run through without making any changes. Will list all files that would have been created when running <code>ng new</code>.
2828
</p>
2929
</details>
3030

@@ -66,6 +66,9 @@ Default applications are created in a directory of the same name, with an initia
6666
<p>
6767
The prefix to use for all component selectors.
6868
</p>
69+
<p>
70+
You can later change the value in <em>.angular-cli.json</em> (<code>apps[0].prefix</code>).
71+
</p>
6972
</details>
7073

7174
<details>
@@ -129,15 +132,28 @@ Default applications are created in a directory of the same name, with an initia
129132
<p>
130133
The name of the source directory.
131134
</p>
135+
<p>
136+
You can later change the value in <em>.angular-cli.json</em> (<code>apps[0].root</code>).
137+
</p>
132138
</details>
133139

134140
<details>
135141
<summary>style</summary>
136142
<p>
137143
<code>--style</code> <em>default value: css</em>
138144
</p>
139-
<p>
140-
The style file default extension.
145+
<div>
146+
The style file default extension. Possible values:
147+
<ul>
148+
<li>css</li>
149+
<li>scss</li>
150+
<li>less</li>
151+
<li>sass</li>
152+
<li>styl (<code>stylus</code>)<li>
153+
</ul>
154+
</div>
155+
<p>
156+
You can later change the value in <em>.angular-cli.json</em> (<code>defaults.styleExt</code>).
141157
</p>
142158
</details>
143159

packages/@angular/cli/commands/new.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const Project = require('../ember-cli/lib/models/project');
1313
const SilentError = require('silent-error');
1414
const mkdir = denodeify(fs.mkdir);
1515

16+
const configFile = '.angular-cli.json';
17+
const changeLater = (path: string) => `You can later change the value in "${configFile}" (${path})`;
1618

1719
const NewCommand = Command.extend({
1820
name: 'new',
@@ -26,7 +28,10 @@ const NewCommand = Command.extend({
2628
type: Boolean,
2729
default: false,
2830
aliases: ['d'],
29-
description: 'Run through without making any changes.'
31+
description: oneLine`
32+
Run through without making any changes.
33+
Will list all files that would have been created when running "ng new".
34+
`
3035
},
3136
{
3237
name: 'verbose',
@@ -82,20 +87,26 @@ const NewCommand = Command.extend({
8287
type: String,
8388
default: 'src',
8489
aliases: ['sd'],
85-
description: 'The name of the source directory.'
90+
description: `The name of the source directory. ${changeLater('apps[0].root')}.`
8691
},
8792
{
8893
name: 'style',
8994
type: String,
9095
default: 'css',
91-
description: 'The style file default extension.'
96+
description: oneLine`The style file default extension.
97+
Possible values: css, scss, less, sass, styl(stylus).
98+
${changeLater('defaults.styleExt')}.
99+
`
92100
},
93101
{
94102
name: 'prefix',
95103
type: String,
96104
default: 'app',
97105
aliases: ['p'],
98-
description: 'The prefix to use for all component selectors.'
106+
description: oneLine`
107+
The prefix to use for all component selectors.
108+
${changeLater('apps[0].prefix')}.
109+
`
99110
},
100111
{
101112
name: 'routing',

0 commit comments

Comments
 (0)