@@ -7,7 +7,7 @@ import { NpmPackage, NpmUtilities } from '../npm';
77import { ArrayStartIdentifier , TsImportDefinition , TsUtilities } from '../ts' ;
88import { AngularJson , AngularJsonAssetPattern } from './angular-json.model' ;
99import { NgPackageJson } from './ng-package-json.model' ;
10- import { ANGULAR_APP_COMPONENT_FILE_NAME , ANGULAR_JSON_FILE_NAME , ANGULAR_ROUTES_FILE_NAME , APP_CONFIG_FILE_NAME , ENVIRONMENT_MODEL_TS_FILE_NAME , ROBOTS_FILE_NAME , SITEMAP_FILE_NAME } from '../constants' ;
10+ import { ANGULAR_APP_COMPONENT_FILE_NAME , ANGULAR_JSON_FILE_NAME , ANGULAR_ROUTES_FILE_NAME , ANGULAR_SERVER_ROUTES_FILE_NAME , APP_CONFIG_FILE_NAME , APP_CONFIG_SERVER_FILE_NAME , ENVIRONMENT_MODEL_TS_FILE_NAME , ROBOTS_FILE_NAME , SITEMAP_FILE_NAME } from '../constants' ;
1111import { DefaultEnvKeys , EnvUtilities } from '../env' ;
1212import { DeepPartial } from '../types' ;
1313import { AddNavElementConfig } from './add-nav-element-config.model' ;
@@ -462,6 +462,19 @@ export abstract class AngularUtilities {
462462 * @param root - The root of the angular project to setup material for.
463463 */
464464 static async setupMaterial ( root : string ) : Promise < void > {
465+ await AngularUtilities . setupBaseStyles ( root ) ;
466+ await FsUtilities . updateFile (
467+ getPath ( root , 'src' , 'styles.css' ) ,
468+ '@import "@angular/material/prebuilt-themes/indigo-pink.css";' ,
469+ 'prepend'
470+ ) ;
471+ }
472+
473+ /**
474+ * Sets up the base styles.
475+ * @param root - The root of the project.
476+ */
477+ static async setupBaseStyles ( root : string ) : Promise < void > {
465478 await FsUtilities . updateFile (
466479 getPath ( root , 'src' , 'styles.css' ) ,
467480 [
@@ -479,11 +492,6 @@ export abstract class AngularUtilities {
479492 ] ,
480493 'append'
481494 ) ;
482- await FsUtilities . updateFile (
483- getPath ( root , 'src' , 'styles.css' ) ,
484- '@import "@angular/material/prebuilt-themes/indigo-pink.css";' ,
485- 'prepend'
486- ) ;
487495 }
488496
489497 /**
@@ -623,12 +631,29 @@ export abstract class AngularUtilities {
623631 /**
624632 * Adds tracking to the angular project with the given name.
625633 * @param projectName - The name of the angular project to add tracking to.
634+ * @param root - The root dir of the project.
626635 */
627- static async setupTracking ( projectName : string ) : Promise < void > {
636+ static async setupTracking ( projectName : string , root : Path ) : Promise < void > {
628637 // eslint-disable-next-line no-console
629638 console . log ( 'Adds tracking' ) ;
630639 await NpmUtilities . install ( projectName , [ NpmPackage . NGX_MATERIAL_TRACKING ] ) ;
631640 // TODO: Angular Tracking
641+ await this . addProvider (
642+ root ,
643+ {
644+ provide : 'NGX_TRACKING_SNACKBAR_COMPONENT' ,
645+ useValue : 'SnackbarComponent'
646+ } ,
647+ [ { defaultImport : false , element : 'SnackbarComponent' , path : NpmPackage . NGX_MATERIAL_TRACKING } ]
648+ ) ;
649+ await this . addProvider (
650+ root ,
651+ {
652+ provide : 'NGX_GDPR_TRACKINGS' ,
653+ useValue : [ ]
654+ } ,
655+ [ { defaultImport : false , element : 'NGX_GDPR_TRACKINGS' , path : NpmPackage . NGX_MATERIAL_TRACKING } ]
656+ ) ;
632657 }
633658
634659 /**
@@ -683,11 +708,12 @@ export abstract class AngularUtilities {
683708 getPath ( root , 'src' , 'app' , 'app.html' ) ,
684709 [
685710 // eslint-disable-next-line stylistic/max-len
686- '<ngx-mat-navigation-navbar [minHeight]="80" [minSidenavWidth]="\'30%\'" [minHeightOtherElements]="70" [navbarRows]="navbarRows">' ,
711+ '<ngx-mat-navigation-navbar [minHeight]="80" [minSidenavWidth]="\'40%\'" [minHeightOtherElements]="150" [navbarRows]="navbarRows">' ,
712+ '\t<ngx-mat-navigation-breadcrumbs></ngx-mat-navigation-breadcrumbs>' ,
687713 '\t<router-outlet></router-outlet>' ,
688714 '</ngx-mat-navigation-navbar>' ,
689715 '' ,
690- '<ngx-mat-navigation-footer [minHeight]="70 " [footerRows]="footerRows"></ngx-mat-navigation-footer>'
716+ '<ngx-mat-navigation-footer [minHeight]="150 " [footerRows]="footerRows"></ngx-mat-navigation-footer>'
691717 ] ,
692718 'append'
693719 ) ;
@@ -704,6 +730,11 @@ export abstract class AngularUtilities {
704730 element : 'NgxMatNavigationFooterComponent' ,
705731 path : NpmPackage . NGX_MATERIAL_NAVIGATION ,
706732 defaultImport : false
733+ } ,
734+ {
735+ element : 'NgxMatNavigationBreadcrumbsComponent' ,
736+ path : NpmPackage . NGX_MATERIAL_NAVIGATION ,
737+ defaultImport : false
707738 }
708739 ]
709740 ) ;
@@ -742,6 +773,15 @@ export abstract class AngularUtilities {
742773 await FsUtilities . updateFile ( appComponentTs , tsLines , 'replace' ) ;
743774
744775 const routesTs : Path = getPath ( root , 'src' , 'app' , ANGULAR_ROUTES_FILE_NAME ) ;
776+ await FsUtilities . rename (
777+ getPath ( root , 'src' , 'app' , 'app.routes.server.ts' ) ,
778+ getPath ( root , 'src' , 'app' , ANGULAR_SERVER_ROUTES_FILE_NAME )
779+ ) ;
780+ await FsUtilities . replaceAllInFile (
781+ getPath ( root , 'src' , 'app' , APP_CONFIG_SERVER_FILE_NAME ) ,
782+ 'import { serverRoutes } from \'./app.routes.server\';' ,
783+ 'import { serverRoutes } from \'./server.routes\';'
784+ ) ;
745785 await FsUtilities . rename (
746786 getPath ( root , 'src' , 'app' , 'app.routes.ts' ) ,
747787 routesTs
0 commit comments