Skip to content

Commit 8567267

Browse files
committed
refactor(@schematics/angular): remove redundant standalone: true from templates
This is no longer needed.
1 parent 31f9037 commit 8567267

File tree

9 files changed

+8
-13
lines changed

9 files changed

+8
-13
lines changed

packages/schematics/angular/application/files/standalone-files/src/app/app.component.ts.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { RouterOutlet } from '@angular/router';<% } %>
33

44
@Component({
55
selector: '<%= selector %>',
6-
standalone: true,
76
imports: [<% if(routing) { %>RouterOutlet<% } %>],<% if(inlineTemplate) { %>
87
template: `
98
<h1>Welcome to {{title}}!</h1>

packages/schematics/angular/application/index_spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,10 @@ describe('Application Schematic', () => {
558558

559559
it('should create a standalone component', async () => {
560560
const options = { ...defaultOptions, standalone: true };
561-
562561
const tree = await schematicRunner.runSchematic('application', options, workspaceTree);
563-
564562
const component = tree.readContent('/projects/foo/src/app/app.component.ts');
565-
expect(component).toMatch(/standalone: true/);
563+
564+
expect(component).not.toContain('standalone');
566565
});
567566

568567
it('should create routing information by default', async () => {

packages/schematics/angular/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { <% if(changeDetection !== 'Default') { %>ChangeDetectionStrategy, <% }%
22

33
@Component({<% if(!skipSelector) {%>
44
selector: '<%= selector %>',<%}%><% if(standalone) {%>
5-
standalone: true,
65
imports: [],<%} else { %>
76
standalone: false,
87
<% }%><% if(inlineTemplate) { %>

packages/schematics/angular/component/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ describe('Component Schematic', () => {
350350
const componentContent = tree.readContent('/projects/bar/src/app/foo/foo.component.ts');
351351
expect(componentContent).toContain('class FooComponent');
352352
expect(moduleContent).not.toContain('FooComponent');
353-
expect(componentContent).toContain('standalone: true');
353+
expect(componentContent).not.toContain('standalone');
354354
});
355355

356356
it('should declare standalone components in the `imports` of a test', async () => {

packages/schematics/angular/directive/files/__name@dasherize@if-flat__/__name@dasherize__.directive.ts.template

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Directive } from '@angular/core';
22

33
@Directive({
4-
selector: '[<%= selector %>]'<% if(standalone) {%>,
5-
standalone: true<%} else {%>,
4+
selector: '[<%= selector %>]'<% if(!standalone) {%>,
65
standalone: false<%}%>
76
})
87
export class <%= classify(name) %>Directive {

packages/schematics/angular/directive/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe('Directive Schematic', () => {
107107
const options = { ...defaultOptions, standalone: true };
108108
const tree = await schematicRunner.runSchematic('directive', options, appTree);
109109
const directiveContent = tree.readContent('/projects/bar/src/app/foo.directive.ts');
110-
expect(directiveContent).toContain('standalone: true');
110+
expect(directiveContent).not.toContain('standalone');
111111
expect(directiveContent).toContain('class FooDirective');
112112
});
113113

packages/schematics/angular/library/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('Library Schematic', () => {
7171
it('should create a standalone component', async () => {
7272
const tree = await schematicRunner.runSchematic('library', defaultOptions, workspaceTree);
7373
const componentContent = tree.readContent('/projects/foo/src/lib/foo.component.ts');
74-
expect(componentContent).toContain('standalone: true');
74+
expect(componentContent).not.toContain('standalone');
7575
});
7676

7777
describe('custom projectRoot', () => {

packages/schematics/angular/pipe/files/__name@dasherize@if-flat__/__name@dasherize__.pipe.ts.template

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Pipe, PipeTransform } from '@angular/core';
22

33
@Pipe({
4-
name: '<%= camelize(name) %>'<% if(standalone) {%>,
5-
standalone: true<%} else {%>,
4+
name: '<%= camelize(name) %>'<% if(!standalone) {%>,
65
standalone: false<%}%>
76
})
87
export class <%= classify(name) %>Pipe implements PipeTransform {

packages/schematics/angular/pipe/index_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ describe('Pipe Schematic', () => {
156156
const tree = await schematicRunner.runSchematic('pipe', defaultOptions, appTree);
157157
const moduleContent = tree.readContent('/projects/bar/src/app/app.module.ts');
158158
const pipeContent = tree.readContent('/projects/bar/src/app/foo.pipe.ts');
159-
expect(pipeContent).toContain('standalone: true');
159+
expect(pipeContent).not.toContain('standalone');
160160
expect(pipeContent).toContain('class FooPipe');
161161
expect(moduleContent).not.toContain('FooPipe');
162162
});

0 commit comments

Comments
 (0)