1
0
mirror of https://github.com/angular/angular-cli.git synced 2025-05-16 18:43:42 +08:00

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

This fixes an issue were we generated files using inconsistent names example `app.server.module.ts` and `app.config.server.ts`.
This commit is contained in:
Alan Agius 2023-04-25 06:32:22 +00:00 committed by angular-robot[bot]
parent 480eb3eeff
commit 603d24f966
7 changed files with 13 additions and 13 deletions
packages
angular_devkit/build_angular
src/builders/app-shell
test/hello-world-app/src
schematics/angular

@ -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';

@ -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';

@ -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);
});
@ -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';/);
});
@ -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 }\];/,
@ -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/);
});

@ -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",

@ -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);
});
@ -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 () => {
@ -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);
});

@ -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",