Skip to content

fix(@schematics/angular): the ng-new schematic should not prompt for style nor for routing #15207

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 2 commits into from
Aug 2, 2019
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
4 changes: 4 additions & 0 deletions packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ export default function (options: ApplicationOptions): Rule {
}
validateProjectName(options.name);
options.prefix = options.prefix || 'app';
// This line and the one above shouldn't be needed, but at the moment they are.
// This is because the default value defined in the schema.json file is not
// correctly set when this schematic is run from another schematic.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably open an issue and add a link to it here w/ a TODO to remove this when that issue is resolved.

options.style = options.style || Style.Css;
const appRootSelector = `${options.prefix}-root`;
const componentOptions: Partial<ComponentOptions> = !options.minimal ?
{
Expand Down
32 changes: 3 additions & 29 deletions packages/schematics/angular/ng-new/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@
"type": "string"
}
},
"required": [
"name",
"email"
]
"required": ["name", "email"]
}
],
"default": true
Expand Down Expand Up @@ -102,8 +99,6 @@
"routing": {
"type": "boolean",
"description": "When true, generates a routing module for the initial project.",
"default": false,
"x-prompt": "Would you like to add Angular routing?",
"x-user-analytics": 17
},
"prefix": {
Expand All @@ -117,25 +112,7 @@
"style": {
"description": "The file extension or preprocessor to use for style files.",
"type": "string",
"default": "css",
"enum": [
"css",
"scss",
"sass",
"less",
"styl"
],
"x-prompt": {
"message": "Which stylesheet format would you like to use?",
"type": "list",
"items": [
{ "value": "css", "label": "CSS" },
{ "value": "scss", "label": "SCSS [ https://sass-lang.com/documentation/syntax#scss ]" },
{ "value": "sass", "label": "Sass [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]" },
{ "value": "less", "label": "Less [ http://lesscss.org ]" },
{ "value": "styl", "label": "Stylus [ http://stylus-lang.com ]" }
]
},
"enum": ["css", "scss", "sass", "less", "styl"],
"x-user-analytics": 5
},
"skipTests": {
Expand All @@ -157,8 +134,5 @@
"x-user-analytics": 14
}
},
"required": [
"name",
"version"
]
"required": ["name", "version"]
}