Skip to content

Commit

Permalink
feat(@schematics/angular): enable routing by default for new applicat…
Browse files Browse the repository at this point in the history
…ions

This commits updates the `routing` option in the `ng new` and `ng generation application` schematics to `true` by default and also removed the `Would you like to add Angular routing?` prompt.

BREAKING CHANGE: Routing is enabled by default for new applications when using `ng generate application` and `ng new`. The `--no-routing` command line option can be used to disable this behaviour.
  • Loading branch information
alan-agius4 committed Sep 8, 2023
1 parent 31a5d43 commit bdf9203
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
5 changes: 2 additions & 3 deletions packages/schematics/angular/application/index_spec.ts
Expand Up @@ -31,7 +31,6 @@ describe('Application Schematic', () => {

const defaultOptions: ApplicationOptions = {
name: 'foo',
routing: false,
skipPackageJson: false,
};

Expand Down Expand Up @@ -566,8 +565,8 @@ describe('Application Schematic', () => {
expect(component).toMatch(/standalone: true/);
});

it('should create routing information when routing is true', async () => {
const options = { ...defaultOptions, standalone: true, routing: true };
it('should create routing information by default', async () => {
const options = { ...defaultOptions, standalone: true };

const tree = await schematicRunner.runSchematic('application', options, workspaceTree);

Expand Down
5 changes: 2 additions & 3 deletions packages/schematics/angular/application/schema.json
Expand Up @@ -39,9 +39,8 @@
},
"routing": {
"type": "boolean",
"description": "Create a routing NgModule.",
"default": false,
"x-prompt": "Would you like to add Angular routing?",
"description": "Creates an application with routing enabled.",
"default": true,
"x-user-analytics": "ep.ng_routing"
},
"prefix": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/ng-new/index_spec.ts
Expand Up @@ -51,6 +51,7 @@ describe('Ng New Schematic', () => {
jasmine.arrayContaining([
'/bar/tsconfig.app.json',
'/bar/src/main.ts',
'/bar/src/app/app.routes.ts',
'/bar/src/app/app.config.ts',
]),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/ng-new/schema.json
Expand Up @@ -91,7 +91,7 @@
},
"routing": {
"type": "boolean",
"description": "Generate a routing module for the initial project.",
"description": "Enable routing in the initial project.",
"x-user-analytics": "ep.ng_routing"
},
"prefix": {
Expand Down
Expand Up @@ -31,6 +31,7 @@ describe('standalone utilities', () => {
{
name: projectName,
standalone,
routing: false,
},
host,
);
Expand Down

0 comments on commit bdf9203

Please sign in to comment.