11import { AngularUtilities , NavElementTypes } from '../../../angular' ;
2- import { ANGULAR_JSON_FILE_NAME , APPS_DIRECTORY_NAME , BASE_TS_CONFIG_FILE_NAME , DOCKER_FILE_NAME , GIT_IGNORE_FILE_NAME } from '../../../constants' ;
2+ import { ANGULAR_APP_COMPONENT_FILE_NAME , ANGULAR_JSON_FILE_NAME , APPS_DIRECTORY_NAME , BASE_TS_CONFIG_FILE_NAME , DOCKER_FILE_NAME , GIT_IGNORE_FILE_NAME } from '../../../constants' ;
33import { DockerUtilities } from '../../../docker' ;
44import { FsUtilities , JsonUtilities , QuestionsFor } from '../../../encapsulation' ;
55import { DefaultEnvKeys , EnvUtilities } from '../../../env' ;
@@ -82,7 +82,7 @@ export class AddAngularWebsiteCommand extends BaseAddCommand<AddAngularWebsiteCo
8282
8383 await AngularUtilities . addSitemapAndRobots ( root , config . name , domain ) ;
8484
85- await this . cleanUp ( root ) ;
85+ await this . cleanUp ( root , config . name ) ;
8686 await this . setupTsConfig ( root , config . name ) ;
8787 await this . createDockerfile ( root , config ) ;
8888 await AngularUtilities . setupNavigation ( root , config . name ) ;
@@ -222,13 +222,23 @@ export class AddAngularWebsiteCommand extends BaseAddCommand<AddAngularWebsiteCo
222222 await FsUtilities . createFile ( getPath ( root , 'tsconfig.eslint.json' ) , JsonUtilities . stringify ( eslintTsconfig ) ) ;
223223 }
224224
225- private async cleanUp ( root : string ) : Promise < void > {
225+ private async cleanUp ( root : string , name : string ) : Promise < void > {
226226 // eslint-disable-next-line no-console
227227 console . log ( 'cleans up' ) ;
228+ await FsUtilities . replaceInFile (
229+ getPath ( root , 'src' , 'app' , ANGULAR_APP_COMPONENT_FILE_NAME ) ,
230+ `protected readonly title = signal('${ name } ');` ,
231+ ' constructor() {}'
232+ ) ;
233+ await FsUtilities . replaceInFile (
234+ getPath ( root , 'src' , 'app' , ANGULAR_APP_COMPONENT_FILE_NAME ) ,
235+ 'Component, signal' ,
236+ 'Component'
237+ ) ;
228238 await FsUtilities . rm ( getPath ( root , '.vscode' ) ) ;
229239 await FsUtilities . rm ( getPath ( root , '.editorconfig' ) ) ;
230240 await FsUtilities . rm ( getPath ( root , GIT_IGNORE_FILE_NAME ) ) ;
231- await FsUtilities . rm ( getPath ( root , 'src' , 'app' , 'app.component. spec.ts' ) ) ;
241+ await FsUtilities . rm ( getPath ( root , 'src' , 'app' , 'app.spec.ts' ) ) ;
232242 }
233243
234244 private async createProject ( config : AddAngularWebsiteConfiguration ) : Promise < Path > {
@@ -237,10 +247,34 @@ export class AddAngularWebsiteCommand extends BaseAddCommand<AddAngularWebsiteCo
237247 await AngularUtilities . runCommand (
238248 getPath ( APPS_DIRECTORY_NAME ) ,
239249 `new ${ config . name } ` ,
240- { '--skip-git' : true , '--style' : 'css' , '--inline-style' : true , '--ssr' : true }
250+ { '--skip-git' : true , '--style' : 'css' , '--inline-style' : true , '--ssr' : true , '--ai-config' : 'none' , '--zoneless' : false }
241251 ) ;
242252 const newProject : WorkspaceProject = await WorkspaceUtilities . findProjectOrFail ( config . name , getPath ( '.' ) ) ;
243- await FsUtilities . updateFile ( getPath ( newProject . path , 'src' , 'app' , 'app.component.html' ) , '' , 'replace' ) ;
253+ await AngularUtilities . updateAngularJson (
254+ getPath ( newProject . path , ANGULAR_JSON_FILE_NAME ) ,
255+ {
256+ projects : {
257+ [ newProject . name ] : {
258+ schematics : {
259+ '@schematics/angular:component' : {
260+ style : 'css' ,
261+ type : 'component'
262+ } ,
263+ '@schematics/angular:service' : {
264+ type : 'service'
265+ } ,
266+ '@schematics/angular:pipe' : {
267+ typeSeparator : '.'
268+ } ,
269+ '@schematics/angular:guard' : {
270+ typeSeparator : '.'
271+ }
272+ }
273+ }
274+ }
275+ }
276+ ) ;
277+ await FsUtilities . updateFile ( getPath ( newProject . path , 'src' , 'app' , 'app.html' ) , '' , 'replace' ) ;
244278 await AngularUtilities . addProvider ( newProject . path , 'provideHttpClient(withInterceptorsFromDi(), withFetch())' , [
245279 // eslint-disable-next-line sonar/no-duplicate-string
246280 { defaultImport : false , element : 'provideHttpClient' , path : '@angular/common/http' } ,
0 commit comments