Skip to content

docs(@angular-cli): update documentation for ng new #6480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions docs/documentation/new.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Default applications are created in a directory of the same name, with an initia
<code>--dry-run</code> (alias: <code>-d</code>) <em>default value: false</em>
</p>
<p>
Run through without making any changes.
Run through without making any changes. Will list all files that would have been created when running <code>ng new</code>.
</p>
</details>

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

<details>
Expand Down Expand Up @@ -129,15 +132,28 @@ Default applications are created in a directory of the same name, with an initia
<p>
The name of the source directory.
</p>
<p>
You can later change the value in <em>.angular-cli.json</em> (<code>apps[0].root</code>).
</p>
</details>

<details>
<summary>style</summary>
<p>
<code>--style</code> <em>default value: css</em>
</p>
<p>
The style file default extension.
<div>
The style file default extension. Possible values:
<ul>
<li>css</li>
<li>scss</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styl is also possible for stylus.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As well as less

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I have to add to both the docs and the command: styl and less? what about sass?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as I can see, from commands/new.ts up until blueprints/ng/index.ts, there's only validation for stylus to change the extension to styl. Meaning that anyone can f.e put asdf and that would work. I also don't see any e2e testing for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm wrong and there's validation for that, please tell me. If not, I guess that's something that you should consider.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@filipesilva I've updated the PR commit with less and stylus as options. I've stated styl for stylus, but I've written styl (stylus) to make it clear that it's clear.

<li>less</li>
<li>sass</li>
<li>styl (<code>stylus</code>)<li>
</ul>
</div>
<p>
You can later change the value in <em>.angular-cli.json</em> (<code>defaults.styleExt</code>).
</p>
</details>

Expand Down
19 changes: 15 additions & 4 deletions packages/@angular/cli/commands/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down