@@ -11,7 +11,8 @@ const sandboxPath = path.join(process.cwd(), './testing/sandbox/angular');
1111const appPath = path . join ( sandboxPath , appName ) ;
1212const schematicsDirectory = '../../../../devextreme-schematics' ;
1313const schematicsPath = path . join ( sandboxPath , schematicsDirectory ) ;
14- const appComponentPath = path . join ( appPath , 'src/app/app.component.html' ) ;
14+ const appComponentTemplatePath = path . join ( appPath , 'src/app/app.component.html' ) ;
15+ const appComponentPath = path . join ( appPath , 'src/app/app.component.ts' ) ;
1516
1617async function prepareSchematics ( ) {
1718 await packageManager . runInstall ( {
@@ -62,9 +63,25 @@ exports.createApp = async(depsVersionTag) => {
6263} ;
6364
6465exports . setLayout = ( layoutName ) => {
65- const regexToFind = / a p p - s i d e - n a v - \w + - t o o l b a r / g;
66- const newSubStr = `app-${ layoutName } ` ;
67- const data = fs . readFileSync ( appComponentPath , 'utf8' ) ;
68- const result = data . replace ( regexToFind , newSubStr ) ;
69- fs . writeFileSync ( appComponentPath , result , 'utf8' ) ;
66+ const layoutClassName = layoutName === 'side-nav-outer-toolbar'
67+ ? 'SideNavOuterToolbarComponent'
68+ : 'SideNavInnerToolbarComponent' ;
69+
70+ [
71+ {
72+ filePath : appComponentTemplatePath ,
73+ regexp : / a p p - s i d e - n a v - \w + - t o o l b a r / g,
74+ replacement : `app-${ layoutName } ` ,
75+ } ,
76+ {
77+ filePath : appComponentPath ,
78+ regexp : / S i d e N a v \w + T o o l b a r C o m p o n e n t / ,
79+ replacement : layoutClassName ,
80+ }
81+ ] . forEach ( ( { filePath, regexp, replacement } ) => {
82+ const data = fs . readFileSync ( filePath , 'utf8' ) ;
83+ const result = data . replace ( regexp , replacement ) ;
84+ fs . writeFileSync ( filePath , result , 'utf8' ) ;
85+ } ) ;
86+
7087} ;
0 commit comments