File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
packages/cli/lib/templates Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,8 @@ export class ReactTemplate implements Template {
110110 const igResPath = path . join ( projectPath , this . igniteResources ) ;
111111
112112 if ( fs . existsSync ( igResPath ) ) {
113- let igniteuiResFile = fs . readFileSync ( igResPath , "utf8" ) ;
113+ const fd = fs . openSync ( igResPath , fs . constants . O_RDWR ) ;
114+ let igniteuiResFile = fs . readFileSync ( fd , "utf8" ) ;
114115 const freeVersionPath = "ignite-ui/" ;
115116 const fullVersionPath = "@infragistics/ignite-ui-full/en/" ;
116117 const dvPath = "@infragistics/ignite-ui-full/en/js/infragistics.dv.js" ;
@@ -124,17 +125,15 @@ export class ReactTemplate implements Template {
124125 igniteuiResFile = igniteuiResFile . replace ( "-lite" , "" ) ;
125126 }
126127
127- const fd = fs . openSync ( igResPath , fs . constants . O_WRONLY | fs . constants . O_TRUNC ) ;
128+ fs . ftruncateSync ( fd , 0 ) ;
128129 fs . writeSync ( fd , igniteuiResFile ) ;
129- fs . closeSync ( fd ) ;
130130 }
131131
132132 if ( dvDep && ! igniteuiResFile . includes ( dvPath ) ) {
133- const fd = fs . openSync ( igResPath , fs . constants . O_WRONLY | fs . constants . O_APPEND ) ;
134133 fs . writeSync ( fd , `\r\n// Ignite UI Charts Required JavaScript File\r\nimport "${ dvPath } ";\r\n` ) ;
135- fs . closeSync ( fd ) ;
136134 }
137135
136+ fs . closeSync ( fd ) ;
138137 } else {
139138 Util . log ( `igniteuiResources.js file NOT found!` ) ;
140139 }
You can’t perform that action at this time.
0 commit comments