@@ -11,7 +11,7 @@ import { ANGULAR_APP_COMPONENT_FILE_NAME, ANGULAR_JSON_FILE_NAME, ANGULAR_ROUTES
1111import { DefaultEnvKeys , EnvUtilities } from '../env' ;
1212import { DeepPartial } from '../types' ;
1313import { AddNavElementConfig } from './add-nav-element-config.model' ;
14- import { getPath , mergeDeep , optionsToCliString } from '../utilities' ;
14+ import { getPath , mergeDeep , optionsToCliString , Path } from '../utilities' ;
1515import { NavElementTypes } from './nav-element-types.enum' ;
1616import { RobotsUtilities } from '../robots' ;
1717import { WorkspaceProject , WorkspaceUtilities } from '../workspace' ;
@@ -132,7 +132,7 @@ export abstract class AngularUtilities {
132132 '}'
133133 ]
134134 ) ;
135- const appComponentPath : string = getPath ( root , 'src' , 'app' , ANGULAR_APP_COMPONENT_FILE_NAME ) ;
135+ const appComponentPath : Path = getPath ( root , 'src' , 'app' , ANGULAR_APP_COMPONENT_FILE_NAME ) ;
136136 await TsUtilities . addImportStatements (
137137 appComponentPath ,
138138 [ { defaultImport : false , element : 'LoggerService' , path : './services/logger.service' } ]
@@ -187,7 +187,7 @@ export abstract class AngularUtilities {
187187 false ,
188188 getPath ( '.' )
189189 ) ;
190- const authServicePath : string = getPath ( projectRoot , 'src' , 'app' , 'services' , 'auth.service.ts' ) ;
190+ const authServicePath : Path = getPath ( projectRoot , 'src' , 'app' , 'services' , 'auth.service.ts' ) ;
191191 await FsUtilities . createFile ( authServicePath , authServiceContent ) ;
192192 await this . addProvider (
193193 projectRoot ,
@@ -205,7 +205,7 @@ export abstract class AngularUtilities {
205205 { defaultImport : false , element : 'environment' , path : '../environment/environment' }
206206 ]
207207 ) ;
208- const appConfigPath : string = getPath ( projectRoot , 'src' , 'app' , APP_CONFIG_FILE_NAME ) ;
208+ const appConfigPath : Path = getPath ( projectRoot , 'src' , 'app' , APP_CONFIG_FILE_NAME ) ;
209209 await TsUtilities . addImportStatements (
210210 appConfigPath ,
211211 [
@@ -249,9 +249,9 @@ export abstract class AngularUtilities {
249249 } ,
250250 domain
251251 ) ;
252- const pagesPath : string = getPath ( projectRoot , 'src' , 'app' , 'pages' ) ;
253- const loginPageTs : string = getPath ( pagesPath , 'login' , 'login.component.ts' ) ;
254- const loginPageHtml : string = getPath ( pagesPath , 'login' , 'login.component.html' ) ;
252+ const pagesPath : Path = getPath ( projectRoot , 'src' , 'app' , 'pages' ) ;
253+ const loginPageTs : Path = getPath ( pagesPath , 'login' , 'login.component.ts' ) ;
254+ const loginPageHtml : Path = getPath ( pagesPath , 'login' , 'login.component.html' ) ;
255255 await this . addComponentImports (
256256 loginPageTs ,
257257 [ { defaultImport : false , element : 'NgxMatAuthLoginComponent' , path : NpmPackage . NGX_MATERIAL_AUTH } ]
@@ -284,9 +284,9 @@ export abstract class AngularUtilities {
284284 } ,
285285 domain
286286 ) ;
287- const requestResetPasswordPageTs : string = getPath ( pagesPath , 'request-reset-password' , 'request-reset-password.component.ts' ) ;
287+ const requestResetPasswordPageTs : Path = getPath ( pagesPath , 'request-reset-password' , 'request-reset-password.component.ts' ) ;
288288
289- const requestResetPasswordPageHtml : string = getPath ( pagesPath , 'request-reset-password' , 'request-reset-password.component.html' ) ;
289+ const requestResetPasswordPageHtml : Path = getPath ( pagesPath , 'request-reset-password' , 'request-reset-password.component.html' ) ;
290290 await this . addComponentImports (
291291 requestResetPasswordPageTs ,
292292 [ { defaultImport : false , element : 'NgxMatAuthRequestResetPasswordComponent' , path : NpmPackage . NGX_MATERIAL_AUTH } ]
@@ -317,9 +317,9 @@ export abstract class AngularUtilities {
317317 } ,
318318 domain
319319 ) ;
320- const confirmResetPasswordPageTs : string = getPath ( pagesPath , 'confirm-reset-password' , 'confirm-reset-password.component.ts' ) ;
320+ const confirmResetPasswordPageTs : Path = getPath ( pagesPath , 'confirm-reset-password' , 'confirm-reset-password.component.ts' ) ;
321321
322- const confirmResetPasswordPageHtml : string = getPath ( pagesPath , 'confirm-reset-password' , 'confirm-reset-password.component.html' ) ;
322+ const confirmResetPasswordPageHtml : Path = getPath ( pagesPath , 'confirm-reset-password' , 'confirm-reset-password.component.html' ) ;
323323 await this . addComponentImports (
324324 confirmResetPasswordPageTs ,
325325 [ { defaultImport : false , element : 'NgxMatAuthConfirmResetPasswordComponent' , path : NpmPackage . NGX_MATERIAL_AUTH } ]
@@ -358,8 +358,8 @@ export abstract class AngularUtilities {
358358 } ,
359359 domain
360360 ) ;
361- const adminsPageTs : string = getPath ( pagesPath , 'admins' , 'admins.component.ts' ) ;
362- const adminsPageHtml : string = getPath ( pagesPath , 'admins' , 'admins.component.html' ) ;
361+ const adminsPageTs : Path = getPath ( pagesPath , 'admins' , 'admins.component.ts' ) ;
362+ const adminsPageHtml : Path = getPath ( pagesPath , 'admins' , 'admins.component.html' ) ;
363363 await FsUtilities . updateFile (
364364 adminsPageTs ,
365365 adminsPageTsContent ,
@@ -374,7 +374,7 @@ export abstract class AngularUtilities {
374374 ] ,
375375 'replace'
376376 ) ;
377- const routesTs : string = getPath ( projectRoot , 'src' , 'app' , ANGULAR_ROUTES_FILE_NAME ) ;
377+ const routesTs : Path = getPath ( projectRoot , 'src' , 'app' , ANGULAR_ROUTES_FILE_NAME ) ;
378378 await TsUtilities . addImportStatements (
379379 routesTs ,
380380 [
@@ -480,7 +480,7 @@ export abstract class AngularUtilities {
480480 provider : Provider | EnvironmentProviders | CustomTsValues ,
481481 imports : TsImportDefinition [ ]
482482 ) : Promise < void > {
483- const appConfigPath : string = getPath ( root , 'src' , 'app' , APP_CONFIG_FILE_NAME ) ;
483+ const appConfigPath : Path = getPath ( root , 'src' , 'app' , APP_CONFIG_FILE_NAME ) ;
484484
485485 const { result, contentString } = await TsUtilities . getArrayStartingWith ( appConfigPath , 'providers: [' ) ;
486486
@@ -528,7 +528,7 @@ export abstract class AngularUtilities {
528528 await this . addNavElement ( root , navElement ) ;
529529 }
530530
531- const sitemapPath : string = getPath ( root , 'src' , SITEMAP_FILE_NAME ) ;
531+ const sitemapPath : Path = getPath ( root , 'src' , SITEMAP_FILE_NAME ) ;
532532 const route : string | undefined = this . resolveInternalRoute ( navElement ) ;
533533 if (
534534 domain
@@ -566,7 +566,7 @@ export abstract class AngularUtilities {
566566 }
567567
568568 private static async addNavElement ( projectPath : string , element : AddNavElementConfig ) : Promise < void > {
569- const routesPath : string = getPath ( projectPath , 'src' , 'app' , ANGULAR_ROUTES_FILE_NAME ) ;
569+ const routesPath : Path = getPath ( projectPath , 'src' , 'app' , ANGULAR_ROUTES_FILE_NAME ) ;
570570
571571 const startIdentifier : ArrayStartIdentifier = this . getStartIdentifierForAddingNavElement ( element ) ;
572572 const { result, contentString } = await TsUtilities . getArrayStartingWith < typeof element . element > ( routesPath , startIdentifier ) ;
@@ -629,7 +629,7 @@ export abstract class AngularUtilities {
629629 '</urlset>'
630630 ] ) ;
631631
632- const angularJsonPath : string = getPath ( root , ANGULAR_JSON_FILE_NAME ) ;
632+ const angularJsonPath : Path = getPath ( root , ANGULAR_JSON_FILE_NAME ) ;
633633 const currentAngularJson : AngularJson = await FsUtilities . parseFileAs ( angularJsonPath ) ;
634634 // eslint-disable-next-line stylistic/max-len
635635 const currentAssets : AngularJsonAssetPattern [ ] = currentAngularJson ?. projects [ projectName ] ?. architect ?. [ 'build' ] . options ?. assets ?? [ ] ;
@@ -674,7 +674,7 @@ export abstract class AngularUtilities {
674674 ] ,
675675 'append'
676676 ) ;
677- const appComponentTs : string = getPath ( root , 'src' , 'app' , ANGULAR_APP_COMPONENT_FILE_NAME ) ;
677+ const appComponentTs : Path = getPath ( root , 'src' , 'app' , ANGULAR_APP_COMPONENT_FILE_NAME ) ;
678678 await this . addComponentImports (
679679 appComponentTs ,
680680 [
@@ -724,7 +724,7 @@ export abstract class AngularUtilities {
724724 }
725725 await FsUtilities . updateFile ( appComponentTs , tsLines , 'replace' ) ;
726726
727- const routesTs : string = getPath ( root , 'src' , 'app' , ANGULAR_ROUTES_FILE_NAME ) ;
727+ const routesTs : Path = getPath ( root , 'src' , 'app' , ANGULAR_ROUTES_FILE_NAME ) ;
728728 await FsUtilities . rename (
729729 getPath ( root , 'src' , 'app' , 'app.routes.ts' ) ,
730730 routesTs
@@ -825,7 +825,7 @@ export abstract class AngularUtilities {
825825 * @param path - The path of the ng-package.json.
826826 * @param data - The data to update with.
827827 */
828- static async updateNgPackageJson ( path : string , data : Partial < NgPackageJson > ) : Promise < void > {
828+ static async updateNgPackageJson ( path : Path , data : Partial < NgPackageJson > ) : Promise < void > {
829829 const oldData : NgPackageJson = await FsUtilities . parseFileAs ( path ) ;
830830 const updatedData : NgPackageJson = mergeDeep ( oldData , data ) ;
831831 await FsUtilities . updateFile ( path , JsonUtilities . stringify ( updatedData ) , 'replace' , false ) ;
@@ -836,13 +836,13 @@ export abstract class AngularUtilities {
836836 * @param path - The path of the angular.json.
837837 * @param data - The data to update with.
838838 */
839- static async updateAngularJson ( path : string , data : DeepPartial < AngularJson > ) : Promise < void > {
839+ static async updateAngularJson ( path : Path , data : DeepPartial < AngularJson > ) : Promise < void > {
840840 const oldData : AngularJson = await FsUtilities . parseFileAs ( path ) ;
841841 const newData : AngularJson = mergeDeep < AngularJson > ( oldData , data ) ;
842842 await FsUtilities . updateFile ( path , JsonUtilities . stringify ( newData ) , 'replace' ) ;
843843 }
844844
845- private static async addComponentImports ( componentPath : string , imports : TsImportDefinition [ ] ) : Promise < void > {
845+ private static async addComponentImports ( componentPath : Path , imports : TsImportDefinition [ ] ) : Promise < void > {
846846 await TsUtilities . addImportStatements ( componentPath , imports ) ;
847847 let lines : string [ ] = await FsUtilities . readFileLines ( componentPath ) ;
848848 for ( const imp of imports ) {
0 commit comments