Skip to content
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

fix(@schematics/angular): rename app.server.module.ts to app.module.server.ts #25058

Merged
merged 1 commit into from Apr 25, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -67,7 +67,7 @@ describe('AppShell Builder', () => {
})
export class AppModule { }
`,
'src/app/app.server.module.ts': `
'src/app/app.module.server.ts': `
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';

Expand Down
Expand Up @@ -6,4 +6,4 @@
* found in the LICENSE file at https://angular.io/license
*/

export { AppServerModule } from './app/app.server.module';
export { AppServerModule } from './app/app.module.server';
12 changes: 6 additions & 6 deletions packages/schematics/angular/app-shell/index_spec.ts
Expand Up @@ -56,7 +56,7 @@ describe('App Shell Schematic', () => {

it('should add a universal app', async () => {
const tree = await schematicRunner.runSchematic('app-shell', defaultOptions, appTree);
const filePath = '/projects/bar/src/app/app.server.module.ts';
const filePath = '/projects/bar/src/app/app.module.server.ts';
expect(tree.exists(filePath)).toEqual(true);
});

Expand Down Expand Up @@ -145,7 +145,7 @@ describe('App Shell Schematic', () => {

it('should add router imports to server module', async () => {
const tree = await schematicRunner.runSchematic('app-shell', defaultOptions, appTree);
const filePath = '/projects/bar/src/app/app.server.module.ts';
const filePath = '/projects/bar/src/app/app.module.server.ts';
const content = tree.readContent(filePath);
expect(content).toMatch(/import { Routes, RouterModule } from '@angular\/router';/);
});
Expand All @@ -158,21 +158,21 @@ describe('App Shell Schematic', () => {
appTree.overwrite('angular.json', JSON.stringify(workspace, undefined, 2));

tree = await schematicRunner.runSchematic('app-shell', defaultOptions, tree);
const filePath = '/projects/bar/src/app/app.server.module.ts';
const filePath = '/projects/bar/src/app/app.module.server.ts';
const content = tree.readContent(filePath);
expect(content).toMatch(/import { Routes, RouterModule } from '@angular\/router';/);
});

it('should define a server route', async () => {
const tree = await schematicRunner.runSchematic('app-shell', defaultOptions, appTree);
const filePath = '/projects/bar/src/app/app.server.module.ts';
const filePath = '/projects/bar/src/app/app.module.server.ts';
const content = tree.readContent(filePath);
expect(content).toMatch(/const routes: Routes = \[/);
});

it('should import RouterModule with forRoot', async () => {
const tree = await schematicRunner.runSchematic('app-shell', defaultOptions, appTree);
const filePath = '/projects/bar/src/app/app.server.module.ts';
const filePath = '/projects/bar/src/app/app.module.server.ts';
const content = tree.readContent(filePath);
expect(content).toMatch(
/const routes: Routes = \[ { path: 'shell', component: AppShellComponent }\];/,
Expand All @@ -183,7 +183,7 @@ describe('App Shell Schematic', () => {
it('should create the shell component', async () => {
const tree = await schematicRunner.runSchematic('app-shell', defaultOptions, appTree);
expect(tree.exists('/projects/bar/src/app/app-shell/app-shell.component.ts')).toBe(true);
const content = tree.readContent('/projects/bar/src/app/app.server.module.ts');
const content = tree.readContent('/projects/bar/src/app/app.module.server.ts');
expect(content).toMatch(/app-shell\.component/);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/app-shell/schema.json
Expand Up @@ -33,7 +33,7 @@
"rootModuleFileName": {
"type": "string",
"description": "The name of the root module file",
"default": "app.server.module.ts"
"default": "app.module.server.ts"
},
"rootModuleClassName": {
"type": "string",
Expand Down
6 changes: 3 additions & 3 deletions packages/schematics/angular/universal/index_spec.ts
Expand Up @@ -67,7 +67,7 @@ describe('Universal Schematic', () => {

it('should create a root module file', async () => {
const tree = await schematicRunner.runSchematic('universal', defaultOptions, appTree);
const filePath = '/projects/bar/src/app/app.server.module.ts';
const filePath = '/projects/bar/src/app/app.module.server.ts';
expect(tree.exists(filePath)).toEqual(true);
});

Expand All @@ -76,7 +76,7 @@ describe('Universal Schematic', () => {
const filePath = '/projects/bar/src/main.server.ts';
expect(tree.exists(filePath)).toEqual(true);
const contents = tree.readContent(filePath);
expect(contents).toMatch(/export { AppServerModule } from '\.\/app\/app\.server\.module'/);
expect(contents).toMatch(/export { AppServerModule } from '\.\/app\/app\.module\.server'/);
});

it('should create a tsconfig file for the workspace project', async () => {
Expand Down Expand Up @@ -211,7 +211,7 @@ describe('Universal Schematic', () => {
defaultStandaloneOptions,
appTree,
);
const filePath = '/projects/baz/src/app/app.server.module.ts';
const filePath = '/projects/baz/src/app/app.module.server.ts';
expect(tree.exists(filePath)).toEqual(false);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/universal/schema.json
Expand Up @@ -30,7 +30,7 @@
"type": "string",
"format": "path",
"description": "The name of the root NgModule file.",
"default": "app.server.module.ts"
"default": "app.module.server.ts"
},
"rootModuleClassName": {
"type": "string",
Expand Down